PDA

View Full Version : Problem with glGetFloatv



swethasharma
01-30-2012, 08:29 AM
Hello,

This is the code which i have written



void GLFWCALL reshape(int width,int height)
{
glViewport(0,0,width,height);
//GLfloat mat[4][4]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
GLfloat mat[16];

glMatrixMode(GL_PROJECTION);

glLoadIdentity();
glGetFloatv(GL_PROJECTION,mat);

glFrustum(0.0,(GLdouble)width,0.0,(GLdouble)height ,1.0,7.0);

glMatrixMode(GL_MODELVIEW);

}


The function glGetFloatv is returning matrix having garbage value.
I have tried initializing the matrix mat to 0,in that case it is returning 0.
What is wrong with this code?

Alfonse Reinheart
01-30-2012, 08:33 AM
The proper glGet parameter is `GL_PROJECTION_MATRIX`, not `GL_PROJECTION`.

swethasharma
01-31-2012, 02:45 AM
Thankyou,got it!
-swetha