00001 // -*- c++ -*- 00002 00003 /*========================================================================= 00004 00005 Program: Visualization Toolkit 00006 Module: vtkOpenGLExtensionManager.h 00007 00008 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00009 All rights reserved. 00010 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notice for more information. 00015 00016 Copyright 2003 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000, there is a non-exclusive 00018 license for use of this work by or on behalf of the 00019 U.S. Government. Redistribution and use in source and binary forms, with 00020 or without modification, are permitted provided that this Notice and any 00021 statement of authorship are reproduced on all copies. 00022 00023 =========================================================================*/ 00024 00126 #ifndef __vtkOpenGLExtensionManager_h 00127 #define __vtkOpenGLExtensionManager_h 00128 00129 #include <vtkObject.h> 00130 #include <vtkWeakPointer.h> // needed for vtkWeakPointer. 00131 00132 class vtkRenderWindow; 00133 00134 //BTX 00135 extern "C" { 00136 #ifdef _WIN32 00137 #include <vtkOpenGL.h> // Needed for WINAPI 00138 typedef int (WINAPI *vtkOpenGLExtensionManagerFunctionPointer)(void); 00139 #else 00140 typedef void (*vtkOpenGLExtensionManagerFunctionPointer)(void); 00141 #endif 00142 } 00143 //ETX 00144 00145 class VTK_RENDERING_EXPORT vtkOpenGLExtensionManager : public vtkObject 00146 { 00147 public: 00148 vtkTypeMacro(vtkOpenGLExtensionManager, vtkObject); 00149 static vtkOpenGLExtensionManager *New(); 00150 void PrintSelf(ostream &os, vtkIndent indent); 00151 00153 00155 vtkRenderWindow* GetRenderWindow(); 00156 virtual void SetRenderWindow(vtkRenderWindow *renwin); 00158 00160 virtual void Update(); 00161 00163 00165 vtkGetStringMacro(ExtensionsString); 00167 00169 virtual int ExtensionSupported(const char *name); 00170 00171 //BTX 00173 00175 virtual vtkOpenGLExtensionManagerFunctionPointer GetProcAddress( 00176 const char *fname); 00177 //ETX 00179 00184 virtual void LoadExtension(const char *name); 00185 00192 virtual int LoadSupportedExtension(const char *name); 00193 00194 00226 virtual void LoadCorePromotedExtension(const char *name); 00227 00229 00231 virtual void LoadAsARBExtension(const char *name); 00232 //BTX 00233 protected: 00234 vtkOpenGLExtensionManager(); 00235 virtual ~vtkOpenGLExtensionManager(); 00237 00238 00239 int OwnRenderWindow; 00240 char *ExtensionsString; 00241 00242 vtkTimeStamp BuildTime; 00243 00244 virtual void ReadOpenGLExtensions(); 00245 00251 virtual int SafeLoadExtension(const char *name); 00252 00253 private: 00254 vtkOpenGLExtensionManager(const vtkOpenGLExtensionManager&); // Not implemented 00255 void operator=(const vtkOpenGLExtensionManager&); // Not implemented 00256 00257 vtkWeakPointer<vtkRenderWindow> RenderWindow; 00258 //ETX 00259 }; 00260 00261 #endif //__vtkOpenGLExtensionManager