I\'ve got a problem in that I\'m trying to draw a solar system using textures (one texture for each planet) and as I draw my textures, only the 1st one appears. None of the
Just had to deal with this problem so I thought I'd chip in as well.
I saw the accepted answer and in my case, I did reset everything correctly in the pipeline. In my pipeline, I need to render both 3D and 2D objects. For 3D objects I would switch to 3D projection/model view and for 2D objects would switch to orthographic projection.
However, when I wanted to render a couple of text blocks (using quads and textures), only the first texture was rendered. Depth testing was the root of my problem. So I've modified the code above to work for my situation.
void DrawFrame()
{
foreach object
{
drawObject(); // Is an abstract method
}
}
void _3DObject::drawObject() {
switchTo3D();
// Camera transform
glPushMatrix();
.
. // Draw
.
.glPopMatrix();
}
void _2DObject::drawObject() {
switchTo2D();
// Having depth testing enabled was causing
// problems when rendering textured quads.
glDisable(GL_DEPTH_TEST);
// Camera transform
glPushMatrix();
.
. // Draw
.
.glPopMatrix();
glEnable(GL_DEPTH_TEST);
}
PS: "Just" refers to exactly 1 month ago! Don't know why I forgot to post this answer sooner :(