|
| ||||||||
OpenGL extensions and versionsfunAddress=wglGetProcAddress("nameOfExtensionFunction"); To get the types and names right should you use headers with the necessary definitions. ATI has two headers on their developer page called glATI.h and wglATI.h with prototypes for ATI supported extensions. The original extensions header (glext.h) can you get from the OpenGL Extension Registry they also provide descriptions of the extensions. The headers from the OpenGL extension registry contains all extensions so you should edit the files so that only the extensions your card/driver support is left. Your gl.h file probably already has some extensions that you do not have to include also some extensions is for backward compatibility. WARNING: remember that the function returned by wglGetProcAddress is only be guaranteed to work for the OpenGL rendering context that was current when wglGetProcAddress was called. Even if you only has one context (window) is an active rendering context required. In GLUT that means after the glutMainLoop call. I combined glext.h and wglext.h in my glext.h
and put it in the compilers include\GL\ directory. This file defines GL_VERSION_1_2
since the driver supports the latest OpenGL version. You have to load the
1.2 functions like extension functions. Microsoft's OpenGL implementation
for Windows is still only supporting 1.1 so a program must check if the
driver really has 1.2 support. Some of the 1.2 functions is available as
extensions but I think it is better to get them as 1.2 functions instead.
Note that not all functions is guaranteed to be hardware accelerated, one
example is the 3D textures on NVIDIA cards that only has an software implementation.
Checking that the function is supportedIn GLUT is it easy to check for extensions. Use the glutExtensionSupported function. The supported extensions can also be determined with glGetString(GL_EXTENSIONS) see bottom at this page for links. Checking for the GL version is easier just do something like thisgl12Supported = atof(glGetString(GL_VERSION)) >= 1.2; This should not be any problem now or in the future if only the drivers is OK. The OpenGL mechanism gives the hardware manufacturers a big opportunity but also a very big responsibility. QDGL an library for quick and dirty loading of the latest OpenGL functionsInstead of using wglGetProcAddress every time for each new program do I think that many OpenGL hackers has some functions to get the addresses for the supported functions. I made my own little library for quick and dirty loading of the functions into some global variables without checking that the driver really supports the functions. It is assumed that you have an glext.h in the right place. I called it QDGL for Quick and Dirty loading of GL functions. You can use it to make your own version that fits with the driver you are using. Remember to add version and extensions checks if you distribute a program made with a library like QDGL!Links to related information and samplesAll About OpenGL Extensions by Mark Kilgard. Similar texts on the NVIDIA developer pages by the same author.The best documentation and samples is often on the manufacturers developer pages like NVIDIA developer pages and ATI Some samples using extensions at nutty and bollux :) OpenGL Extension Registry is of course very important. (The current glext.h ) NeHe tutorials 22 and 25 | ||||||||