PDA

View Full Version : look at programing problem



bardackx
07-03-2010, 10:56 AM
okay, here is the problem.

I have a trackball rotation clas wich works great with gluLookAt, since gluLookAt is not usable anymore due to deprecation I tryed to program it myself and is not working as it should.

Do you have an example of a working opengl scene that fully emulates the next old code?



gl.glLoadIdentity();
glu.gluLookAt(
2, 0, 6,
0, 0, 0,
0, 1, 0);
gl.glTranslatef(-1.5f, 0.0f, 0f);
gl.glRotate(45, 0, 0, 1);
// your favorite drawing method


Thanks in advance

Note: this two programs helped me a lot at understanding modelview and projection matrices, if you know a similar program that works with lookAt function would be great (just for the matriz values to compare)

ModelView program (http://www.songho.ca/opengl/gl_transform.html#example1)
Projection program (http://www.songho.ca/opengl/gl_transform.html#example2)

Ilian Dinev
07-03-2010, 11:03 AM
http://pyopengl.sourceforge.net/documentation/manual/gluLookAt.3G.html

Also, look at GLM's implementation. (http://glm.g-truc.net/)

bardackx
07-03-2010, 11:26 AM
I see an interesting thing, that matrix (wich looks like mine) is column mayor or row mayor?
11 12 13 14?
11 21 31 41?
Maybe there is my trouble

THAT WAS FAST

Thankyou very much!
All my matrix calculus are in row mayor, but the look at example I have was directly from the GLU code, just with a transposition it got fixed, thanks!

Extra:
The column mayo or row mayor order have impact on the OpenGL performance?

ugluk
07-03-2010, 01:27 PM
I think, if there is any impact, it is probably negligible.