z matrix value opengl
Is there an easy way to determine the current z-depth after applying glTransform & glRotate several times?
Can you ask your question in another way? Is your question about the z-buffer, or the z coordinate of an object, or.. ?
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
Popular Topics
Advertisement