hi everyone,
i’m not quite sure, if my problem fits this forum, since the overall topic (anaglyph) rendering seems to be relatively tricky, but it’s a simple program, so i put it in here.
i want to render a scene for watching it through anaglyph glasses, so i put each rendering pass (one with a glColorMask filter for red, an one for green/blue) into a for-loop, to render the scene twice. But my problem is, that the green/blue part of the picture doesn’t seem to be updated each frame - for each new frame, the picture is displayed upon the old one. But instead of this, the red part of the picture works fine.
To show you what i mean, here is a picture:
http://uk.pg.photos.yahoo.com/ph/markuslanser/detail?.dir=/ba11&.dnm=6946.jpg
It’s a rotating pyramid, the green-blue part of the picture is a tiny bit more on the left side, and the red part of the picture is more on the right side.
int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer
glLoadIdentity(); // Reset The Current Modelview Matrix
for(int i=0; i<2; i++) {
glLoadIdentity();
if (anaglyph==TRUE){
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); //green/blue
glTranslatef(-1.5f,0.0f,-6.0f);
anaglyph=FALSE;
} else {
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); //red
glTranslatef(-1.4f,0.0f,-6.0f);
anaglyph=TRUE;
}
glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )
DrawTriangle();
}
rtri+=0.2f; // Increase The Rotation Variable For The Triangle ( NEW )
rquad-=0.15f; // Decrease The Rotation Variable For The Quad ( NEW )
return TRUE; // Keep Going
}
i know, it seems to be a very simple problem, but i can’t figure out, what’s wrong - i appreciate every help i can get - Thanks