Click here to Skip to main content
15,885,904 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm a fresh on this,but now I am trying to good at it, while I am reading book about modelview, I got a problem... I can't understand about it.

Now show those codes:
float mat[16];
  glGetFloatv(GL_MODELVIEW_MATRIX, mat);
  vector3_t X(mat[0], mat[4], mat[8]);
  vector3_t Z(mat[1], mat[5], mat[9]); 
  glBindTexture(GL_TEXTURE_2D, g_cactus[cactus]);
  vector3_t pos(x,0.0,-z);
  pos.y = GetHeight(x, -z) + h + s;
  glBegin(GL_QUADS);
	 glTexCoord2f(0.0,0.0);glVertex3fv((pos+(X+Z)*-h).v);	 glTexCoord2f(1.0,0.0);glVertex3fv((pos+(X-Z)* h).v);
	 glTexCoord2f(1.0,1.0);glVertex3fv((pos+(X+Z)* h).v);
	 glTexCoord2f(0.0,1.0);glVertex3fv((pos+(Z-X)* h).v);
  glEnd();

What's the "mat" mean? And the following datas(0,4,8,1,5,9)?

Thanks for your help!
Posted
Updated 1-Mar-11 19:33pm
v2

1 solution

"mat" looks like a 4x4 matrix of floating point values. It's used for transforming coordinates in 3 dimensional space.
 
Share this answer
 
Comments
shadownightback 1-Mar-11 21:44pm    
thanks a lot! but what's the datas work?
Dave Kreskowiak 2-Mar-11 0:15am    
You wanted to know - Start with this: http://en.wikipedia.org/wiki/Transformation_matrix and this: http://gpwiki.org/index.php/Matrix_math, then move on to these: http://www.google.com/#sclient=psy&hl=en&q=3d+matrix+transforms&aq=f&aqi=g-v1&aql=&oq=&pbx=1&bav=on.2,or.&fp=42ea6e12edc6080

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900