The Big Picture
Perhaps the biggest change in the whole library is the conversion OpenGL 3.2 core profile only. This design decision was made for a number of reason, primarily for speed and compatibility across platforms, but also so I can teach the very latest versions of OpenGL and CGI techniques. The only major issue you may encounter with this change is that only Mac OSX Lion is now supported.
The main reason for this decision was so we could use GLSL 150 which is only available under mac using Lion and also makes it easier to port all the code base to OpenGL ES ( there is an iPhone port of NGL which will be released soon). If you don't wish to upgrade to Lion then you will have to use the legacy version or develop under another platform.
This also means that all immediate mode OpenGL has gone, (under Lion they are not present as it uses two different libraries for GL2.0 and GL3.2 see here ) so it means you can no longer use functions like glBegin, glVertex, glRotate, glTranslate, glScale etc. It also means that the whole OpenGL lighting and Material subsystem has also gone and we need to use shaders to do everything. I've already mentioned some of these things in previous posts.
It has now also been tested to work with boost 1.4.7 and the Windows version seems to be a lot more stable (but will still be the last version to be developed as I hardly ever use windows)
The following list shows the major changes to NGL from 4.0 to 4.5
- ngl::Clip class has been removed as the student version of Houdini no longer support ASCII clip export, this has been replaced with the NCCAPointBake system and eventually Alembic support will be added
- ngl::ShaderManager has been replaced with ngl::ShaderLib, this is mainly a name change after some healthy in class discussions with Ian about class naming. Also all calls to the shader subsystem no longer need the name of the shader passed as a parameter. It is assumed that the currently active shader is the one to set parameters for.
- ngl::VBOPrimitives has been replaced with ngl::VAOPrimitives, the class is effectively the same, however we now use Vertex Array Objects to store our primitives, this also has advantages for porting to OpenGL ES 2.0
- ngl::VertexArrayObject class was added in 4.0 but is now used internally to create all geometry required in any of the classes. This has made the removal of any immediate mode OpenGL much easier.
- ADDLARGEMODELS define has been added to the NGL.pro file, if defined it will add 4 new primitives to the VAOPrimitives class these are the NCCA Troll, Stanford Bunny, Buddha and Dragon. These models are very large and should only be enabled if required. The image below shows them in action on the iPhone 4s
The following new classes have been added, some are to help with GLSL compatibility and some because of the changes to core profile required it.
- ngl::Mat3x3 a simple 3x3 matrix class which can be created from the ngl::Matrix class. This is generally used to calculate the normal matrix for GLSL shaders and lighting calculations.
- ngl::Vec3 is a simple container for a GLSL vec3 type, it is basically a subset of the ngl::Vector class and is used internally for passing vertices etc to the GLSL
- ngl::Vec2 is a simple container for a GLSL vec2 type and works similarly to above.
- ngl::Text this class is described in detail here but is needed as we can no longer use the Qt renderText method as it relies on immediate mode OpenGL
I'm currently in the process of converting the demo programs to work on the new Version of NGL and this is taking a little time as there are quite a lot of changes in the way the shaders work and this does take some time.
The following videos talk through how the SimpleNGL demo works