View Full Version : anaglyph rendering problem

07-28-2005, 02:34 AM
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:


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++) {

if (anaglyph==TRUE){
glColorMask(GL_FALSE, GL_TRUE, GL_TRUE, GL_TRUE); //green/blue
} else {
glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_TRUE); //red

glRotatef(rtri,0.0f,1.0f,0.0f); // Rotate The Triangle On The Y axis ( NEW )


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

07-28-2005, 04:06 AM
Unless i am mistaken the mask set by glColorMask is applied even for clear operations. Enable write into all channels before you do glClear.

07-28-2005, 04:15 AM
yeah, thanks. it works now!