/usr/include/vtk-6.3/vtkOpenGLExtensionManager.h is in libvtk6-dev 6.3.0+dfsg1-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | // -*- c++ -*-
/*=========================================================================
Program: Visualization Toolkit
Module: vtkOpenGLExtensionManager.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
Copyright 2003 Sandia Corporation.
Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive
license for use of this work by or on behalf of the
U.S. Government. Redistribution and use in source and binary forms, with
or without modification, are permitted provided that this Notice and any
statement of authorship are reproduced on all copies.
=========================================================================*/
// .NAME vtkOpenGLExtensionManager - Interface class for querying and using OpenGL extensions.
//
// .SECTION Description
//
// 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.
// \code
// vtkOpenGLExtensionManager *extensions = vtkOpenGLExtensionManager::New();
// extensions->SetRenderWindow(renwin);
// \endcode
// If no vtkRenderWindow is specified, the current OpenGL context (if any)
// is used.
//
// Generally speaking, when using OpenGL extensions, you will need an
// vtkOpenGLExtensionManager and the prototypes defined in vtkgl.h.
// \code
#include "vtkRenderingOpenGLModule.h" // For export macro
// #include "vtkOpenGLExtensionManager.h"
// #include "vtkgl.h"
// \endcode
// The vtkgl.h include file contains all the constants and function
// pointers required for using OpenGL extensions in a portable and
// namespace safe way. vtkgl.h is built from parsed glext.h, glxext.h, and
// wglext.h files. Snapshots of these files are distributed with VTK,
// but you can also set CMake options to use other files.
//
// 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://www.opengl.org/registry/ .
// You can also grep vtkgl.h (which will be in the binary build directory
// if VTK 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.
//
// \code
// if ( !extensions->ExtensionSupported("GL_VERSION_1_2")
// || !extensions->ExtensionSupported("GL_ARB_multitexture") ) {
// {
// vtkErrorMacro("Required extensions not supported!");
// }
// \endcode
//
// Once you have verified that the extensions you want exist, before you
// use them you have to load them with the LoadExtension method.
//
// \code
// extensions->LoadExtension("GL_VERSION_1_2");
// extensions->LoadExtension("GL_ARB_multitexture");
// \endcode
//
// Alternatively, you can use the LoadSupportedExtension method, which checks
// whether the requested extension is supported and, if so, loads it. The
// LoadSupportedExtension method will not raise any errors or warnings if it
// fails, so it is important for callers to pay attention to the return value.
//
// \code
// if ( extensions->LoadSupportedExtension("GL_VERSION_1_2")
// && extensions->LoadSupportedExtension("GL_ARB_multitexture") ) {
// {
// vtkgl::ActiveTexture(vtkgl::TEXTURE0_ARB);
// }
// else
// {
// vtkErrorMacro("Required extensions could not be loaded!");
// }
// \endcode
//
// Once you have queried and loaded all of the extensions you need, you can
// delete the vtkOpenGLExtensionManager. 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).
//
// \code
// extensions->Delete();
// ...
// vtkgl::ActiveTexture(vtkgl::TEXTURE0_ARB);
// \endcode
//
// For wgl extensions, replace the "WGL_" and "wgl" prefixes with
// "vtkwgl::". For glX extensions, replace the "GLX_" and "glX" prefixes
// with "vtkglX::".
//
#ifndef vtkOpenGLExtensionManager_h
#define vtkOpenGLExtensionManager_h
#include "vtkObject.h"
#include "vtkWeakPointer.h" // needed for vtkWeakPointer.
#include <string> // needed for std::string
class vtkRenderWindow;
//BTX
extern "C" {
#ifdef _WIN32
#include "vtkOpenGL.h" // Needed for WINAPI
typedef int (WINAPI *vtkOpenGLExtensionManagerFunctionPointer)(void);
#else
typedef void (*vtkOpenGLExtensionManagerFunctionPointer)(void);
#endif
}
//ETX
class VTKRENDERINGOPENGL_EXPORT vtkOpenGLExtensionManager : public vtkObject
{
public:
vtkTypeMacro(vtkOpenGLExtensionManager, vtkObject);
static vtkOpenGLExtensionManager *New();
void PrintSelf(ostream &os, vtkIndent indent);
// Description:
// Set/Get the render window to query extensions on. If set to null,
// justs queries the current render window.
vtkRenderWindow* GetRenderWindow();
virtual void SetRenderWindow(vtkRenderWindow *renwin);
// Description:
// Updates the extensions string.
virtual void Update();
// Description:
// Returns a string listing all available extensions. Call Update first
// to validate this string.
vtkGetStringMacro(ExtensionsString);
// Description:
// Returns true if the extension is supported, false otherwise.
virtual int ExtensionSupported(const char *name);
//BTX
// Description:
// Returns a function pointer to the OpenGL extension function with the
// given name. Returns NULL if the function could not be retrieved.
virtual vtkOpenGLExtensionManagerFunctionPointer GetProcAddress(
const char *fname);
//ETX
// Description:
// Loads all the functions associated with the given extension into the
// appropriate static members of vtkgl. This method emits a warning if the
// requested extension is not supported. It emits an error if the extension
// does not load successfully.
virtual void LoadExtension(const char *name);
// Description:
// Returns true if the extension is supported and loaded successfully,
// false otherwise. This method will "fail silently/gracefully" if the
// extension is not supported or does not load properly. It emits neither
// warnings nor errors. It is up to the caller to determine if the
// extension loaded properly by paying attention to the return value.
virtual int LoadSupportedExtension(const char *name);
// Description:
// Loads all the functions associated with the given core-promoted extension
// into the appropriate static members of vtkgl associated with the OpenGL
// version that promoted the extension as a core feature. This method emits a
// warning if the requested extension is not supported. It emits an error if
// the extension does not load successfully.
//
// For instance, extension GL_ARB_multitexture was promoted as a core
// feature into OpenGL 1.3. An implementation that uses this
// feature has to (IN THIS ORDER), check if OpenGL 1.3 is supported
// with ExtensionSupported("GL_VERSION_1_3"), if true, load the extension
// with LoadExtension("GL_VERSION_1_3"). If false, test for the extension
// with ExtensionSupported("GL_ARB_multitexture"),if true load the extension
// with this method LoadCorePromotedExtension("GL_ARB_multitexture").
// If any of those loading stage succeeded, use vtgl::ActiveTexture() in
// any case, NOT vtgl::ActiveTextureARB().
// This method avoids the use of if statements everywhere in implementations
// using core-promoted extensions.
// Without this method, the implementation code should look like:
// \code
// int opengl_1_3=extensions->ExtensionSupported("GL_VERSION_1_3");
// if(opengl_1_3)
// {
// extensions->LoadExtension("GL_VERSION_1_3");
// }
// else
// {
// if(extensions->ExtensionSupported("GL_ARB_multitexture"))
// {
// extensions->LoadCorePromotedExtension("GL_ARB_multitexture");
// }
// else
// {
// vtkErrorMacro("Required multitexture feature is not supported!");
// }
// }
// ...
// if(opengl_1_3)
// {
// vtkgl::ActiveTexture(vtkgl::TEXTURE0)
// }
// else
// {
// vtkgl::ActiveTextureARB(vtkgl::TEXTURE0_ARB)
// }
// \endcode
// Thanks to this method, the code looks like:
// \code
// int opengl_1_3=extensions->ExtensionSupported("GL_VERSION_1_3");
// if(opengl_1_3)
// {
// extensions->LoadExtension("GL_VERSION_1_3");
// }
// else
// {
// if(extensions->ExtensionSupported("GL_ARB_multitexture"))
// {
// extensions->LoadCorePromotedExtension("GL_ARB_multitexture");
// }
// else
// {
// vtkErrorMacro("Required multitexture feature is not supported!");
// }
// }
// ...
// vtkgl::ActiveTexture(vtkgl::TEXTURE0);
// \endcode
virtual void LoadCorePromotedExtension(const char *name);
// Description:
// Similar to LoadCorePromotedExtension().
// It loads an EXT extension into the pointers of its ARB equivalent.
virtual void LoadAsARBExtension(const char *name);
// Description:
// Return the driver's version parts. This may be used for
// fine grained feature testing.
virtual int GetDriverVersionMajor(){ return this->DriverVersionMajor; }
virtual int GetDriverVersionMinor(){ return this->DriverVersionMinor; }
virtual int GetDriverVersionPatch(){ return this->DriverVersionPatch; }
// Description:
// Get GL API version that the driver provides. This is
// often different than the GL version that VTK recognizes
// so only use this for identifying a specific driver.
virtual int GetDriverGLVersionMajor(){ return this->DriverGLVersionMajor; }
virtual int GetDriverGLVersionMinor(){ return this->DriverGLVersionMinor; }
virtual int GetDriverGLVersionPatch(){ return this->DriverGLVersionPatch; }
// Description:
// Test's for common implementors of rendering drivers. This may be used for
// fine grained feature testing. Note: DriverIsMesa succeeds for OS Mesa,
// use DriverGLRendererIsOSMessa to differentiate.
virtual bool DriverIsATI();
virtual bool DriverIsNvidia();
virtual bool DriverIsIntel();
virtual bool DriverIsMesa();
virtual bool DriverIsMicrosoft();
// Description:
// Test for a specific driver version.
virtual bool DriverVersionIs(int major);
virtual bool DriverVersionIs(int major, int minor);
virtual bool DriverVersionIs(int major, int minor, int patch);
// Description:
// Test for driver version greater than or equal
// to the named version.
virtual bool DriverVersionAtLeast(int major);
virtual bool DriverVersionAtLeast(int major, int minor);
virtual bool DriverVersionAtLeast(int major, int minor, int patch);
// Description:
// Test for the driver's GL version as reported in
// its GL_VERSION string. This is intended for driver
// identification only, use ExtensionSuppported
// to test for VTK support of a specific GL version.
virtual bool DriverGLVersionIs(int major, int minor, int patch);
virtual bool DriverGLVersionIs(int major, int minor);
// Description:
// Test for a specific renderer. This could be used
// in some cases to identify the graphics card or
// specific driver. Use HasToken to prevent false
// matches eg. avoid GeForce4 matching GeForce400
virtual bool DriverGLRendererIs(const char *str);
virtual bool DriverGLRendererHas(const char *str);
virtual bool DriverGLRendererHasToken(const char *str);
// Description:
// Test for Mesa's offscreen renderer.
virtual bool DriverGLRendererIsOSMesa();
// Description:
// Get the OpenGL version, vendor and renderer strings. These can
// be used to idnetify a specific driver.
virtual const char *GetDriverGLVendor(){ return this->DriverGLVendor.c_str(); }
virtual const char *GetDriverGLVersion(){ return this->DriverGLVersion.c_str(); }
virtual const char *GetDriverGLRenderer(){ return this->DriverGLRenderer.c_str(); }
// Description:
// When set known driver bugs are ignored during driver feature
// detection. This is used to evaluate the status of a new driver
// release to see if the bugs have been fixed. The function takes
// a description argument which, is sent to VTK's warning stream
// when the ignore flag is set. This makes the test output searchable
// for tests which have problems with certain drivers. The CMakeLists
// variable VTK_IGNORE_GLDRIVER_BUGS can be used to set this at
// build time. Default OFF.
bool GetIgnoreDriverBugs(const char *description);
vtkSetMacro(IgnoreDriverBugs, bool);
vtkBooleanMacro(IgnoreDriverBugs, bool);
//BTX
protected:
vtkOpenGLExtensionManager();
virtual ~vtkOpenGLExtensionManager();
int OwnRenderWindow;
char *ExtensionsString;
vtkTimeStamp BuildTime;
// driver specific info
std::string DriverGLVersion;
int DriverGLVersionMajor;
int DriverGLVersionMinor;
int DriverGLVersionPatch;
std::string DriverGLVendor;
std::string DriverGLRenderer;
int DriverVersionMajor;
int DriverVersionMinor;
int DriverVersionPatch;
enum DriverGLVendorIdType
{
DRIVER_VENDOR_UNKNOWN=0,
DRIVER_VENDOR_ATI,
DRIVER_VENDOR_NVIDIA,
DRIVER_VENDOR_INTEL,
DRIVER_VENDOR_MESA,
DRIVER_VENDOR_MICROSOFT
};
DriverGLVendorIdType DriverGLVendorId;
bool IgnoreDriverBugs;
virtual void InitializeDriverInformation();
virtual void ReadOpenGLExtensions();
// Description:
// Wrap around the generated vtkgl::LoadExtension to deal with OpenGL 1.2
// and its optional part GL_ARB_imaging. Also functions like
// glBlendEquation() or glBlendColor() are optional in OpenGL 1.2 or 1.3 and
// provided by the GL_ARB_imaging but there are core features in OpenGL 1.4.
virtual int SafeLoadExtension(const char *name);
private:
vtkOpenGLExtensionManager(const vtkOpenGLExtensionManager&); // Not implemented
void operator=(const vtkOpenGLExtensionManager&); // Not implemented
vtkWeakPointer<vtkRenderWindow> RenderWindow;
//ETX
};
#endif // vtkOpenGLExtensionManager_h
|