File: extensionmanager.cpp

package info (click to toggle)
opencity 0.0.6.5stable-4
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 13,348 kB
  • sloc: cpp: 26,622; sh: 11,267; xml: 4,453; ansic: 587; makefile: 521
file content (62 lines) | stat: -rw-r--r-- 2,197 bytes parent folder | download | duplicates (3)
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
/***************************************************************************
					extensionmanager.cpp  -  description
							-------------------
	begin                : august 15th, 2008
	copyright            : (C) 2008 by Duong Khang NGUYEN
	email                : neoneurone @ gmail com

	$Id: extensionmanager.cpp 462 2011-07-03 15:49:40Z neoneurone $
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   any later version.                                                    *
 *                                                                         *
 ***************************************************************************/

#include "extensionmanager.h"

   /*====================================================================*/
ExtensionManager::ExtensionManager():
_bInitialized(false)
{
	OPENCITY_DEBUG("ctor");
}

   /*====================================================================*/
ExtensionManager::~ExtensionManager()
{
	OPENCITY_DEBUG("dtor");
}

   /*====================================================================*/
bool
ExtensionManager::Load()
{
	bool ok = true;

	// Warning: ISO C++ forbids casting between pointer-to-function and pointer-to-object
	// There's no other solution at the time of writing.

	// Look for the glTexImage3DEXT function.
	this->glTexImage3D = (PFNGLTEXIMAGE3DEXTPROC)SDL_GL_GetProcAddress("glTexImage3DEXT");

	// Look for the glTexImage3D function instead.
	if (this->glTexImage3D == NULL) {
		this->glTexImage3D = (PFNGLTEXIMAGE3DEXTPROC)SDL_GL_GetProcAddress("glTexImage3D");
	}

	if (this->glTexImage3D == NULL) {
		OPENCITY_ERROR( "GL_EXT_texture3D extension unsupported by your video driver" );
		ok = false;
	}
	else {
		OPENCITY_INFO( "GL_EXT_texture3D supported" );
	}

	_bInitialized = ok;
	return ok;
}