Projects |  Graphics |  Art |  Linux Helpers |  Links
Webmaster: 
© Nicolas Cuntz

Projects Graphics Art Linux Helpers Links

test_gl3.cpp

11.3 KB
OpenGL 3.1, which is the newest version of the well-known open graphics library, will be supported by most graphics hardware vendors in the near future. In contrast to previous versions, this one introduces a new deprecation scheme which marks parts of the older functionality for future deletion. In practice, this means that many functions which were prefectly sound in earlier versions should now be avoided in favour of compatibility to the new API and graphics processors.

This small example demonstrates how a simple geometry, more precisely a rotating cube, can be constructed and rendered using non-deprecated functions only. This involves, as the programmable pipeline philosophy of GL 3.1 requests, the use of shader programs. As the traditional glBegin way to intantiate geometry is not available anymore, the more efficent vertex array object (VAO) solution is chosen in this example. These two types of objects, shaders and VAOs, are encapsulated in very small C++ classes in order to provide a clean view on these constructs.


The source code is written so that it should be possible to compile it in Windows as well as in Linux. It requires the GL windowing library glut (works also with freeglut) and the GL extension library glew, which are freely available for both systems.
The program test_gl3 comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the condition stated in the GNU General Public License.