// Copyright (C) 2012-2013 ChaosForge / Kornel Kisielewicz // http://chaosforge.org/ // // This file is part of NV Libraries. // For conditions of distribution and use, see copyright notice in nv.hh #ifndef NV_LIB_GL_HH #define NV_LIB_GL_HH #include #if NV_PLATFORM == NV_WINDOWS # ifndef WIN32_LEAN_AND_MEAN # define WIN32_LEAN_AND_MEAN 1 # endif #include # undef WIN32_LEAN_AND_MEAN # undef near # undef far #endif #include //#define NV_SDL_GL #define NV_GL_DYNAMIC //#define NV_GL_SHARED #if NV_PLATFORM == NV_WINDOWS # define NV_GL_PATH "opengl32.dll" #elif NV_PLATFORM == NV_APPLE # define NV_GL_PATH "/System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib" #else # define NV_GL_PATH "libGL.so" #endif #include extern "C" { #if NV_PLATFORM == NV_WINDOWS # define NV_GL_APIENTRY __stdcall #else # define NV_GL_APIENTRY #endif #if defined(NV_GL_SHARED) && (NV_PLATFORM == NV_WINDOWS) # define NV_GL_API __declspec(dllimport) #else # define NV_GL_API extern #endif #include #if NV_PLATFORM == NV_WINDOWS #include #endif #include #if defined(NV_GL_DYNAMIC) # define NV_GL_FUN_REN( rtype, fname, rname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *rname) fparams # define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype ( NV_GL_APIENTRY *fname) fparams #else # define NV_GL_FUN( rtype, fname, fparams ) NV_GL_API rtype NV_GL_APIENTRY fname fparams #endif #define NV_GL_FUN_EXT NV_GL_FUN #include #if NV_PLATFORM == NV_WINDOWS #include #endif #include #undef NV_GL_FUN_REN #undef NV_GL_FUN_EXT #undef NV_GL_FUN } namespace nv { enum gl_extensions { EXT_NONE = 0, #define NV_GL_EXTENSION( count, id, name ) GL_EXT_##id = 1u << (count-1), #include #undef NV_GL_EXTENSION // EXT_PIXEL_BUFFER_OBJECT = 0x00000004, // EXT_TEXTURE_CUBE_MAP = 0x00000008, // EXT_TEXTURE_3D = 0x00000010, }; const char* get_gl_extension_name( gl_extensions extension ); bool load_gl_extension( gl_extensions extension ); gl_extensions load_gl_extensions( uint32 extensions ); bool is_gl_extension_loaded( gl_extensions extensions ); bool are_gl_extensions_loaded( uint32 extensions ); bool load_gl_no_context( const char* path = NV_GL_PATH ); /* Dynamic load support */ # if defined( NV_GL_DYNAMIC ) bool load_gl_library( const char* path = NV_GL_PATH, bool force_reload = false ); bool load_wgl_library( const char* path = NV_GL_PATH, bool force_reload = false ); # else inline bool load_gl_library( const char* = "", bool = false ) { return true; } inline bool load_wgl_library( const char* = "", bool = false ) { return true; } # endif } #endif // NV_LIB_GL_HH