2

In OpenGL ES 2.0, you apparently can't do

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

any more to set the model matrix, but I think these matrices are still built in somehow, since the GLSL spec tells you how to access them in a vertex shader.

// 
// Matrix state. p. 31, 32, 37, 39, 40. 
// 
uniform mat4  gl_ModelViewMatrix; 
uniform mat4  gl_ProjectionMatrix; 
uniform mat4  gl_ModelViewProjectionMatrix; 

so how do I pass these values to my shader? do I use glUniformMatrix4fv somehow?

The source code from the OpenGL ES 2.0 Programming Guide has been helpful for the shader part but all the examples appear to just leave the matrix transforms alone and just make sure their vertices are between -1.0 and 1.0.

UPDATE: apparently the OpenGL ES Shader Language does not support the pre-defined entries like gl_ModelViewMatrix, so the only answer is to define your own custom model/view/projection matrices as done in the code linked below, using glGetUniformLocation and glUniformMatrix4fv. I was confused because the OpenGL Shader Builder does support them, but that's plain OpenGL, not OpenGL ES.

David Maymudes
  • 5,664
  • 31
  • 34

1 Answers1

0

gl_ModelViewProjectionMatrix does not appear to be in the "OpenGL ES Shading Language version 1.00" specification. There seems to be many Shading Language specifications, so that likely was the cause of confusion. As I understand it, you define your own uniforms for matrix storage.

Kalen
  • 3,106
  • 8
  • 29
  • 42