void DrawSphere(CVector3 Pos,float speed)
{
glBindTexture(GL_TEXTURE_2D, g_textureId);
glEnable(GL_TEXTURE_2D);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.0f, Spin, 0.0f);
Spin += speed;
glMatrixMode(GL_MODELVIEW);
glInterleavedArrays( GL_T2F_N3F_V3F, 0, g_sphereVertArray );
glTranslatef( Pos.x, Pos.y, Pos.z );
glDrawArrays( GL_QUAD_STRIP, 0, g_nTotalVerts );
glDisable(GL_TEXTURE_2D);
}
Texture matrix
i'm trying to work a bit with texture matrix and i've got a small problem. I've this function that renders a sphere with a texture:
and works fine. the problem is that if i render another textured object, its texture changes too, and i don't want that.
How can i do?
Do you set the texture matrix to identity before rendering the next object?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement