mathieu angus (Matthieu) New member Username: Matthieu
Post Number: 1 Registered: 2-2007
Rating: N/A Votes: 0 (Vote!) | Posted on Friday, February 09, 2007 - 11:39 am: | |
Hi, I am novice with the 3D topic .... So excuse my ignorence. I ld like to create stereo view of a object with 2 camera (using openGL and glut). theorically, i might have 2 superposed images but when i execute my program the image is blinking and i can see a switching between the 2 camera pic. i put my code below, thX to let mne know what is wrong matthieu buffer type in main function: glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH | GLUT_STEREO); in display function: glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 30.0); //glFrustum(-aspectViewport * 0.75 - frustumAdjust,aspectViewport * 0.75 - frustumAdjust, -0.75, 0.75, 1.0, 30.0); glTranslatef(Disparity, 0.0f, 0.0f); glTranslatef(0.0f, 0.0f, -2.0f); // Setup the transformation matrix for the object. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glTranslatef(0.0, 0.0, -2.0); glEnable(GL_DEPTH_TEST); drawScene(); glPopMatrix(); glutSwapBuffers(); //glClear (GL_DEPTH_BUFFER_BIT ); cout<<"camera right"<<endl; //glMatrixMode(GL_MODELVIEW); glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 30.0); //glFrustum(-aspectViewport * 0.75 + frustumAdjust,aspectViewport * 0.75 + frustumAdjust, -0.75, 0.75, 1.0, 30.0); glTranslatef(-Disparity, 0.0f, 0.0f); glTranslatef(0.0f, 0.0f, -2.0f); // Setup the transformation matrix for the object. glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glPushMatrix(); glTranslatef(0.0, 0.0, -2.0); glEnable(GL_DEPTH_TEST); drawScene(); glPopMatrix(); glutSwapBuffers(); |