PDA

View Full Version : Why OpenGL use in my prog. left coordinate system



xpear
07-09-2010, 06:21 AM
I wrote program which generate this picture
http://w677.wrzuta.pl/sr/f/01jTmePucq7/gl
and the code for axial is
"
glLineWidth(3.0f);
glBegin (GL_LINES);
glColor3f (1.0f, 0.0f, 0.0f); //red green blue
glVertex3f (0.0f, 0.0f,0.0f);
glVertex3f (0.0f, 200.0f,0.0f);

//red line Y axis
glColor3f (0.0f, 1.0f, 0.0f);
glVertex3f (0.0f, 0.0f,0.0f);
glVertex3f (200.0f, 0.0f,0.0f);

//green line X axis
glColor3f (1.0f, 1.0f, 1.0f);
glVertex3f (0.0f, 0.0f,0.0f);
glVertex3f (0.0f, 0.0f,200.0f);

//blue line Z axis
glEnd ();
"
why it's looke like left-handle coordinate thus opengl use right coordinate system?

carsten neumann
07-09-2010, 07:22 AM
hm, perhaps you have multiplied a negative scale onto the matrix stack?

xpear
07-12-2010, 01:12 AM
I don't multiplet by negative , but i thing i find solution, look at this site OpenGL Projection Matrix (http://www.songho.ca/opengl/gl_projectionmatrix.html)

Dark Photon
07-13-2010, 05:19 PM
Your picture is ambiguous because it uses no hidden line removal.

You could be below and to the left of the origin, with the Z axis shooting up over your right shoulder (right-handed axes)...

Or you could be up and to the right of the origin, with the white line shooting our and away from your left foot (left-handed axes)...

Unless you have a negation in your lookat transform, I'd suspect the former since OpenGL is right-handed.

Turn on depth test and render some surfaces to remove the ambiguity.