Jump to content
  • Advertisement
Sign in to follow this  
DonutEnigma

OpenGL [SOLVED] Inverted texture problem using RH coord system

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

I'm working on a game using Direct3D at the moment. But I'd like to support OpenGL in the future as well. I'm far more familiar with OpenGL than I am with Direct3D, so I've set up my coordinate system to be right-handed since I think it would be easier to work with the same coordinate system in both APIs. Anyway, I've got a cube that is texture mapped with the positive/negative Axis for each side and aligned with the axes. My problem is that the texture is inverted on the U axis (e.g. the word Units is written in a mirror) now that I'm using a right-handed system. It looked fine with a left-handed one, but the axes were somewhat wrong. The model was made with 3DS max, which uses a right-handed system also. The texture coordinates are mapped such that the bottom left of the texture is 0,0 (like OpenGL, but flipped from Direct3D). The texture is a JPEG, so I've been using D3DXCreateTextureFromFile() to load it. I think I can solve this problem by simply flipping the actual texture upside down and then not messing with the V texture coordinates (1 - V currently which would turn into just V for both OpenGL and Direct3D). Now, my real problem is that I'm using JPEG's as textures, so I should probably change to something better, like TGA. But humor me if you can. Does anyone know if it's possible to get at the bytes of an IDirect3DTexture9 in order to flip it? From everything I've read so far that doesn't seem possible, so perhaps there is another solution to this problem that I'm overlooking aside from changing the texture file format and loading the texture myself. [Edited by - DonutEnigma on July 24, 2009 8:25:11 PM]

Share this post


Link to post
Share on other sites
Advertisement
Solved it. I actually had my Z axis inverted. So basically I was still in a LH system. I un-inverted the Z axis, so now I have a RH coordinate system and all is good.

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!