PDA

View Full Version : can you help me with this problem?



apit
07-14-2003, 11:22 PM
i have make a split screen program..
i'm using glut....
this how the code and program looks like..
-----------------------------------------
void renderSceneLeft() {
glutSetWindow(subWindowleft);
glLoadIdentity();
gluLookAt(x, y, z,
x + lx,y + ly,z + lz,
0.0f,1.0f,0.0f);

renderScene2(subWindowleft);
}

void renderSceneRight() {

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

renderScene2(subWindowright);
}
download executable
-------------------- http://www.sahabatrimba.com/download/glutsubwin.exe
---------------------------------------------
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?
this is where i get the calculation(full version).. http://www.stereographics.com/support/downloads_support/handbook.pdf
can anybody help me?

john
07-15-2003, 02:25 AM
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

apit
07-15-2003, 07:42 PM
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?

apit
07-17-2003, 10:08 PM
can anybody help me please....

errno
07-17-2003, 10:30 PM
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);
glLoadIdentity();
gluLookAt(head position / orientation);
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.

apit
07-20-2003, 05:01 AM
gluLookAt(head position / orientation);
how to do this?
compute_stereo_left_matrix(m);
not really understand...
glMultMatrix(m);
can you describe this ...

p/s:thanks a lot for your concern..i really appriciate it..

apit
07-22-2003, 05:32 AM
can anybody help me?
i really need help for this stuff coz it is a part of my research... thanks for your concern..

Relic
07-22-2003, 05:49 AM
Look through the examples on stereographics' developer page: http://www.stereographics.com/support/developers/
Lots of different implementations there.