next up previous contents
Next: 19.1.4 Characterize Platform Performance Up: 19.1 General Concerns Previous: 19.1.2 Extensions and OpenGL

19.1.3 Source Compatibility Across OpenGL SDKs

Whether an implementation of OpenGL provides an extension or subset is determinable at runtime. However, the software development kit, including the link library and the headers, may not define some of the symbols or tokens used by an extension. If your application must be portable in source code form, it is important to place #ifdef/#endif guards around code that uses extensions.

For example, the preprocessor token GL_EXT_texture3D is defined in compile environments that export the 3D texture extension command and enumerants. Even if the implementation supports 3D texturing, you will not be able to compile or link your program if you use the symbols.

Keep this difference between compile-time and run-time availability in mind when designing both your source distribution and your application binary. Section 20 discusses this issue in more detail.

David Blythe