Advertisement

Texture matrix

Started by October 24, 2004 05:03 PM
1 comment, last by b3rs3rk 20 years, 1 month ago
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:

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);
}

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?
Advertisement
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);

added at the end of the function. feel so stupid.thanks :)

This topic is closed to new replies.

Advertisement