Using OpenGL for calculation only

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

Do you have an OpenGL context current while doing the gl-calls?

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…

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.

Someone just posted their own implementation of gluLookAt in the math forum.

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