Can I somehow read/debug the gl_Position in a opengl es 2 (iOS 4.2) vertex shader?
I'm trying to write a simple vertex shader that uses perspective projection and it works fine, until I set the translation component of the model view matrix. Than nothing gets drawn. Vertex shader is very simple:
...
gl_Position = u_projection_matrix * u_model_view_m开发者_JS百科atrix * a_position;
...
I did the math by hand, knowing that the homogenized vertex position should satisfy: -w <= x <= w, -w <= y <= w, -w <= z <= w and it seems correct. If I could read/debug gl_Position I may discover what the issue is, so is there any way to do it?
To summarize: if u_model_view_matrix stays identity, it works fine.
are you sure your matrix are not transposed? Try reversing the multiplication :
gl_Position = a_position * u_model_view_matrix * u_projection_matrix;
精彩评论