| 1 | /*************************************************************************** |
| 2 | extensionmanager.cpp - description |
| 3 | ------------------- |
| 4 | begin : august 15th, 2008 |
| 5 | copyright : (C) 2008 by Duong Khang NGUYEN |
| 6 | email : neoneurone @ gmail com |
| 7 | |
| 8 | $Id: extensionmanager.cpp 462 2011-07-03 15:49:40Z neoneurone $ |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | /*************************************************************************** |
| 12 | * * |
| 13 | * This program is free software; you can redistribute it and/or modify * |
| 14 | * it under the terms of the GNU General Public License as published by * |
| 15 | * the Free Software Foundation; either version 2 of the License, or * |
| 16 | * any later version. * |
| 17 | * * |
| 18 | ***************************************************************************/ |
| 19 | |
| 20 | #include "extensionmanager.h" |
| 21 | |
| 22 | /*====================================================================*/ |
| 23 | ExtensionManager::ExtensionManager(): |
| 24 | _bInitialized(false) |
| 25 | { |
| 26 | OPENCITY_DEBUG("ctor"); |
| 27 | } |
| 28 | |
| 29 | /*====================================================================*/ |
| 30 | ExtensionManager::~ExtensionManager() |
| 31 | { |
| 32 | OPENCITY_DEBUG("dtor"); |
| 33 | } |
| 34 | |
| 35 | /*====================================================================*/ |
| 36 | bool |
| 37 | ExtensionManager::Load() |
| 38 | { |
| 39 | bool ok = true; |
| 40 | |
| 41 | // Warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object |
| 42 | // There's no other solution at the time of writing. |
| 43 | |
| 44 | // Look for the glTexImage3DEXT function. |
| 45 | this->glTexImage3D = (PFNGLTEXIMAGE3DEXTPROC)SDL_GL_GetProcAddress("glTexImage3DEXT"); |
| 46 | |
| 47 | // Look for the glTexImage3D function instead. |
| 48 | if (this->glTexImage3D == NULL) { |
| 49 | this->glTexImage3D = (PFNGLTEXIMAGE3DEXTPROC)SDL_GL_GetProcAddress("glTexImage3D"); |
| 50 | } |
| 51 | |
| 52 | if (this->glTexImage3D == NULL) { |
| 53 | OPENCITY_ERROR( "GL_EXT_texture3D extension unsupported by your video driver" ); |
| 54 | ok = false; |
| 55 | } |
| 56 | else { |
| 57 | OPENCITY_INFO( "GL_EXT_texture3D supported" ); |
| 58 | } |
| 59 | |
| 60 | _bInitialized = ok; |
| 61 | return ok; |
| 62 | } |