They can add entirely new functions to OpenGL itself.They can extend GLSL to add functionality, built-in functions, variables, or data types.They can add tokens or extend the range of values that can be passed as parameters to existing functions.They can make things legal that weren’t before, by simply removing restrictions from the OpenGL specification.Your application should always check for support for extensions you wish to use before using them.Įxtensions generally add to OpenGL in some combination of four different ways: This function is declared in the header, takes the name of an extension, and returns non-zero if it is supported by the current OpenGL context and zero if it is not. sb7IsExtensionSupported() has the prototype int sb7IsExtensionSupported( const char * extname) The book’s source code comes with a simple function that does this for you. To see if a specific extension is supported, you can simply query the number of extensions, and then loop through each supported extension and compare its name to the one you’re looking for. The function returns the name of the extension as a string. You should pass GL_EXTENSIONS as the name parameter, and a value between 0 and 1 less than the number of supported extensions in index. Next, you can find out the name of each of the supported extensions by calling const GLubyte* glGetStringi(GLenum name, First, to determine the number of supported extensions, you can call glGetIntegerv() with the GL_NUM_EXTENSIONS parameter. To find out which extensions OpenGL supports, there are two functions that you can use. It is freely available from the Realtech VR Web site (see Figure 3.6).įigure 3.6: Realtech VR’s OpenGL Extensions Viewer Enhancing OpenGL with Extensionsīefore using any extensions, you must make sure that they’re supported by the OpenGL implementation that your application is running on. This “natural selection” process helps to ensure only the most useful and important new features make it into a core version of OpenGL.Ī useful tool to determine which extensions are supported in your computer’s OpenGL implementation is Realtech VR’s OpenGL Extensions Viewer. The ones that shine can be promoted to core the ones that are less useful are not considered. In this way each extension gets its time in the sun. Hundreds of extensions currently are available! But new versions of OpenGL are often constructed from extensions programmers have found useful. This extension process may sound confusing at first. These extensions are often supported by most or all major hardware vendors and may also have started out as vendor or EXT extensions. ARB extensions are an official part of OpenGL because they are approved by the OpenGL governing body, the Architecture Review Board (ARB). They often start their lives as vendor-specific extensions, but if another vendor is interested in implementing the extension, perhaps with minor changes, it may collaborate with the original authors to produce an EXT version. EXT extensions are written together by two or more vendors. It is possible that more than one vendor might support a specific vendor extension, especially if it becomes widely accepted. Initials representing the specific vendor are usually part of the extension name-“AMD” for Advanced Micro Devices or “NV” for NVIDIA, for example. Vendor extensions are written and implemented on one vendor’s hardware. There are three major classifications of extensions: vendor, EXT, and ARB. A complete list of the extensions that were promoted to each version of OpenGL and a brief synopsis of what they do is included in Appendix C, “OpenGL Features and Versions.” However, popular and generally useful extensions are normally “promoted” into the core versions of OpenGL thus, if you are running the latest and greatest version of OpenGL, there might not be that many extensions that are interesting but not part of the core profile. That means the text of the extensions describes how the core OpenGL specification must be changed if the extension is supported. These extensions are written as a list of differences from a particular version of the OpenGL specification, and note what that version of OpenGL is. Extensions are listed in the OpenGL extension registry 5 on the OpenGL Web site. Extensions can have many different effects on OpenGL functionality.Īn extension is any addition to a core version of OpenGL. However, one of OpenGL’s greatest strengths is that it can be extended and enhanced by hardware manufacturers, operating system vendors, and even publishers of tools and debuggers. Learn More Buy Using Extensions in OpenGLĪll of the examples shown in this book so far have relied on the core functionality of OpenGL. OpenGL Superbible: Comprehensive Tutorial and Reference, 7th Edition
0 Comments
Leave a Reply. |