PDA

View Full Version : MatrixMode, glLoadIdentity, glTranslate, glRotate remvoved from OpenGL new versions?



avstenit
11-05-2013, 12:05 PM
One said that the functions like MatrixMode glLoadIdentity glTranslate glRotate will be removed from newer versions of OpenGL. I would like to know if this is true? As I am just begining to use OpenGL and I can't imagine how could anything be made without the calls of this functions?

What functions could then be used instead of this and why are or will they be removed? I would like to know where is the progress (logic) of this?

Thanks for the reply.

mhagain
11-05-2013, 12:17 PM
They can still be used in (most) newer version of OpenGL just by creating a compatibility context (which is the type of context that is created by default). I say "most" because some drivers may not be able to create such a context, but AFAIK this really only applies to OS X.

As for what you use instead of them - it's simple. You just use a software matrix library and load the matrix using glUniformMatrix calls. Here it's important to realise that - in the vast majority of cases - glTranslate/glRotate/etc were never really anything more than a software matrix library that was just implemented as part of the OpenGL API. Some exotic older hardware may have implemented them in hardware, but by the era of the NVIDIA TNT/etc they were always just pure software routines.

The logic behind this is the same as the logic behind all deprecation - removing inessential features in order to make OpenGL easier to implement. OpenGL drivers have a pretty poor reputation and one of the reasons for this was the complexity (and vagueness) of the specification. By making things less complex (and by specifying explicit behaviours) in theory OpenGL driver developers can focus more on essential features.

GClements
11-06-2013, 04:10 AM
One said that the functions like MatrixMode glLoadIdentity glTranslate glRotate will be removed from newer versions of OpenGL. I would like to know if this is true?
Not "will be", but "have been". Those functions don't exist in OpenGL 3+ core profile.


As I am just begining to use OpenGL and I can't imagine how could anything be made without the calls of this functions?
In legacy OpenGL, the only one of those functions which is strictly necessary is glLoadMatrix(); everything else can be implemented on top of that.


What functions could then be used instead of this
In modern OpenGL, you would use glUniform() or a uniform block to pass matrices to the vertex shader. The vertex shader would use those to transform incoming vertices, normals, texture coordinates, etc.


and why are or will they be removed?
They were removed because they were both unnecessary and, for anything beyond "example" programs, pointless. If you need to do anything with the transformed geometry beyond rendering it (e.g. picking, collision, etc), the application needs the transformation matrix, so you may as well just have the application supply the matrix.

avstenit
11-06-2013, 11:20 PM
Thanks for the clear answers to all.