Jump to content

  • Log In with Google      Sign In   
  • Create Account

glMultMatrixf and glLoadMatrixf does not work ffs!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 WiredCat   Members   -  Reputation: 365

Like
0Likes
Like

Posted 21 September 2012 - 03:52 PM

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 ___, 21 September 2012 - 04:24 PM.


Sponsor:

#2 the_visualist   Members   -  Reputation: 169

Like
0Likes
Like

Posted 23 September 2012 - 09:33 AM

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)

#3 WiredCat   Members   -  Reputation: 365

Like
0Likes
Like

Posted 24 September 2012 - 02:24 PM

i did
						 int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm[i]));
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 ___, 24 September 2012 - 02:29 PM.


#4 slicer4ever   Crossbones+   -  Reputation: 3984

Like
0Likes
Like

Posted 24 September 2012 - 02:35 PM

i did

						 int i;
for (i=0;i<16;i++)
ShowMessage(FloatToStr(l->cvm[i]));
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, 24 September 2012 - 02:36 PM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#5 WiredCat   Members   -  Reputation: 365

Like
0Likes
Like

Posted 25 September 2012 - 03:08 AM

nahh i am so stupid ;] my mistake i used glloadmatrix when i shouldn't :P




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS