OpenGL

From OniGalore
Jump to navigation Jump to search

OpenGL is what Oni uses for rendering in-game components as well as the menu system and splashscreens – basically everything you see, except for those dialogs and window elements that are handled directly by the operating system (e.g., "Blam").

Oni's development in the late '90s corresponds to an era when GFX hardware was booming[1], but the compatibility standards of such frameworks as OpenGL were still emergent. Starting with OpenGL 1.2.1 (October 1998), new OpenGL features were subject to approval by the Architecture Review Board (the "ARB extensions" concept), based on wide enough availability and reliability on the hardware side. Multitexturing ("GL_ARB_multitexture") was the only extension officially introduced by the OpenGL 1.2.1 spec (section F.2), but other extensions were gradually added on the way to OpenGL 1.3 (August 2001).

OpenGL in Oni

Oni's release predates OpenGL 1.3 only slightly, so most if not all of the new ARB extensions from the OpenGL 1.3 spec were already approved and available at the time of Oni's development: most notably, compressed textures ("GL_ARB_texture_compression", March 2000) and multisampling a.k.a. antialiasing ("GL_ARB_multisample", December 1999), as well as some environment mapping techniques.

Vertex Buffer Objects (i.e., optimized storage of 3D data at GPU level) were not implemented until OpenGL 1.5 (July 2003), and advanced pixel shaders (GLSL scripts) were only added in OpenGL 2.0 (September 2004). Therefore Oni has practically no hardware acceleration and is limited to Gouraud shading.

Lightmapping was technically possible since OpenGL 1.2.1 (through multitexturing)[2] and was initially present in pre-beta versions of Oni, although it was removed from the final game due to either performance reasons or last-minute remodeling of the game's levels.

A basic implementation of environment mapping was used for hair and metal parts, although the reflection math seems incorrect and some NVIDIA cards completely fail to render Oni's reflectivity.

Learning OpenGL

If you are looking for an introduction to modern OpenGL, with shaders and such, then opengl-tutorial.org is a good place to look. THIS mini-tutorial is also a good place to start, as it fully details the creation of an interactive OpenGL/freeglut app (however, the camera class used by the author is no longer available for download).

If you are more specifically interested in normal mapping, then a really neat GLSL snippet can be found HERE (an implementation of normal mapping that uses no precomputed TBN matrices and does all the tangent space math at shader level).

Notes

  1. Quake (1996) is widely regarded as having played a key part in the breakthrough of real-time 3D technology in the late '90s. See First-person shooter (Wikipedia) for a more detailed account citing other noteworthy games such as Half-Life (1998).
  2. Proper multitextured lightmaps should not be confused with THIS hackish emulation of lightmaps, which uses an extra layer of transparent polygons.