z matrix value opengl

Started by
1 comment, last by idinev 15 years, 9 months ago
Is there an easy way to determine the current z-depth after applying glTransform & glRotate several times?
Advertisement
Can you ask your question in another way? Is your question about the z-buffer, or the z coordinate of an object, or.. ?

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.


Maybe like this:

Mat4 glGetMatrixMVP(){	Mat4 mv,p;	glGetFloatv(GL_PROJECTION_MATRIX,p.mat_array);	glGetFloatv(GL_MODELVIEW_MATRIX,mv.mat_array);	Mat4 mvp = p*mv;	return mvp;}...Mat4 mvp = glGetMatrixMVP();vec4 origin=vec3(0,0,0,1);vec4 transformed = mvp * origin;now you have the transformed.z value

This topic is closed to new replies.

Advertisement