Jump to content
  • Advertisement
Sign in to follow this  
authortitle

Problem with textures appearing on the wrong plane (?!)

This topic is 4862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, New here, seems like a place full of knowledgable people so hoping someone can help :) My problem is: I am attempting to texture map a scene, and the textures are appearing fine for objects in the Y plane (i.e. "vertical"), but not objects in the X plane - the textures appear to be stretched as if it was one pixel high. An example is: here - you can see the horizontal textures look stretched, but the vertical ones appear fine. (It's the exact same grass texture on all the "land") I'm not quite sure where I am going wrong (although it is likely something stupid!) - each quad has texture coords applied (0,0 in the top left, 1,0 in the top right, etc). The problem disappears if I stop textures being bound to an object - i.e. removing the following lines from my LoadTextures() function: // Texturing Contour Anchored To The Object glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); // Texturing Contour Anchored To The Object glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR); (example - here) but this then causes the textures to not move when the viewpoint moves, causing a "swimming" effect as you move through the scene. Another solution I found was to draw the object in the Y plane, and then rotate it to be in the correct position, but I'm sure you'll agree this is far from ideal. I must admit that my knowledge of OpenGL is pretty much from code examples (e.g. NeHE, and the examples for the module for which I am creating this work) and reading around the internet and man pages, so it's possible that there is something important that I am overlooking. If anyone has any ideas about what *could* be going wrong here, it would be very much appreciated. Thanks, Tom

Share this post


Link to post
Share on other sites
Advertisement
glTexGen creates new uv coordinates, this causes the textures to be projected in only one direction.

the best way is just to use the correct UV coordinates from the beginning.

Quote:
Original post by authortitle
this then causes the textures to not move when the viewpoint moves, causing a "swimming" effect as you move through the scene.


I am a bit curious though, why should the texture move when the viewport moves, and what is this "swimming" effect your talking about.

But i can see what it might look a bit odd if you use those coordinates on every quad, each quad has to have their own set of specialized uv coordinates.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!