Jump to content
  • Advertisement
Sign in to follow this  
KKTHXBYE

glMultMatrixf and glLoadMatrixf does not work ffs!

This topic is 2120 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 Edited by ___

Share this post


Link to post
Share on other sites
Advertisement
i did

int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm));
and i get

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



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 Edited by ___

Share this post


Link to post
Share on other sites

i did

int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm));
and i get

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



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 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. Edited by slicer4ever

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!