#include <vtkOpenGLExtensionManager.h>
Inheritance diagram for vtkOpenGLExtensionManager:
vtkOpenGLExtensionManager acts as an interface to OpenGL extensions. It provides methods to query OpenGL extensions on the current or a given render window and to load extension function pointers. Currently does not support GLU extensions since the GLU library is not linked to VTK.
Before using vtkOpenGLExtensionManager, an OpenGL context must be created. This is generally done with a vtkRenderWindow. Note that simply creating the vtkRenderWindow is not sufficient. Usually you have to call Render before the actual OpenGL context is created. You can specify the RenderWindow with the SetRenderWindow method.
vtkOpenGLExtensionManager *extensions = vtkOpenGLExtensionManager::New(); extensions->SetRenderWindow(renwin);
Generally speaking, when using OpenGL extensions, you will need an vtkOpenGLExtensionManager and the prototypes defined in vtkgl.h.
#include "vtkOpenGLExtensionManager.h" #include "vtkgl.h"
To use an OpenGL extension, you first need to make an instance of vtkOpenGLExtensionManager and give it a vtkRenderWindow. You can then query the vtkOpenGLExtensionManager to see if the extension is supported with the ExtensionSupported method. Valid names for extensions are given in the OpenGL extension registry at http://oss.sgi.com/projects/ogl-sample/registry/ . You can also grep vtkgl.h (which will be in the binary build directory if vtkSNL is not installed) for appropriate names. There are also special extensions GL_VERSION_X_X (where X_X is replaced with a major and minor version, respectively) which contain all the constants and functions for OpenGL versions for which the gl.h header file is of an older version than the driver.
if ( !extensions->ExtensionSupported("GL_VERSION_1_2") || !extensions->ExtensionSupported("GL_ARB_multitexture") ) { { vtkErrorMacro("Required extensions not supported!"); }
Once you have verified that the extensions you want exist, before you use them you have to loaded them with the LoadExtension method.
extensions->LoadExtension("GL_VERSION_1_2"); extensions->LoadExtension("GL_ARB_multitexture");
Once you have queried and loaded all of the extensions you need, you can delete the vtkExtensionManager. To use a constant of an extension, simply replace the "GL_" prefix with "vtkgl::". Likewise, replace the "gl" prefix of functions with "vtkgl::". In rare cases, an extension will add a type. In this case, add vtkgl:: to the type (i.e. vtkgl::GLchar).
extensions->Delete(); ... vtkgl::ActiveTexture(vtkgl::TEXTURE0_ARB);
Definition at line 126 of file vtkOpenGLExtensionManager.h.
Public Types | |
typedef vtkObject | Superclass |
Public Member Functions | |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
virtual int | ExtensionSupported (const char *name) |
virtual vtkOpenGLExtensionManagerFunctionPointer | GetProcAddress (const char *fname) |
virtual void | LoadExtension (const char *name) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual vtkRenderWindow * | GetRenderWindow () |
virtual void | SetRenderWindow (vtkRenderWindow *renwin) |
virtual void | Update () |
virtual char * | GetExtensionsString () |
Static Public Member Functions | |
static int | IsTypeOf (const char *type) |
static vtkOpenGLExtensionManager * | SafeDownCast (vtkObject *o) |
static vtkOpenGLExtensionManager * | New () |
Protected Member Functions | |
vtkOpenGLExtensionManager () | |
virtual | ~vtkOpenGLExtensionManager () |
virtual void | ReadOpenGLExtensions () |
Protected Attributes | |
vtkRenderWindow * | RenderWindow |
char * | ExtensionsString |
vtkTimeStamp | BuildTime |
|
Reimplemented from vtkObject. Definition at line 129 of file vtkOpenGLExtensionManager.h. |
|
|
|
|
|
Reimplemented from vtkObject. |
|
Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. |
|
Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h. Reimplemented from vtkObject. |
|
Reimplemented from vtkObject. |
|
Create an object with Debug turned off, modified time initialized to zero, and reference counting on. Reimplemented from vtkObject. |
|
Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes. Reimplemented from vtkObject. |
|
Set/Get the render window to query extensions on. If set to null, justs queries the current render window. |
|
|
|
Updates the extensions string. |
|
Returns a string listing all available extensions. Call Update first to validate this string. |
|
Returns true if the extension is supported, false otherwise. |
|
Returns a function pointer to the OpenGL extension function with the given name. Returns NULL if the function could not be retrieved. |
|
Loads all the functions associated with the given extension into the appropriate static members of vtkgl. |
|
|
|
Definition at line 166 of file vtkOpenGLExtensionManager.h. |
|
Definition at line 168 of file vtkOpenGLExtensionManager.h. |
|
Definition at line 170 of file vtkOpenGLExtensionManager.h. |