Jump to content
  • Advertisement
Sign in to follow this  
Solance

images appearing upside down?

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

how can i correct images appearing upside down i am using c++ is the only way to rotate the image 180 degrees?

Share this post


Link to post
Share on other sites
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
it's been a long time sense i've played arround in OGL, but try something like

GL_MatrixMode(GL_TEXTURE);
GL_Scalef(-1,0,0);

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
are you in ortho mode?

I read somewhere that textures are drawn from bottom to top.

GL_Scalef(0,-1,0); // X,Y,Z

will invert the screen

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!