1 | // Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz
|
---|
2 | // http://chaosforge.org/
|
---|
3 | //
|
---|
4 | // This file is part of NV Libraries.
|
---|
5 | // For conditions of distribution and use, see copyright notice in nv.hh
|
---|
6 |
|
---|
7 | #ifndef NV_LIB_GL_HH
|
---|
8 | #define NV_LIB_GL_HH
|
---|
9 |
|
---|
10 | #include <nv/common.hh>
|
---|
11 | #include <stddef.h>
|
---|
12 |
|
---|
13 | //#define NV_SDL_GL
|
---|
14 | #define NV_GL_DYNAMIC
|
---|
15 | //#define NV_GL_SHARED
|
---|
16 |
|
---|
17 | #if NV_PLATFORM == NV_WINDOWS
|
---|
18 | # define NV_GL_PATH "opengl32.dll"
|
---|
19 | #elif NV_PLATFORM == NV_APPLE
|
---|
20 | # define NV_GL_PATH "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
|
---|
21 | #else
|
---|
22 | # define NV_GL_PATH "libGL.so"
|
---|
23 | #endif
|
---|
24 |
|
---|
25 | #include <stdint.h>
|
---|
26 |
|
---|
27 | extern "C" {
|
---|
28 |
|
---|
29 | #if NV_PLATFORM == NV_WINDOWS
|
---|
30 | # define NV_GL_APIENTRY __stdcall
|
---|
31 | #else
|
---|
32 | # define NV_GL_APIENTRY
|
---|
33 | #endif
|
---|
34 |
|
---|
35 | #if defined(NV_GL_SHARED) && (NV_PLATFORM == NV_WINDOWS)
|
---|
36 | # define NV_GL_API __declspec(dllimport)
|
---|
37 | #else
|
---|
38 | # define NV_GL_API extern
|
---|
39 | #endif
|
---|
40 |
|
---|
41 | #include <nv/lib/detail/gl_types.inc>
|
---|
42 |
|
---|
43 | #if defined(NV_GL_DYNAMIC)
|
---|
44 | # define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *fname) fparams
|
---|
45 | #else
|
---|
46 | # define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype NV_GL_APIENTRY fname fparams
|
---|
47 | #endif
|
---|
48 | #define NV_GL_FUN_EXT NV_GL_FUN
|
---|
49 |
|
---|
50 | #include <nv/lib/detail/gl_functions.inc>
|
---|
51 |
|
---|
52 | #undef NV_GL_FUN_EXT
|
---|
53 | #undef NV_GL_FUN
|
---|
54 |
|
---|
55 | }
|
---|
56 |
|
---|
57 | namespace nv {
|
---|
58 | /* Dynamic load support */
|
---|
59 | # if defined( NV_GL_DYNAMIC )
|
---|
60 | bool load_gl_library( const char* path = NV_GL_PATH );
|
---|
61 | # else
|
---|
62 | inline bool load_gl_library( const char* path = "" ) { return true; }
|
---|
63 | # endif
|
---|
64 | }
|
---|
65 |
|
---|
66 | #endif // NV_LIB_GL_HH
|
---|