The Khronos Group has just announced the final specifications of OpenGL 4.1, the open graphics library used mainly for CAD and Mobile apps (OpenGL ES). With version 4.1, OpenGL finally catches up -and go beyond- the DirectX 11 specifications…..
Only four months after OpenGL 4.0 hit the scene, the next revision of the cross-platform graphics API is here, bearing gifts of fancier math and more cribbed DirectX 11 features. Unless you’re a graphics guru, though, we doubt you’ll be that interested in “64-bit floating-point component vertex shader inputs,” so let’s get to the meat of what you’re after: impressive 3D gaming.
OpenGL 4.1 includes more robust error handling to make running buggy programs safer, richer debugging features to make developing OpenGL software simpler, and a new ability to save and restore programs written to use the shaders found in modern video hardware. Shader programs, an important part of modern 3D software and hardware, are written in a hardware-independent language, and then compiled at runtime by the OpenGL driver. This allows the programs to be properly optimized for the specific GPU hardware. The downside is that compilation can be a slow process, and if it has to be performed each time a game starts, for example, it can lead to noticeable delays. OpenGL 4.1 allows software to cache the compiled programs and therefore bypass the slow compilation step.
OpenGL 4.1 also strengthens OpenGL’s cross-platform appeal. OpenGL has three guises; the standard OpenGL used in desktop and workstation hardware, OpenGL ES used in various embedded platforms such as the iPhone and PlayStation 3, and WebGL, which enables webpages to include 3D OpenGL graphics without needing browser plugins. Previously, OpenGL ES was slightly incompatible with conventional OpenGL. With OpenGL 4.1, that’s no longer the case; the desktop platform is a superset of the embedded one. This will ease porting and development, as it will enable a common codebase to be used across both desktop and embedded applications, and allow embedded developers to use the often superior development infrastructure that desktop systems provide.
The more robust error handling in OpenGL 4.1 will strengthen WebGL. Traditionally, OpenGL drivers have only been exposed to “trusted” applications—3D software running at the user’s request on the desktop. Errant programs that tried to access memory improperly would crash or misbehave, but this was an acceptable performance decision. With WebGL, that’s no longer the case; webpages have a long history of attempting malicious activities, and WebGL gives malicious pages the ability to try to attack video drivers. The new, more robust error handling allows WebGL vendors to make the OpenGL driver stricter in the checks it applies, providing some protection against such attacks.
Whether this truly constitutes a leapfrogging of Direct3D 11 is not obvious. Direct3D has long had the ability to save compiled shaders, and has long provided rich debugging features. What Direct3D doesn’t offer, however, is the kind of cross-platform support that OpenGL has. Obviously, Direct3D is only available on Windows; Linux and Mac OS X are OpenGL-only. Microsoft’s OpenGL ES equivalent is, roughly speaking, XNA. XNA is supported on desktop Windows, the Xbox 360, and the forthcoming Windows Phone 7 platform, but, though it’s conceptually similar to Direct3D, it is not programmatically identical.
Further, Microsoft has no kind of WebGL equivalent. If WebGL gains traction—which is certainly not inevitable, especially given Microsoft’s apparent reluctance to include it in Internet Explorer—then there may be a substantial increase in the amount of OpenGL code being written.
OpenCL has been built with scientific projects in mind, and that opens even more possibilities for OpenGL developers. NVIDIA is releasing new drivers for its products “right now”, while AMD will come up with new drivers soon, according to Ben Bar-Haim, its VP of Software.
OpenGL 4.1 promises to help deliver that to cellphones easier than ever before, by making OpenGL ES (used in iOS and Android, depending on your hardware) completely compatible with the desktop graphics version, and promises “features to improve robustness” in WebGL 3D browser acceleration as well. There’s also support for stencil values in fragment shaders, but we digress — if you understood what we just said, hit up the source and more coverage links for the rest.