]> git.mxchange.org Git - simgear.git/blob - simgear/screen/extensions.hxx
77efd3c3af93a584cce905e880780660170773be
[simgear.git] / simgear / screen / extensions.hxx
1 /*
2  *
3  * Copyright (c) 2001 César Blecua Udías    All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included
13  * in all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * CESAR BLECUA UDIAS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19  * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20  * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21  * SOFTWARE.
22  *
23  */
24 #ifndef __SG_EXTENSIONS_HXX
25 #define __SG_EXTENSIONS_HXX 1
26
27 #include <GL/gl.h>
28
29 #if defined(__cplusplus)
30 extern "C" {
31 #endif
32
33 #ifndef APIENTRY
34 #define APIENTRY
35 #endif
36
37 static bool SGSearchExtensionsString(char *extString, char *extName);
38 bool SGIsOpenGLExtensionSupported(char *extName);
39
40 inline void (*SGLookupFunction(const char *func))() {
41
42 #if defined( WIN32 )
43         return (void (*)()) wglGetProcAddress(func);
44
45 #else
46
47   // If the target system s UNIX and the ARB_get_proc_address
48   // GLX extension is *not* guaranteed to be supported. An alternative
49   // dlsym-based approach will be used instead.
50   #if defined( linux ) || defined ( sgi )
51         void *libHandle;
52         void (*fptr)();
53         libHandle = dlopen("libGL.so", RTLD_LAZY);
54         fptr = (void (*)()) dlsym(libHandle, func);
55         dlclose(libHandle);
56         return fptr;
57   #else
58         return glXGetProcAddressARB(func);
59   #endif
60 #endif
61 }
62
63
64
65 /* OpenGL extension declarations */
66 typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
67 typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
68
69 #if defined(__cplusplus)
70 }
71 #endif
72
73 #endif // !__SG_EXTENSIONS_HXX
74