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

Last change on this file since 464 was 464, checked in by epyon, 10 years ago
  • full GL header support up to 4.5
File size: 3.0 KB
RevLine 
[395]1// Copyright (C) 2012-2015 ChaosForge Ltd
[5]2// http://chaosforge.org/
3//
[395]4// This file is part of Nova libraries.
5// For conditions of distribution and use, see copying.txt file in root folder.
[5]6
7#ifndef NV_LIB_GL_HH
8#define NV_LIB_GL_HH
9
[395]10#include <nv/common.hh>
[245]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
[20]22#include <stddef.h>
23
[5]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
[464]52        // TODO: remove and use glGenerateMipmap
53#define GL_GENERATE_MIPMAP                0x8191
54
55#include <nv/lib/detail/gl_core/gl_types_2_1.inc>
[244]56#include <nv/lib/detail/gl_types.inc>
[245]57#if NV_PLATFORM == NV_WINDOWS
58#include <nv/lib/detail/wgl_types.inc>
59#endif
[311]60#include <nv/lib/detail/gl_ext/gl_ext_all_types.inc>
[5]61
[167]62#if defined(NV_GL_DYNAMIC)
[245]63#       define NV_GL_FUN_REN( rtype, fname, rname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *rname) fparams
[167]64#       define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *fname) fparams
65#else
66#       define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype NV_GL_APIENTRY fname fparams
67#endif
68#define NV_GL_FUN_EXT NV_GL_FUN
[5]69
[464]70#include <nv/lib/detail/gl_core/gl_functions_2_1.inc>
[245]71#if NV_PLATFORM == NV_WINDOWS
72#include <nv/lib/detail/wgl_functions.inc>
73#endif
[311]74#include <nv/lib/detail/gl_ext/gl_ext_all_functions.inc>
[5]75
[245]76#undef NV_GL_FUN_REN
[167]77#undef NV_GL_FUN_EXT
[5]78#undef NV_GL_FUN
79
80}
81
82namespace nv {
[311]83
84        enum gl_extensions
85        {
86                EXT_NONE                = 0,
87#define NV_GL_EXTENSION( count, id, name ) GL_EXT_##id = 1u << (count-1),
88#include <nv/lib/detail/gl_ext/gl_ext_info.inc>
89#undef NV_GL_EXTENSION
90        };
91
92        const char* get_gl_extension_name( gl_extensions extension );
93        bool load_gl_extension( gl_extensions extension );
94        gl_extensions load_gl_extensions( uint32 extensions );
95        bool is_gl_extension_loaded( gl_extensions extensions );
96        bool are_gl_extensions_loaded( uint32 extensions );
[245]97        bool load_gl_no_context( const char* path = NV_GL_PATH );
[311]98        /* Dynamic load support */
[5]99#       if defined( NV_GL_DYNAMIC )
[311]100                bool load_gl_library( const char* path = NV_GL_PATH, bool force_reload = false );
101                bool load_wgl_library( const char* path = NV_GL_PATH, bool force_reload = false );
[5]102#       else
[311]103                inline bool load_gl_library( const char* = "", bool = false ) { return true; }
104                inline bool load_wgl_library( const char* = "", bool = false ) { return true; }
[5]105#       endif
106}
107
108#endif // NV_LIB_GL_HH
Note: See TracBrowser for help on using the repository browser.