View Full Version : Getting Projection Matrix

10-08-2009, 02:58 PM
Hi All,

This is my first post here so please forgive any noobiness. I just started learning openGL couple days ago. I tried to creat a simple program but it seems to not be working. It compiles properly but other then that when I run it, I don't get any output. I am basically trying to compute a projection matrix (i tried both gluPerspective and glFrustum) and then using glGetDoublev to retreive the data.

It all seems to compile but when I run it, glGetDoublev does nothing. The data buffer is completely empty. I did the calulcations by hand so I know the numbers that should be in the matrix.

Any help will be appreciated. Here's the code I am using (visual studio 2005).

int _tmain(int argc, _TCHAR* argv[])
GLdouble temp[16];


//GLdouble *temp = (GLdouble *) calloc(16,sizeof(GLdouble));


glGetDoublev(GL_PROJECTION_MATRIX ,temp);

temp[0] = 10;

return 0;

James W. Walker
10-08-2009, 04:03 PM
You need to set up a window and OpenGL context before you can start calling OpenGL functions. On Windows, this would involve using either the GLUT library or Microsoft's wgl functions.

10-08-2009, 04:19 PM
How would I go about doing that?

I thought that since I don;t need to draw any of this on the screen there is no need to crerat a window.

10-08-2009, 05:24 PM
Solved it. Thanks. Just did a window draw call and magically all the numbers poped up. Thanks.