Hello,
I’m really struggling to grasp the thinking behind OpenGL ES 2.0, and the lack of immediate mode and push/pop matrix.
Usually, when rendering a scene in OpenGL I would do something like this:
GL.PushMatrix();
{
//World Transformations
GL.Translate...
GL.Rotate...
//Render first sub-component
GL.PushMatrix();
{
//some transformations (e.g. position of person in world)
GL.Translate...
GL.Rotate...
//actually render the first object (e.g. a person)
GL.Begin(...);
GL.End();
//Render first sub-sub-component (e.g. hat on person's head)
GL.PushMatrix();
{
//some transformations (e.g. position of hat relative to person)
GL.Translate...
GL.Rotate...
//actually render the first sub-sub-object (e.g. a hat)
GL.Begin(...);
GL.End();
}
GL.PopMatrix();
}
GL.PopMatrix();
//render second sub-component
GL.PushMatrix();
{
//some transformations (e.g. position of dog in world)
GL.Translate...
GL.Rotate...
//actually render the second object (e.g. a dog)
GL.Begin(...);
GL.End();
}
GL.PopMatrix();
}
GL.PopMatrix();
From what I understand of OpenGL ES 2.0, I can’t push/pop matrix, and instead I have to :
- Define a shader (which appears to require me to define both a vertex AND fragment shader?!)
- At each level of nesting (i.e. each time I push above), I have to do all the matrix transformations <i>in software</i> and push the results into the shader?
…
Seriously?
Please tell me I’m missing something here. Apart from being unbelievably inconvenient, this feels like a horrible horrible hack.
It would seem that the very first thing I’m going to need to do before OpenGL ES 2.0 is usable for me is to build a little framework on top of it so that I can do the type of object composition that I’ve always considered to be fundamental to OpenGL.
I sincerely hope that I’m missing something fundamental here, so I look forward to being corrected.
Regards,
James L.