PDA

View Full Version : Using OpenGL for calculation only



project6
05-30-2008, 01:38 AM
Hi

I need to use some OpenGL functions without drawing anything, e.g. gluLookAt()

I tried this:



glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLdouble debug[16];
glGetDoublev(GL_PROJECTION_MATRIX, debug);


My debug vector gets filled with random junk. Shouldn't it be set to the identity matrix? Do I need to do some kind of initialization in order to use OpenGL like this?

/p6

Relic
05-30-2008, 01:47 AM
Do you have an OpenGL context current while doing the gl-calls?

Zengar
05-30-2008, 02:09 AM
In addition to Relic's suggestion, could you please elaborate on what are you trying to achieve? If you want to do matrix calculations with OpenGL, I suggest you let it be...

project6
05-30-2008, 02:19 AM
No, I guess I don't have any OpenGL context, how would I set this up as easy as possible?

I want to use the gluLookAt() function in order to transform a camera eye + target into a 4x4 matrix.

Lord crc
05-30-2008, 02:48 AM
Someone just posted their own implementation of gluLookAt in the math forum (http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=239195).

Zengar
05-30-2008, 03:01 AM
No, I guess I don't have any OpenGL context, how would I set this up as easy as possible?

I want to use the gluLookAt() function in order to transform a camera eye + target into a 4x4 matrix.

The gluLookAt algorithm is available, it would be much simpler to compute the matrix yourself.