hello, i have a var calles
cvm that is float * cvm;
i initialize: cvm = new float[16];
then i call
glGetFloatv(GL_MODELVIEW_MATRIX, cvm);
to save modelview matrix
and then i want to restore the view by calling glLoadMatrixf (or glMultMatrixf) but instead of scene i see nothing (blank screen)
what the hell?
or i get Floating point division by zero error, when try to render something by vbo
glMultMatrixf and glLoadMatrixf does not work ffs!
Try some debugging! Just print out the results that glGetFloatv gives you and see if there is something wrong. (if its all 0's or similar)
i did
0.9916 -0.053010 0.1173 0
0 0.91127 0.41179 0
-0.128 -0.408 0.9036 0
-263.81 -508.87294 -282.527 0.99999
heres full src how i botain matrx
int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm));
and i get0.9916 -0.053010 0.1173 0
0 0.91127 0.41179 0
-0.128 -0.408 0.9036 0
-263.81 -508.87294 -282.527 0.99999
heres full src how i botain matrx
glPushMatrix();
glLoadIdentity();
gluPerspectiveA(90.0f, windowWidth/windowHeight, 0.010f /*1000.0f*/, 1000.0 * 1000.0 * 1000.0);
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
campointofview.x, campointofview.y, campointofview.z,
0.0f, 1.0f, 0.0f);
glGetFloatv(GL_PROJECTION_MATRIX, cpm);
glPopMatrix();
glPushMatrix();
glLoadIdentity();
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
campointofview.x, campointofview.y, campointofview.z,
0.0f, 1.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX, cvm);
glPopMatrix();
and i get floating point division by zero when i try to draw sth x_X
i did
and i get
int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm));
0.9916 -0.053010 0.1173 0
0 0.91127 0.41179 0
-0.128 -0.408 0.9036 0
-263.81 -508.87294 -282.527 0.99999
heres full src how i botain matrx
and i get floating point division by zero when i try to draw sth x_X
glPushMatrix();
glLoadIdentity();
gluPerspectiveA(90.0f, windowWidth/windowHeight, 0.010f /*1000.0f*/, 1000.0 * 1000.0 * 1000.0);
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
campointofview.x, campointofview.y, campointofview.z,
0.0f, 1.0f, 0.0f);
glGetFloatv(GL_PROJECTION_MATRIX, cpm);
glPopMatrix();
glPushMatrix();
glLoadIdentity();
gluLookAt(cameraPosition.x, cameraPosition.y, cameraPosition.z,
campointofview.x, campointofview.y, campointofview.z,
0.0f, 1.0f, 0.0f);
glGetFloatv(GL_MODELVIEW_MATRIX, cvm);
glPopMatrix();
i suspect it is your perspective that's the problem, your near/far ratio is INSANE, secondly, you need to remove the lookAt from your perspective calculations, which is probably also screwing up your view.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement