source: trunk/nv/lib/gl.hh @ 245

Last change on this file since 245 was 245, checked in by epyon, 11 years ago
  • gl library wgl support
  • gl context and window adoption
File size: 2.2 KB
Line 
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
12#if NV_PLATFORM == NV_WINDOWS
13#  ifndef WIN32_LEAN_AND_MEAN
14#    define WIN32_LEAN_AND_MEAN 1
15#  endif
16#include <windows.h>
17#  undef WIN32_LEAN_AND_MEAN
18#  undef near
19#  undef far
20#endif
21
22#include <stddef.h>
23
24//#define NV_SDL_GL
25#define NV_GL_DYNAMIC
26//#define NV_GL_SHARED
27
28#if NV_PLATFORM == NV_WINDOWS
29#       define NV_GL_PATH "opengl32.dll"
30#elif NV_PLATFORM == NV_APPLE
31#       define NV_GL_PATH "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib"
32#else
33#       define NV_GL_PATH "libGL.so"
34#endif
35
36#include <stdint.h>
37
38extern "C" {
39
40#if NV_PLATFORM == NV_WINDOWS
41#       define NV_GL_APIENTRY __stdcall
42#else
43#       define NV_GL_APIENTRY
44#endif
45
46#if defined(NV_GL_SHARED) && (NV_PLATFORM == NV_WINDOWS)
47#       define NV_GL_API __declspec(dllimport)
48#else
49#       define NV_GL_API extern
50#endif
51
52#include <nv/lib/detail/gl_types.inc>
53#if NV_PLATFORM == NV_WINDOWS
54#include <nv/lib/detail/wgl_types.inc>
55#endif
56
57#if defined(NV_GL_DYNAMIC)
58#       define NV_GL_FUN_REN( rtype, fname, rname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *rname) fparams
59#       define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *fname) fparams
60#else
61#       define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype NV_GL_APIENTRY fname fparams
62#endif
63#define NV_GL_FUN_EXT NV_GL_FUN
64
65#include <nv/lib/detail/gl_functions.inc>
66#if NV_PLATFORM == NV_WINDOWS
67#include <nv/lib/detail/wgl_functions.inc>
68#endif
69
70#undef NV_GL_FUN_REN
71#undef NV_GL_FUN_EXT
72#undef NV_GL_FUN
73
74}
75
76namespace nv {
77/* Dynamic load support */
78        bool load_gl_no_context( const char* path = NV_GL_PATH );
79#       if defined( NV_GL_DYNAMIC )
80                bool load_gl_library( const char* path = NV_GL_PATH );
81                bool load_wgl_library( const char* path = NV_GL_PATH );
82#       else
83                inline bool load_gl_library( const char* path = "" ) { return true; }
84                inline bool load_wgl_library( const char* path = "" ) { return true; }
85#       endif
86}
87
88#endif // NV_LIB_GL_HH
Note: See TracBrowser for help on using the repository browser.