Jump to content
  • Advertisement
Sign in to follow this  

images appearing upside down?

This topic is 4773 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

Advertisement
If OGL is anything like DirectX regarding textures then cant u invert the texture coordinates?

ace

Share this post


Link to post
Share on other sites
#first:
try to rotate the GL_TEXTURE like this
glMatrixMode(GL_TEXTURE);
glRotatef(180,0,0,1);
glMatrixMode(GL_MODELVIEW);

#second:
try to swap the array buffers like
unsigned char tmp=new unsigned char[image.size];
for (int i=0;i<image.size;i++)
tmp=image.data[(size-1)-i];
for (i=0;i<image.size;i++)
image.data=tmp;
delete []tmp;

something like this ..
i hope you get it :)

Share this post


Link to post
Share on other sites
Are you sure they're upside down and not mirrored horizontally?

If they're mirrored horizontally it's because you haven't taken into account the fact that opengl coordinates conventionally put 0,0 at the bottom left of the screen.

You can fix this several ways
- Invert the y component of your texture coordinates
- Create the texture the other way up

The latter is often a nicer approach.

Mark

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!