Sign in to follow this  
WiredCat

glMultMatrixf and glLoadMatrixf does not work ffs!

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
i did
[CODE]
int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm[i]));
[/CODE] 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


[CODE]
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();



[/CODE] 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
[quote name='___' timestamp='1348518297' post='4983343']
i did
[CODE]
int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm[i]));
[/CODE] 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


[CODE]
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();



[/CODE] and i get floating point division by zero when i try to draw sth x_X
[/quote]

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this