Page 1 of 1
[3D]The Textures Are Rotated 90º
Posted: Sun Jul 26, 2009 4:12 pm
by Almamu
Hi, im programing in 3D, but ALL my models(aprox. 13) have the texture rotated. Anyone knows what causes this problem ?
Where y can find 3D Tutorials for LIBNDS ?
Re: [3D]The Textures Are Rotated 90º
Posted: Fri Aug 14, 2009 7:57 pm
by DarkShadow44
First, how do you load your textures ?
2) Look for tutorial for OpenGL, they will help you
Re: [3D]The Textures Are Rotated 90º
Posted: Sat Aug 22, 2009 5:08 am
by weirdfox
I don't have any texture rotation problem here...
Well, without any code or details it's hard to help (screenshots of expected and actual results might help too).
- What's your texture format?
- Are you sure you UV are ok ?
- What 3D software are you using and which exporter ?
- Any specific mesh format used ?
But if you only want to rotate all your textures, just change the texture matrix:
Code: Select all
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glRotatef(90.0f,0.0f,0.0f,1.0f);
glMatrixMode(GL_MODELVIEW);
90 being the angle you want to rotate them, but it could be -90 depending on the way you want them to go.
This should only have to be done once, except if you modify the texture matrix again.
But if you want to change that matrix a few times, it might be good to build a rotation matrix, store it and use it (instead of the two matrix modifications above) :
(see
http://www.opengl.org/documentation/spe ... otate.html for the GL rotation matrix equations)
Prepare your matrix once and keep it some place safe
Then :
Code: Select all
glMatrixMode(GL_TEXTURE);
glLoadMatrix(textureMatrix);
glMatrixMode(GL_MODELVIEW);
This will save you the matrix multiplication on each set.
Have fun !