Results 1 to 3 of 3

Thread: anaglyph rendering problem

  1. #1
    Member Newbie
    Join Date
    Sep 2004
    Location
    Germany
    Posts
    39

    anaglyph rendering problem

    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/mar...&.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.

    Code :
     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

  2. #2
    Senior Member Frequent Contributor
    Join Date
    May 2005
    Location
    Prague, Czech Republic
    Posts
    913

    Re: anaglyph rendering problem

    Unless i am mistaken the mask set by glColorMask is applied even for clear operations. Enable write into all channels before you do glClear.

  3. #3
    Member Newbie
    Join Date
    Sep 2004
    Location
    Germany
    Posts
    39

    Re: anaglyph rendering problem

    yeah, thanks. it works now!

Similar Threads

  1. Anaglyph rendering and glBlendFunc()
    By Huusslv in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 05-08-2015, 11:36 PM
  2. anaglyph in gl
    By tincy in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 03-04-2010, 01:24 PM
  3. Chromatic Anaglyph
    By ffkiller in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-16-2003, 06:47 AM
  4. BW Anaglyph creation ...
    By imported_Christoph in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-13-2002, 04:24 AM
  5. Anaglyph suggestion please.
    By Ace_Man in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 01-01-2001, 05:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean