]> git.mxchange.org Git - simgear.git/blob - simgear/screen/extensions.hxx
Actually commit the code changes which impliment a "scale" animation type.
[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 #if defined(WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
28 # include <windows.h>
29 #else
30 # include <dlfcn.h>
31 #endif
32
33 #include <GL/gl.h>
34
35
36 #if defined(__cplusplus)
37 extern "C" {
38 #endif
39
40 #ifndef APIENTRY
41 #define APIENTRY
42 #endif
43
44 static bool SGSearchExtensionsString(char *extString, char *extName);
45 bool SGIsOpenGLExtensionSupported(char *extName);
46
47 #ifdef __APPLE__
48   // don't use an inline function for symbol lookup, since it is too big
49   void* macosxGetGLProcAddress(const char *func);
50 #endif
51
52 inline void (*SGLookupFunction(const char *func))()
53 {
54 #if defined( WIN32 ) && !defined(__CYGWIN__) && !defined(__MINGW32__)
55     return (void (*)()) wglGetProcAddress(func);
56
57 #elif defined( __APPLE__ )
58     return (void (*)()) macosxGetGLProcAddress(func);
59
60 #else // UNIX
61
62     // If the target system s UNIX and the ARB_get_proc_address
63     // GLX extension is *not* guaranteed to be supported. An alternative
64     // dlsym-based approach will be used instead.
65
66     void *libHandle;
67     void (*fptr)();
68     libHandle = dlopen("libGL.so", RTLD_LAZY);
69     fptr = (void (*)()) dlsym(libHandle, func);
70     dlclose(libHandle);
71     return fptr;
72 #endif
73 }
74
75
76
77 /* OpenGL extension declarations */
78 #ifndef GL_EXT_point_parameters
79 #define GL_POINT_SIZE_MIN_EXT                                   0x8126
80 #define GL_DISTANCE_ATTENUATION_EXT                             0x8129
81 #endif
82
83 #ifndef GL_ARB_point_parameters
84 #define GL_POINT_SIZE_MIN_ARB                                   0x8126
85 #define GL_DISTANCE_ATTENUATION_ARB                             0x8129
86 #endif
87
88 typedef void (APIENTRY * glPointParameterfProc)(GLenum pname, GLfloat param);
89 typedef void (APIENTRY * glPointParameterfvProc)(GLenum pname, const GLfloat *params);
90
91 #if defined(__cplusplus)
92 }
93 #endif
94
95 #endif // !__SG_EXTENSIONS_HXX
96