# can you help me with this problem?

## i have make a split screen program… i’m using glut… this how the code and program looks like…

void renderSceneLeft() {
glutSetWindow(subWindowleft);
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);

``````renderScene2(subWindowleft);
``````

}

void renderSceneRight() {

``````glutSetWindow(subWindowright);
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);

renderScene2(subWindowright);
``````

i want to make a stereo program…
that mean i have to put some calculation to the left and right function(in the code) so that the image would display a stereo mode…
the calculation is like this:: http://www.sahabatrimba.com/picture/formulab.jpg
the problem is, how can i impliment it to my code?
can anybody help me?

Howdy,

well, you can easily transfer any matrix you want with glMatrixMult(). Use those formulas to make your matrix and upload them to the modelview stack before you render anything. Or projection matricies, or whatever they are. Those formulas look funky. I just computed my own frustums and sent them to glFrustum() when I did stereo stuff, but… meh.

cheers
John

can you show me how to impliment it?
the formula(that i refer ) show matric 4x4
but in glLookat just have 9 value to fill in so i dont really understand how to do it…
if i’m wrong, can you show me the wright way or any suggestion from you?

this is how it works in opengl:

a vertex (in object coordinates) is transformed by the modelview matrix. the vertex is now in eye coordinates. then come the projection matrix which transform the vertex in screen coordinates.

gluLookAt modify a matrix (usually modelview) in order to put the camera somewhere.

this function hide the matrix mecanism. as john said, you have to multiply the modelview matrix with the matrix in the formula. I don’t kwow how work your matrix but your code whould look like:

glMatrixMode(GL_MODELVIEW);
compute_stereo_left_matrix(m);
glMultMatrix(m);
render_scene();

and the same for right view. you should read a camera tutorial (http://nehe.gamedev.net - http://www.gametutorials.com …) to understand the opengl transformation stage.