Moved to GLAD for dynamic GL/WGL and extension loading.

Refactored extension usage that became core in GL2, and adjusted some types for GL2 compatibility.

git-svn-id: https://svn.eduke32.com/eduke32@6656 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
pogokeen 2018-02-16 06:38:21 +00:00
parent 037289a812
commit 3ca5f33c73
32 changed files with 7429 additions and 3007 deletions

View file

@ -117,6 +117,23 @@ else
endif
#### glad
glad := glad
glad_objs := \
glad.c \
glad_root := $(source)/$(glad)
glad_src := $(glad_root)/src
glad_inc := $(glad_root)/include
glad_obj := $(obj)/$(glad)
ifeq ($(RENDERTYPE),WIN)
glad_objs += glad_wgl.c
endif
##### Component Definitions
#### EBacktrace
@ -140,6 +157,8 @@ engine_obj := $(obj)/$(engine)
engine_cflags := -I$(engine_src)
engine_deps :=
engine_objs := \
rev.cpp \
baselayer.cpp \
@ -197,9 +216,10 @@ else
endif
endif
ifeq (1,$(USE_OPENGL))
engine_objs += glbuild.cpp voxmodel.cpp mdsprite.cpp
engine_objs += voxmodel.cpp mdsprite.cpp
engine_deps += glad
ifeq (1,$(POLYMER))
engine_objs += polymer.cpp
engine_objs += glbuild.cpp polymer.cpp
endif
endif
ifneq (0,$(LUNATIC))
@ -755,7 +775,7 @@ endif
#### Final setup
COMPILERFLAGS += -I$(engine_inc) -I$(mact_inc) -I$(audiolib_inc) -I$(enet_inc)
COMPILERFLAGS += -I$(engine_inc) -I$(mact_inc) -I$(audiolib_inc) -I$(enet_inc) -I$(glad_inc)
##### Recipes
@ -772,6 +792,7 @@ libraries := \
enet \
libxmplite \
lpeg \
glad \
components := \
$(games) \

View file

@ -2,7 +2,7 @@
#
$(ENGINE_OBJ)/a-c.$o: $(ENGINE_SRC)/a-c.cpp $(ENGINE_INC)/a.h
$(ENGINE_OBJ)/a.$o: $(ENGINE_SRC)/a.$(asm)
$(ENGINE_OBJ)/animvpx.$o: $(ENGINE_SRC)/animvpx.cpp $(ENGINE_INC)/animvpx.h $(ENGINE_INC)/glbuild.h
$(ENGINE_OBJ)/animvpx.$o: $(ENGINE_SRC)/animvpx.cpp $(ENGINE_INC)/animvpx.h $(GLAD_INC)/glad/glad.h
$(ENGINE_OBJ)/baselayer.$o: $(ENGINE_SRC)/baselayer.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/osd.h
$(ENGINE_OBJ)/build.$o: $(ENGINE_SRC)/build.cpp $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/compat.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/editor.h
$(ENGINE_OBJ)/cache1d.$o: $(ENGINE_SRC)/cache1d.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/kplib.h
@ -27,18 +27,18 @@ $(ENGINE_OBJ)/voxmodel.$o: $(ENGINE_SRC)/voxmodel.cpp $(ENGINE_SRC)/engine_priv.
$(ENGINE_OBJ)/mdsprite.$o: $(ENGINE_SRC)/mdsprite.cpp $(ENGINE_SRC)/engine_priv.h $(ENGINE_INC)/polymost.h $(ENGINE_INC)/hightile.h $(ENGINE_INC)/mdsprite.h $(ENGINE_INC)/texcache.h
$(ENGINE_OBJ)/textfont.$o: $(ENGINE_SRC)/textfont.cpp
$(ENGINE_OBJ)/smalltextfont.$o: $(ENGINE_SRC)/smalltextfont.cpp
$(ENGINE_OBJ)/glbuild.$o: $(ENGINE_SRC)/glbuild.cpp $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/baselayer.h
$(ENGINE_OBJ)/glbuild.$o: $(ENGINE_SRC)/glbuild.cpp $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/baselayer.h $(GLAD_INC)/glad/glad.h
$(ENGINE_OBJ)/kplib.$o: $(ENGINE_SRC)/kplib.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/kplib.h
$(ENGINE_OBJ)/lz4.$o: $(ENGINE_SRC)/lz4.c $(ENGINE_INC)/lz4.h
$(ENGINE_OBJ)/md4.$o: $(ENGINE_SRC)/md4.cpp $(ENGINE_INC)/md4.h
$(ENGINE_OBJ)/osd.$o: $(ENGINE_SRC)/osd.cpp $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/compat.h $(ENGINE_INC)/baselayer.h
$(ENGINE_OBJ)/pragmas.$o: $(ENGINE_SRC)/pragmas.cpp $(ENGINE_INC)/compat.h
$(ENGINE_OBJ)/scriptfile.$o: $(ENGINE_SRC)/scriptfile.cpp $(ENGINE_INC)/scriptfile.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/compat.h
$(ENGINE_OBJ)/sdlayer.$o: $(ENGINE_SRC)/sdlayer.cpp $(ENGINE_SRC)/sdlayer12.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/sdlayer.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/a.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/glbuild.h
$(ENGINE_OBJ)/winlayer.$o: $(ENGINE_SRC)/winlayer.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/winlayer.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/a.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/dxdidf.h $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/rawinput.h $(ENGINE_INC)/winbits.h
$(ENGINE_OBJ)/sdlayer.$o: $(ENGINE_SRC)/sdlayer.cpp $(ENGINE_SRC)/sdlayer12.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/sdlayer.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/cache1d.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/a.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/osd.h $(GLAD_INC)/glad/glad.h $(ENGINE_INC)/glbuild.h
$(ENGINE_OBJ)/winlayer.$o: $(ENGINE_SRC)/winlayer.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/winlayer.h $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/a.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/dxdidf.h $(GLAD_INC)/glad/glad.h $(GLAD_INC)/glad/glad_wgl.h $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/rawinput.h $(ENGINE_INC)/winbits.h
$(ENGINE_OBJ)/gtkbits.$o: $(ENGINE_SRC)/gtkbits.cpp $(ENGINE_INC)/baselayer.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/dynamicgtk.h
$(ENGINE_OBJ)/dynamicgtk.$o: $(ENGINE_SRC)/dynamicgtk.cpp $(ENGINE_INC)/dynamicgtk.h
$(ENGINE_OBJ)/polymer.$o: $(ENGINE_SRC)/polymer.cpp $(ENGINE_INC)/polymer.h $(ENGINE_INC)/compat.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/mdsprite.h $(ENGINE_INC)/polymost.h
$(ENGINE_OBJ)/polymer.$o: $(ENGINE_SRC)/polymer.cpp $(ENGINE_INC)/polymer.h $(ENGINE_INC)/compat.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(GLAD_INC)/glad/glad.h $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/osd.h $(ENGINE_INC)/pragmas.h $(ENGINE_INC)/mdsprite.h $(ENGINE_INC)/polymost.h
$(ENGINE_OBJ)/mutex.$o: $(ENGINE_SRC)/mutex.cpp $(ENGINE_INC)/mutex.h
$(ENGINE_OBJ)/rawinput.$o: $(ENGINE_SRC)/rawinput.cpp $(ENGINE_INC)/rawinput.h
$(ENGINE_OBJ)/wiibits.$o: $(ENGINE_SRC)/wiibits.cpp $(ENGINE_INC)/wiibits.h
@ -59,7 +59,7 @@ $(TOOLS_OBJ)/transpal.$o: $(TOOLS_SRC)/transpal.cpp $(ENGINE_INC)/compat.h $(ENG
$(TOOLS_OBJ)/wad2art.$o: $(TOOLS_SRC)/wad2art.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/pragmas.h
$(TOOLS_OBJ)/wad2map.$o: $(TOOLS_SRC)/wad2map.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/pragmas.h
$(TOOLS_OBJ)/kmd2tool.$o: $(TOOLS_SRC)/kmd2tool.cpp $(ENGINE_INC)/compat.h
$(TOOLS_OBJ)/md2tool.$o: $(TOOLS_SRC)/md2tool.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(ENGINE_INC)/glbuild.h $(ENGINE_INC)/mdsprite.h
$(TOOLS_OBJ)/md2tool.$o: $(TOOLS_SRC)/md2tool.cpp $(ENGINE_INC)/compat.h $(ENGINE_INC)/build.h $(ENGINE_INC)/buildtypes.h $(GLAD_INC)/glad/glad.h $(ENGINE_INC)/mdsprite.h
$(TOOLS_OBJ)/generateicon.$o: $(TOOLS_SRC)/generateicon.cpp $(ENGINE_INC)/kplib.h $(ENGINE_INC)/compat.h
$(TOOLS_OBJ)/cacheinfo.$o: $(TOOLS_SRC)/cacheinfo.cpp $(ENGINE_INC)/compat.h
$(TOOLS_OBJ)/enumdisplay.$o: $(TOOLS_SRC)/enumdisplay.cpp $(ENGINE_INC)/compat.h

View file

@ -20,6 +20,7 @@
#include "compat.h"
#include "pragmas.h"
#include "glad/glad.h"
#include "glbuild.h"
#include "palette.h"
@ -1424,7 +1425,7 @@ static FORCE_INLINE void push_nofog(void)
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST)
{
bglDisable(GL_FOG);
glDisable(GL_FOG);
}
#endif
}
@ -1433,7 +1434,7 @@ static FORCE_INLINE void pop_nofog(void)
{
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && !nofog)
bglEnable(GL_FOG);
glEnable(GL_FOG);
#endif
}

View file

@ -11,98 +11,20 @@
# define USE_GLEXT
#endif
// include this before glext does
#ifdef _WIN32
# include "windows_inc.h"
#endif
// Tell gl.h to not include glext.h, we'll include our own copy in a minute
#define GL_GLEXT_LEGACY
#if defined EDUKE32_OSX
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
#elif defined EDUKE32_IOS
# include <OpenGLES/ES1/gl.h>
#elif defined EDUKE32_GLES
# include <SDL2/SDL_opengles.h>
# include <SDL2/SDL_opengl_glext.h>
#else
# include <GL/gl.h>
# include <GL/glu.h>
#endif
#if !defined DYNAMIC_GLEXT
# define GL_GLEXT_PROTOTYPES
#endif
// get this header from http://oss.sgi.com/projects/ogl-sample/registry/
// if you are missing it
//#include <GL/glext.h>
#if defined EDUKE32_OSX
# include <OpenGL/glext.h>
# define GL_MAP_WRITE_BIT 0x0002
# define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
# define GL_MAP_PERSISTENT_BIT 0x0040
# define GL_MAP_COHERENT_BIT 0x0080
# define GL_DYNAMIC_STORAGE_BIT 0x0100
# define GL_DEBUG_TYPE_ERROR_ARB 0x824C
#elif defined EDUKE32_IOS
typedef double GLdouble;
# include <OpenGLES/ES1/glext.h>
typedef GLintptr GLintptrARB;
typedef GLsizeiptr GLsizeiptrARB;
typedef GLchar GLcharARB;
typedef void* GLhandleARB;
typedef unsigned int GLenum;
# define GL_TEXTURE0_ARB GL_TEXTURE0
# define GL_RGB_SCALE_ARB GL_RGB_SCALE
# define GL_ELEMENT_ARRAY_BUFFER_ARB GL_ELEMENT_ARRAY_BUFFER
# define GL_ARRAY_BUFFER_ARB GL_ARRAY_BUFFER
# define GL_WRITE_ONLY_ARB 0x88B9
# define GL_STREAM_DRAW_ARB 0x88E0
# define GL_STATIC_DRAW_ARB 0x88E4
# define GL_RGBA4 0x8056
# define GL_RGB5_A1 0x8057
# define GL_RGB565 0x8D62
# define GL_COMPRESSED_RGB8_ETC2 0x9274
# define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
# define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
#else
# include "glext.h"
#endif
#ifndef GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT
#error You should get an updated copy of glext.h from http://oss.sgi.com/projects/ogl-sample/registry/
#endif
#if defined EDUKE32_GLES
# include "jwzgles.h"
#endif
#ifndef APIENTRY
# define APIENTRY
#endif
# ifdef _WIN32
# define PR_CALLBACK __stdcall
# else
# define PR_CALLBACK
# endif
// those defines are somehow missing from glext.h
#define GL_FRAMEBUFFER_EXT 0x8D40
#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
#define GL_TEXTURE_RECTANGLE 0x84F5
#ifndef GL_ETC1_RGB8_OES
# define GL_ETC1_RGB8_OES 0x8D64
#endif
// custom error checking
extern GLenum BuildGLError;
@ -111,760 +33,32 @@ extern void BuildGLErrorCheck(void);
//////// dynamic/static API wrapping ////////
#if defined DYNAMIC_GL
#ifdef _WIN32
#if !defined RENDERTYPESDL && defined _WIN32 && defined DYNAMIC_GL
typedef HGLRC (WINAPI * bwglCreateContextProcPtr)(HDC);
extern bwglCreateContextProcPtr bwglCreateContext;
#define wglCreateContext bwglCreateContext
typedef BOOL (WINAPI * bwglDeleteContextProcPtr)(HGLRC);
extern bwglDeleteContextProcPtr bwglDeleteContext;
#define wglDeleteContext bwglDeleteContext
typedef PROC (WINAPI * bwglGetProcAddressProcPtr)(LPCSTR);
extern bwglGetProcAddressProcPtr bwglGetProcAddress;
#define wglGetProcAddress bwglGetProcAddress
typedef BOOL (WINAPI * bwglMakeCurrentProcPtr)(HDC,HGLRC);
extern bwglMakeCurrentProcPtr bwglMakeCurrent;
#define wglMakeCurrent bwglMakeCurrent
typedef BOOL (WINAPI * bwglSwapBuffersProcPtr)(HDC);
extern bwglSwapBuffersProcPtr bwglSwapBuffers;
typedef int32_t (WINAPI * bwglChoosePixelFormatProcPtr)(HDC,CONST PIXELFORMATDESCRIPTOR*);
extern bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
#define wglChoosePixelFormat bwglChoosePixelFormat
typedef int32_t (WINAPI * bwglDescribePixelFormatProcPtr)(HDC,int32_t,UINT,LPPIXELFORMATDESCRIPTOR);
extern bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
#define wglDescribePixelFormat bwglDescribePixelFormat
typedef int32_t (WINAPI * bwglGetPixelFormatProcPtr)(HDC);
extern bwglGetPixelFormatProcPtr bwglGetPixelFormat;
#define wglGetPixelFormat bwglGetPixelFormat
typedef BOOL (WINAPI * bwglSetPixelFormatProcPtr)(HDC,int32_t,const PIXELFORMATDESCRIPTOR*);
extern bwglSetPixelFormatProcPtr bwglSetPixelFormat;
#endif
typedef void (APIENTRY * bglClearColorProcPtr)( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha );
extern bglClearColorProcPtr bglClearColor;
typedef void (APIENTRY * bglClearProcPtr)( GLbitfield mask );
extern bglClearProcPtr bglClear;
typedef void (APIENTRY * bglColorMaskProcPtr)( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha );
extern bglColorMaskProcPtr bglColorMask;
typedef void (APIENTRY * bglAlphaFuncProcPtr)( GLenum func, GLclampf ref );
extern bglAlphaFuncProcPtr bglAlphaFunc;
typedef void (APIENTRY * bglBlendFuncProcPtr)( GLenum sfactor, GLenum dfactor );
extern bglBlendFuncProcPtr bglBlendFunc;
typedef void (APIENTRY * bglCullFaceProcPtr)( GLenum mode );
extern bglCullFaceProcPtr bglCullFace;
typedef void (APIENTRY * bglFrontFaceProcPtr)( GLenum mode );
extern bglFrontFaceProcPtr bglFrontFace;
typedef void (APIENTRY * bglPolygonOffsetProcPtr)( GLfloat factor, GLfloat units );
extern bglPolygonOffsetProcPtr bglPolygonOffset;
typedef void (APIENTRY * bglPolygonModeProcPtr)( GLenum face, GLenum mode );
extern bglPolygonModeProcPtr bglPolygonMode;
typedef void (APIENTRY * bglEnableProcPtr)( GLenum cap );
extern bglEnableProcPtr bglEnable;
typedef void (APIENTRY * bglDisableProcPtr)( GLenum cap );
extern bglDisableProcPtr bglDisable;
typedef void (APIENTRY * bglGetDoublevProcPtr)( GLenum pname, GLdouble *params );
extern bglGetDoublevProcPtr bglGetDoublev;
typedef void (APIENTRY * bglGetFloatvProcPtr)( GLenum pname, GLfloat *params );
extern bglGetFloatvProcPtr bglGetFloatv;
typedef void (APIENTRY * bglGetIntegervProcPtr)( GLenum pname, GLint *params );
extern bglGetIntegervProcPtr bglGetIntegerv;
typedef void (APIENTRY * bglPushAttribProcPtr)( GLbitfield mask );
extern bglPushAttribProcPtr bglPushAttrib;
typedef void (APIENTRY * bglPopAttribProcPtr)( void );
extern bglPopAttribProcPtr bglPopAttrib;
typedef GLenum (APIENTRY * bglGetErrorProcPtr)( void );
extern bglGetErrorProcPtr bglGetError;
typedef const GLubyte* (APIENTRY * bglGetStringProcPtr)( GLenum name );
extern bglGetStringProcPtr bglGetString;
typedef void (APIENTRY * bglHintProcPtr)( GLenum target, GLenum mode );
extern bglHintProcPtr bglHint;
typedef void (APIENTRY * bglDrawBufferProcPtr)(GLenum mode);
extern bglDrawBufferProcPtr bglDrawBuffer;
typedef void (APIENTRY * bglReadBufferProcPtr)(GLenum mode);
extern bglReadBufferProcPtr bglReadBuffer;
typedef void (APIENTRY * bglScissorProcPtr)(GLint x, GLint y, GLsizei width, GLsizei height);
extern bglScissorProcPtr bglScissor;
typedef void (APIENTRY * bglClipPlaneProcPtr)(GLenum plane, const GLdouble *equation);
extern bglClipPlaneProcPtr bglClipPlane;
// Depth
typedef void (APIENTRY * bglDepthFuncProcPtr)( GLenum func );
extern bglDepthFuncProcPtr bglDepthFunc;
typedef void (APIENTRY * bglDepthMaskProcPtr)( GLboolean flag );
extern bglDepthMaskProcPtr bglDepthMask;
//typedef void (APIENTRY * bglDepthRangeProcPtr)( GLclampd near_val, GLclampd far_val );
//extern bglDepthRangeProcPtr bglDepthRange;
// Matrix
typedef void (APIENTRY * bglMatrixModeProcPtr)( GLenum mode );
extern bglMatrixModeProcPtr bglMatrixMode;
typedef void (APIENTRY * bglOrthoProcPtr)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
extern bglOrthoProcPtr bglOrtho;
typedef void (APIENTRY * bglFrustumProcPtr)( GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val );
extern bglFrustumProcPtr bglFrustum;
typedef void (APIENTRY * bglViewportProcPtr)( GLint x, GLint y, GLsizei width, GLsizei height );
extern bglViewportProcPtr bglViewport;
typedef void (APIENTRY * bglPushMatrixProcPtr)( void );
extern bglPushMatrixProcPtr bglPushMatrix;
typedef void (APIENTRY * bglPopMatrixProcPtr)( void );
extern bglPopMatrixProcPtr bglPopMatrix;
typedef void (APIENTRY * bglLoadIdentityProcPtr)( void );
extern bglLoadIdentityProcPtr bglLoadIdentity;
typedef void (APIENTRY * bglLoadMatrixfProcPtr)( const GLfloat *m );
extern bglLoadMatrixfProcPtr bglLoadMatrixf;
typedef void (APIENTRY * bglLoadMatrixdProcPtr)( const GLdouble *m );
extern bglLoadMatrixdProcPtr bglLoadMatrixd;
typedef void (APIENTRY * bglMultMatrixfProcPtr)( const GLfloat *m );
extern bglMultMatrixfProcPtr bglMultMatrixf;
typedef void (APIENTRY * bglMultMatrixdProcPtr)( const GLdouble *m );
extern bglMultMatrixdProcPtr bglMultMatrixd;
typedef void (APIENTRY * bglRotatefProcPtr)(GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
extern bglRotatefProcPtr bglRotatef;
typedef void (APIENTRY * bglScalefProcPtr)(GLfloat x, GLfloat y, GLfloat z);
extern bglScalefProcPtr bglScalef;
typedef void (APIENTRY * bglTranslatefProcPtr)(GLfloat x, GLfloat y, GLfloat z);
extern bglTranslatefProcPtr bglTranslatef;
// Drawing
typedef void (APIENTRY * bglBeginProcPtr)( GLenum mode );
extern bglBeginProcPtr bglBegin;
typedef void (APIENTRY * bglEndProcPtr)( void );
extern bglEndProcPtr bglEnd;
typedef void (APIENTRY * bglVertex2fProcPtr)( GLfloat x, GLfloat y );
extern bglVertex2fProcPtr bglVertex2f;
typedef void (APIENTRY * bglVertex2iProcPtr)( GLint x, GLint y );
extern bglVertex2iProcPtr bglVertex2i;
typedef void (APIENTRY * bglVertex3fProcPtr)( GLfloat x, GLfloat y, GLfloat z );
extern bglVertex3fProcPtr bglVertex3f;
typedef void (APIENTRY * bglVertex3dProcPtr)( GLdouble x, GLdouble y, GLdouble z );
extern bglVertex3dProcPtr bglVertex3d;
typedef void (APIENTRY * bglVertex3fvProcPtr)( const GLfloat *v );
extern bglVertex3fvProcPtr bglVertex3fv;
typedef void (APIENTRY * bglVertex3dvProcPtr)( const GLdouble *v );
extern bglVertex3dvProcPtr bglVertex3dv;
typedef void (APIENTRY * bglRectiProcPtr)( GLint x1, GLint y1, GLint x2, GLint y2 );
extern bglRectiProcPtr bglRecti;
typedef void (APIENTRY * bglColor3fProcPtr)(GLfloat red, GLfloat green, GLfloat blue);
extern bglColor3fProcPtr bglColor3f;
typedef void (APIENTRY * bglColor4fProcPtr)( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha );
extern bglColor4fProcPtr bglColor4f;
typedef void (APIENTRY * bglColor4ubProcPtr)( GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha );
extern bglColor4ubProcPtr bglColor4ub;
typedef void (APIENTRY * bglTexCoord2dProcPtr)( GLdouble s, GLdouble t );
extern bglTexCoord2dProcPtr bglTexCoord2d;
typedef void (APIENTRY * bglTexCoord2fProcPtr)( GLfloat s, GLfloat t );
extern bglTexCoord2fProcPtr bglTexCoord2f;
typedef void (APIENTRY * bglTexCoord2iProcPtr)( GLint s, GLint t );
extern bglTexCoord2iProcPtr bglTexCoord2i;
typedef void (APIENTRY * bglNormal3fProcPtr)( GLfloat x, GLfloat y, GLfloat z );
extern bglNormal3fProcPtr bglNormal3f;
// Lighting
typedef void (APIENTRY * bglShadeModelProcPtr)( GLenum mode );
extern bglShadeModelProcPtr bglShadeModel;
typedef void (APIENTRY * bglLightfvProcPtr)( GLenum light, GLenum pname, const GLfloat * params );
extern bglLightfvProcPtr bglLightfv;
// Raster funcs
typedef void (APIENTRY * bglReadPixelsProcPtr)( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels );
extern bglReadPixelsProcPtr bglReadPixels;
typedef void (APIENTRY * bglRasterPos4iProcPtr)( GLint x, GLint y, GLint z, GLint w );
extern bglRasterPos4iProcPtr bglRasterPos4i;
typedef void (APIENTRY * bglDrawPixelsProcPtr)( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels );
extern bglDrawPixelsProcPtr bglDrawPixels;
typedef void (APIENTRY * bglPixelStoreiProcPtr)( GLenum pname, GLint param );
extern bglPixelStoreiProcPtr bglPixelStorei;
// Texture mapping
typedef void (APIENTRY * bglTexEnvfProcPtr)( GLenum target, GLenum pname, GLfloat param );
extern bglTexEnvfProcPtr bglTexEnvf;
typedef void (APIENTRY * bglGenTexturesProcPtr)( GLsizei n, GLuint *textures ); // 1.1
extern bglGenTexturesProcPtr bglGenTextures;
typedef void (APIENTRY * bglDeleteTexturesProcPtr)( GLsizei n, const GLuint *textures); // 1.1
extern bglDeleteTexturesProcPtr bglDeleteTextures;
typedef void (APIENTRY * bglBindTextureProcPtr)( GLenum target, GLuint texture ); // 1.1
extern bglBindTextureProcPtr bglBindTexture;
typedef void (APIENTRY * bglTexImage2DProcPtr)( GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels );
extern bglTexImage2DProcPtr bglTexImage2D;
typedef void (APIENTRY * bglCopyTexImage2DProcPtr)( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border );
extern bglCopyTexImage2DProcPtr bglCopyTexImage2D;
typedef void (APIENTRY * bglCopyTexSubImage2DProcPtr)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
extern bglCopyTexSubImage2DProcPtr bglCopyTexSubImage2D;
typedef void (APIENTRY * bglTexSubImage2DProcPtr)( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ); // 1.1
extern bglTexSubImage2DProcPtr bglTexSubImage2D;
typedef void (APIENTRY * bglTexParameterfProcPtr)( GLenum target, GLenum pname, GLfloat param );
extern bglTexParameterfProcPtr bglTexParameterf;
typedef void (APIENTRY * bglTexParameteriProcPtr)( GLenum target, GLenum pname, GLint param );
extern bglTexParameteriProcPtr bglTexParameteri;
typedef void (APIENTRY * bglGetTexParameterivProcPtr)( GLenum target, GLenum pname, GLint *params );
extern bglGetTexParameterivProcPtr bglGetTexParameteriv;
typedef void (APIENTRY * bglGetTexLevelParameterivProcPtr)( GLenum target, GLint level, GLenum pname, GLint *params );
extern bglGetTexLevelParameterivProcPtr bglGetTexLevelParameteriv;
typedef void (APIENTRY * bglTexGenfvProcPtr)(GLenum coord, GLenum pname, const GLfloat *params);
extern bglTexGenfvProcPtr bglTexGenfv;
// Fog
typedef void (APIENTRY * bglFogfProcPtr)( GLenum pname, GLfloat param );
extern bglFogfProcPtr bglFogf;
typedef void (APIENTRY * bglFogiProcPtr)( GLenum pname, GLint param );
extern bglFogiProcPtr bglFogi;
typedef void (APIENTRY * bglFogfvProcPtr)( GLenum pname, const GLfloat *params );
extern bglFogfvProcPtr bglFogfv;
// Display Lists
typedef void (APIENTRY * bglNewListProcPtr)(GLuint list, GLenum mode);
extern bglNewListProcPtr bglNewList;
typedef void (APIENTRY * bglEndListProcPtr)(void);
extern bglEndListProcPtr bglEndList;
typedef void (APIENTRY * bglCallListProcPtr)(GLuint list);
extern bglCallListProcPtr bglCallList;
typedef void (APIENTRY * bglDeleteListsProcPtr)(GLuint list, GLsizei range);
extern bglDeleteListsProcPtr bglDeleteLists;
// Vertex Arrays
typedef void (APIENTRY * bglEnableClientStateProcPtr)(GLenum cap);
extern bglEnableClientStateProcPtr bglEnableClientState;
typedef void (APIENTRY * bglDisableClientStateProcPtr)(GLenum cap);
extern bglDisableClientStateProcPtr bglDisableClientState;
typedef void (APIENTRY * bglVertexPointerProcPtr)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
extern bglVertexPointerProcPtr bglVertexPointer;
typedef void (APIENTRY * bglNormalPointerProcPtr)(GLenum type, GLsizei stride, const GLvoid *pointer);
extern bglNormalPointerProcPtr bglNormalPointer;
typedef void (APIENTRY * bglTexCoordPointerProcPtr)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
extern bglTexCoordPointerProcPtr bglTexCoordPointer;
typedef void (APIENTRY * bglDrawArraysProcPtr)(GLenum mode, GLint first, GLsizei count);
extern bglDrawArraysProcPtr bglDrawArrays;
typedef void (APIENTRY * bglDrawElementsProcPtr)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
extern bglDrawElementsProcPtr bglDrawElements;
// Stencil Buffer
typedef void (APIENTRY * bglClearStencilProcPtr)(GLint s);
extern bglClearStencilProcPtr bglClearStencil;
typedef void (APIENTRY * bglStencilOpProcPtr)(GLenum fail, GLenum zfail, GLenum zpass);
extern bglStencilOpProcPtr bglStencilOp;
typedef void (APIENTRY * bglStencilFuncProcPtr)(GLenum func, GLint ref, GLuint mask);
extern bglStencilFuncProcPtr bglStencilFunc;
#else
#define bglClearColor glClearColor
#define bglClear glClear
#define bglColorMask glColorMask
#define bglAlphaFunc glAlphaFunc
#define bglBlendFunc glBlendFunc
#define bglCullFace glCullFace
#define bglFrontFace glFrontFace
#define bglPolygonOffset glPolygonOffset
#define bglPolygonMode glPolygonMode
#define bglEnable glEnable
#define bglDisable glDisable
#define bglGetDoublev glGetDoublev
#define bglGetFloatv glGetFloatv
#define bglGetIntegerv glGetIntegerv
#define bglPushAttrib glPushAttrib
#define bglPopAttrib glPopAttrib
#define bglGetError glGetError
#define bglGetString glGetString
#define bglHint glHint
#define bglDrawBuffer glDrawBuffer
#define bglReadBuffer glReadBuffer
#define bglScissor glScissor
#define bglClipPlane glClipPlane
// Depth
#define bglDepthFunc glDepthFunc
#define bglDepthMask glDepthMask
//#define bglDepthRange glDepthRange
// Matrix
#define bglMatrixMode glMatrixMode
#define bglOrtho glOrtho
#define bglFrustum glFrustum
#define bglViewport glViewport
#define bglPushMatrix glPushMatrix
#define bglPopMatrix glPopMatrix
#define bglLoadIdentity glLoadIdentity
#define bglLoadMatrixf glLoadMatrixf
#define bglLoadMatrixd glLoadMatrixd
#define bglMultMatrixf glMultMatrixf
#define bglMultMatrixd glMultMatrixd
#define bglRotatef glRotatef
#define bglScalef glScalef
#define bglTranslatef glTranslatef
// Drawing
#define bglBegin glBegin
#define bglEnd glEnd
#define bglVertex2f glVertex2f
#define bglVertex2i glVertex2i
#define bglVertex3f glVertex3f
#define bglVertex3d glVertex3d
#define bglVertex3fv glVertex3fv
#define bglVertex3dv glVertex3dv
#define bglRecti glRecti
#define bglColor3f glColor3f
#define bglColor4f glColor4f
#define bglColor4ub glColor4ub
#define bglTexCoord2d glTexCoord2d
#define bglTexCoord2f glTexCoord2f
#define bglTexCoord2i glTexCoord2i
#define bglNormal3f glNormal3f
// Lighting
#define bglShadeModel glShadeModel
#define bglLightfv glLightfv
// Raster funcs
#define bglReadPixels glReadPixels
#define bglRasterPos4i glRasterPos4i
#define bglDrawPixels glDrawPixels
#define bglPixelStorei glPixelStorei
// Texture mapping
#define bglTexEnvf glTexEnvf
#define bglGenTextures glGenTextures
#define bglDeleteTextures glDeleteTextures
#define bglBindTexture glBindTexture
#define bglTexImage2D glTexImage2D
#define bglCopyTexImage2D glCopyTexImage2D
#define bglCopyTexSubImage2D glCopyTexSubImage2D;
#define bglTexSubImage2D glTexSubImage2D
#define bglTexParameterf glTexParameterf
#define bglTexParameteri glTexParameteri
#define bglGetTexParameteriv glGetTexParameteriv
#define bglGetTexLevelParameteriv glGetTexLevelParameteriv
// Fog
#define bglFogf glFogf
#define bglFogi glFogi
#define bglFogfv glFogfv
// Display Lists
#define bglNewList glNewList
#define bglEndList glEndList
#define bglCallList glCallList
#define bglDeleteLists glDeleteLists
// Vertex Arrays
#define bglEnableClientState glEnableClientState
#define bglDisableClientState glDisableClientState
#define bglVertexPointer glVertexPointer
#define bglNormalPointer glNormalPointer
#define bglTexCoordPointer glTexCoordPointer
#define bglDrawElements glDrawElements
// Stencil Buffer
#define bglClearStencil glClearStencil
#define bglStencilOp glStencilOp
#define bglStencilFunc glStencilFunc
#endif
#if defined DYNAMIC_GLEXT
typedef void (APIENTRY * bglBlendEquationProcPtr)( GLenum mode );
extern bglBlendEquationProcPtr bglBlendEquation;
typedef void (APIENTRY * bglTexImage3DProcPtr)(GLenum target, GLint level, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
extern bglTexImage3DProcPtr bglTexImage3D;
typedef void (APIENTRY * bglCompressedTexImage2DARBProcPtr)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *);
extern bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
typedef void (APIENTRY * bglGetCompressedTexImageARBProcPtr)(GLenum, GLint, GLvoid *);
extern bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
// GPU Programs
typedef void (APIENTRY * bglGenProgramsARBProcPtr)(GLsizei, GLuint *);
extern bglGenProgramsARBProcPtr bglGenProgramsARB;
typedef void (APIENTRY * bglBindProgramARBProcPtr)(GLenum, GLuint);
extern bglBindProgramARBProcPtr bglBindProgramARB;
typedef void (APIENTRY * bglProgramStringARBProcPtr)(GLenum, GLenum, GLsizei, const GLvoid *);
extern bglProgramStringARBProcPtr bglProgramStringARB;
typedef void (APIENTRY * bglDeleteProgramsARBProcPtr)(GLsizei n, const GLuint *programs);
extern bglDeleteProgramsARBProcPtr bglDeleteProgramsARB;
// Multitexturing
typedef void (APIENTRY * bglActiveTextureARBProcPtr)(GLenum texture);
extern bglActiveTextureARBProcPtr bglActiveTextureARB;
typedef void (APIENTRY * bglClientActiveTextureARBProcPtr)(GLenum texture);
extern bglClientActiveTextureARBProcPtr bglClientActiveTextureARB;
typedef void (APIENTRY * bglMultiTexCoord2dARBProcPtr)(GLenum target, GLdouble s, GLdouble t );
extern bglMultiTexCoord2dARBProcPtr bglMultiTexCoord2dARB;
typedef void (APIENTRY * bglMultiTexCoord2fARBProcPtr)(GLenum target, GLfloat s, GLfloat t );
extern bglMultiTexCoord2fARBProcPtr bglMultiTexCoord2fARB;
// Frame Buffer Objects
typedef void (APIENTRY * bglGenFramebuffersEXTProcPtr)(GLsizei n, GLuint *framebuffers);
extern bglGenFramebuffersEXTProcPtr bglGenFramebuffersEXT;
typedef void (APIENTRY * bglBindFramebufferEXTProcPtr)(GLenum target, GLuint framebuffer);
extern bglBindFramebufferEXTProcPtr bglBindFramebufferEXT;
typedef void (APIENTRY * bglFramebufferTexture2DEXTProcPtr)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
extern bglFramebufferTexture2DEXTProcPtr bglFramebufferTexture2DEXT;
typedef GLenum (APIENTRY * bglCheckFramebufferStatusEXTProcPtr)(GLenum target);
extern bglCheckFramebufferStatusEXTProcPtr bglCheckFramebufferStatusEXT;
typedef void (APIENTRY * bglDeleteFramebuffersEXTProcPtr)(GLsizei n, const GLuint *framebuffers);
extern bglDeleteFramebuffersEXTProcPtr bglDeleteFramebuffersEXT;
// Vertex Buffer Objects
typedef void (APIENTRY * bglGenBuffersARBProcPtr)(GLsizei n, GLuint * buffers);
extern bglGenBuffersARBProcPtr bglGenBuffersARB;
typedef void (APIENTRY * bglBindBufferARBProcPtr)(GLenum target, GLuint buffer);
extern bglBindBufferARBProcPtr bglBindBufferARB;
typedef void (APIENTRY * bglDeleteBuffersARBProcPtr)(GLsizei n, const GLuint * buffers);
extern bglDeleteBuffersARBProcPtr bglDeleteBuffersARB;
typedef void (APIENTRY * bglBufferDataARBProcPtr)(GLenum target, GLsizeiptrARB size, const GLvoid * data, GLenum usage);
extern bglBufferDataARBProcPtr bglBufferDataARB;
typedef void (APIENTRY * bglBufferSubDataARBProcPtr)(GLenum target, GLintptrARB offset, GLsizeiptrARB size, const GLvoid * data);
extern bglBufferSubDataARBProcPtr bglBufferSubDataARB;
typedef void* (APIENTRY * bglMapBufferARBProcPtr)(GLenum target, GLenum access);
extern bglMapBufferARBProcPtr bglMapBufferARB;
typedef GLboolean (APIENTRY * bglUnmapBufferARBProcPtr)(GLenum target);
extern bglUnmapBufferARBProcPtr bglUnmapBufferARB;
// ARB_buffer_storage
typedef void (APIENTRY * bglBufferStorageProcPtr)(GLenum target, GLintptrARB size, const GLvoid * data, GLbitfield flags);
extern bglBufferStorageProcPtr bglBufferStorage;
// ARB_map_buffer_range
typedef void* (APIENTRY * bglMapBufferRangeProcPtr) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
extern bglMapBufferRangeProcPtr bglMapBufferRange;
// Occlusion queries
typedef void (APIENTRY * bglGenQueriesARBProcPtr)(GLsizei n, GLuint *ids);
extern bglGenQueriesARBProcPtr bglGenQueriesARB;
typedef void (APIENTRY * bglDeleteQueriesARBProcPtr)(GLsizei n, const GLuint *ids);
extern bglDeleteQueriesARBProcPtr bglDeleteQueriesARB;
typedef GLboolean (APIENTRY * bglIsQueryARBProcPtr)(GLuint id);
extern bglIsQueryARBProcPtr bglIsQueryARB;
typedef void (APIENTRY * bglBeginQueryARBProcPtr)(GLenum target, GLuint id);
extern bglBeginQueryARBProcPtr bglBeginQueryARB;
typedef void (APIENTRY * bglEndQueryARBProcPtr)(GLenum target);
extern bglEndQueryARBProcPtr bglEndQueryARB;
typedef void (APIENTRY * bglGetQueryivARBProcPtr)(GLenum target, GLenum pname, GLint *params);
extern bglGetQueryivARBProcPtr bglGetQueryivARB;
typedef void (APIENTRY * bglGetQueryObjectivARBProcPtr)(GLuint id, GLenum pname, GLint *params);
extern bglGetQueryObjectivARBProcPtr bglGetQueryObjectivARB;
typedef void (APIENTRY * bglGetQueryObjectuivARBProcPtr)(GLuint id, GLenum pname, GLuint *params);
extern bglGetQueryObjectuivARBProcPtr bglGetQueryObjectuivARB;
// Shader Objects
typedef void (APIENTRY * bglDeleteObjectARBProcPtr)(GLhandleARB);
extern bglDeleteObjectARBProcPtr bglDeleteObjectARB;
typedef GLhandleARB (APIENTRY * bglGetHandleARBProcPtr)(GLenum);
extern bglGetHandleARBProcPtr bglGetHandleARB;
typedef void (APIENTRY * bglDetachObjectARBProcPtr)(GLhandleARB, GLhandleARB);
extern bglDetachObjectARBProcPtr bglDetachObjectARB;
typedef GLhandleARB (APIENTRY * bglCreateShaderObjectARBProcPtr)(GLenum);
extern bglCreateShaderObjectARBProcPtr bglCreateShaderObjectARB;
typedef void (APIENTRY * bglShaderSourceARBProcPtr)(GLhandleARB, GLsizei, const GLcharARB* *, const GLint *);
extern bglShaderSourceARBProcPtr bglShaderSourceARB;
typedef void (APIENTRY * bglCompileShaderARBProcPtr)(GLhandleARB);
extern bglCompileShaderARBProcPtr bglCompileShaderARB;
typedef GLhandleARB (APIENTRY * bglCreateProgramObjectARBProcPtr)(void);
extern bglCreateProgramObjectARBProcPtr bglCreateProgramObjectARB;
typedef void (APIENTRY * bglAttachObjectARBProcPtr)(GLhandleARB, GLhandleARB);
extern bglAttachObjectARBProcPtr bglAttachObjectARB;
typedef void (APIENTRY * bglLinkProgramARBProcPtr)(GLhandleARB);
extern bglLinkProgramARBProcPtr bglLinkProgramARB;
typedef void (APIENTRY * bglUseProgramObjectARBProcPtr)(GLhandleARB);
extern bglUseProgramObjectARBProcPtr bglUseProgramObjectARB;
typedef void (APIENTRY * bglValidateProgramARBProcPtr)(GLhandleARB);
extern bglValidateProgramARBProcPtr bglValidateProgramARB;
typedef void (APIENTRY * bglUniform1fARBProcPtr)(GLint, GLfloat);
extern bglUniform1fARBProcPtr bglUniform1fARB;
typedef void (APIENTRY * bglUniform2fARBProcPtr)(GLint, GLfloat, GLfloat);
extern bglUniform2fARBProcPtr bglUniform2fARB;
typedef void (APIENTRY * bglUniform3fARBProcPtr)(GLint, GLfloat, GLfloat, GLfloat);
extern bglUniform3fARBProcPtr bglUniform3fARB;
typedef void (APIENTRY * bglUniform4fARBProcPtr)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
extern bglUniform4fARBProcPtr bglUniform4fARB;
typedef void (APIENTRY * bglUniform1iARBProcPtr)(GLint, GLint);
extern bglUniform1iARBProcPtr bglUniform1iARB;
typedef void (APIENTRY * bglUniform2iARBProcPtr)(GLint, GLint, GLint);
extern bglUniform2iARBProcPtr bglUniform2iARB;
typedef void (APIENTRY * bglUniform3iARBProcPtr)(GLint, GLint, GLint, GLint);
extern bglUniform3iARBProcPtr bglUniform3iARB;
typedef void (APIENTRY * bglUniform4iARBProcPtr)(GLint, GLint, GLint, GLint, GLint);
extern bglUniform4iARBProcPtr bglUniform4iARB;
typedef void (APIENTRY * bglUniform1fvARBProcPtr)(GLint, GLsizei, const GLfloat *);
extern bglUniform1fvARBProcPtr bglUniform1fvARB;
typedef void (APIENTRY * bglUniform2fvARBProcPtr)(GLint, GLsizei, const GLfloat *);
extern bglUniform2fvARBProcPtr bglUniform2fvARB;
typedef void (APIENTRY * bglUniform3fvARBProcPtr)(GLint, GLsizei, const GLfloat *);
extern bglUniform3fvARBProcPtr bglUniform3fvARB;
typedef void (APIENTRY * bglUniform4fvARBProcPtr)(GLint, GLsizei, const GLfloat *);
extern bglUniform4fvARBProcPtr bglUniform4fvARB;
typedef void (APIENTRY * bglUniform1ivARBProcPtr)(GLint, GLsizei, const GLint *);
extern bglUniform1ivARBProcPtr bglUniform1ivARB;
typedef void (APIENTRY * bglUniform2ivARBProcPtr)(GLint, GLsizei, const GLint *);
extern bglUniform2ivARBProcPtr bglUniform2ivARB;
typedef void (APIENTRY * bglUniform3ivARBProcPtr)(GLint, GLsizei, const GLint *);
extern bglUniform3ivARBProcPtr bglUniform3ivARB;
typedef void (APIENTRY * bglUniform4ivARBProcPtr)(GLint, GLsizei, const GLint *);
extern bglUniform4ivARBProcPtr bglUniform4ivARB;
typedef void (APIENTRY * bglUniformMatrix2fvARBProcPtr)(GLint, GLsizei, GLboolean, const GLfloat *);
extern bglUniformMatrix2fvARBProcPtr bglUniformMatrix2fvARB;
typedef void (APIENTRY * bglUniformMatrix3fvARBProcPtr)(GLint, GLsizei, GLboolean, const GLfloat *);
extern bglUniformMatrix3fvARBProcPtr bglUniformMatrix3fvARB;
typedef void (APIENTRY * bglUniformMatrix4fvARBProcPtr)(GLint, GLsizei, GLboolean, const GLfloat *);
extern bglUniformMatrix4fvARBProcPtr bglUniformMatrix4fvARB;
typedef void (APIENTRY * bglGetObjectParameterfvARBProcPtr)(GLhandleARB, GLenum, GLfloat *);
extern bglGetObjectParameterfvARBProcPtr bglGetObjectParameterfvARB;
typedef void (APIENTRY * bglGetObjectParameterivARBProcPtr)(GLhandleARB, GLenum, GLint *);
extern bglGetObjectParameterivARBProcPtr bglGetObjectParameterivARB;
typedef void (APIENTRY * bglGetInfoLogARBProcPtr)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
extern bglGetInfoLogARBProcPtr bglGetInfoLogARB;
typedef void (APIENTRY * bglGetAttachedObjectsARBProcPtr)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
extern bglGetAttachedObjectsARBProcPtr bglGetAttachedObjectsARB;
typedef GLint (APIENTRY * bglGetUniformLocationARBProcPtr)(GLhandleARB, const GLcharARB *);
extern bglGetUniformLocationARBProcPtr bglGetUniformLocationARB;
typedef void (APIENTRY * bglGetActiveUniformARBProcPtr)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
extern bglGetActiveUniformARBProcPtr bglGetActiveUniformARB;
typedef void (APIENTRY * bglGetUniformfvARBProcPtr)(GLhandleARB, GLint, GLfloat *);
extern bglGetUniformfvARBProcPtr bglGetUniformfvARB;
typedef void (APIENTRY * bglGetUniformivARBProcPtr)(GLhandleARB, GLint, GLint *);
extern bglGetUniformivARBProcPtr bglGetUniformivARB;
typedef void (APIENTRY * bglGetShaderSourceARBProcPtr)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
extern bglGetShaderSourceARBProcPtr bglGetShaderSourceARB;
// Vertex Shaders
typedef void (APIENTRY * bglVertexAttrib1dARBProcPtr)(GLuint, GLdouble);
extern bglVertexAttrib1dARBProcPtr bglVertexAttrib1dARB;
typedef void (APIENTRY * bglVertexAttrib1dvARBProcPtr)(GLuint, const GLdouble *);
extern bglVertexAttrib1dvARBProcPtr bglVertexAttrib1dvARB;
typedef void (APIENTRY * bglVertexAttrib1fARBProcPtr)(GLuint, GLfloat);
extern bglVertexAttrib1fARBProcPtr bglVertexAttrib1fARB;
typedef void (APIENTRY * bglVertexAttrib1fvARBProcPtr)(GLuint, const GLfloat *);
extern bglVertexAttrib1fvARBProcPtr bglVertexAttrib1fvARB;
typedef void (APIENTRY * bglVertexAttrib1sARBProcPtr)(GLuint, GLshort);
extern bglVertexAttrib1sARBProcPtr bglVertexAttrib1sARB;
typedef void (APIENTRY * bglVertexAttrib1svARBProcPtr)(GLuint, const GLshort *);
extern bglVertexAttrib1svARBProcPtr bglVertexAttrib1svARB;
typedef void (APIENTRY * bglVertexAttrib2dARBProcPtr)(GLuint, GLdouble, GLdouble);
extern bglVertexAttrib2dARBProcPtr bglVertexAttrib2dARB;
typedef void (APIENTRY * bglVertexAttrib2dvARBProcPtr)(GLuint, const GLdouble *);
extern bglVertexAttrib2dvARBProcPtr bglVertexAttrib2dvARB;
typedef void (APIENTRY * bglVertexAttrib2fARBProcPtr)(GLuint, GLfloat, GLfloat);
extern bglVertexAttrib2fARBProcPtr bglVertexAttrib2fARB;
typedef void (APIENTRY * bglVertexAttrib2fvARBProcPtr)(GLuint, const GLfloat *);
extern bglVertexAttrib2fvARBProcPtr bglVertexAttrib2fvARB;
typedef void (APIENTRY * bglVertexAttrib2sARBProcPtr)(GLuint, GLshort, GLshort);
extern bglVertexAttrib2sARBProcPtr bglVertexAttrib2sARB;
typedef void (APIENTRY * bglVertexAttrib2svARBProcPtr)(GLuint, const GLshort *);
extern bglVertexAttrib2svARBProcPtr bglVertexAttrib2svARB;
typedef void (APIENTRY * bglVertexAttrib3dARBProcPtr)(GLuint, GLdouble, GLdouble, GLdouble);
extern bglVertexAttrib3dARBProcPtr bglVertexAttrib3dARB;
typedef void (APIENTRY * bglVertexAttrib3dvARBProcPtr)(GLuint, const GLdouble *);
extern bglVertexAttrib3dvARBProcPtr bglVertexAttrib3dvARB;
typedef void (APIENTRY * bglVertexAttrib3fARBProcPtr)(GLuint, GLfloat, GLfloat, GLfloat);
extern bglVertexAttrib3fARBProcPtr bglVertexAttrib3fARB;
typedef void (APIENTRY * bglVertexAttrib3fvARBProcPtr)(GLuint, const GLfloat *);
extern bglVertexAttrib3fvARBProcPtr bglVertexAttrib3fvARB;
typedef void (APIENTRY * bglVertexAttrib3sARBProcPtr)(GLuint, GLshort, GLshort, GLshort);
extern bglVertexAttrib3sARBProcPtr bglVertexAttrib3sARB;
typedef void (APIENTRY * bglVertexAttrib3svARBProcPtr)(GLuint, const GLshort *);
extern bglVertexAttrib3svARBProcPtr bglVertexAttrib3svARB;
typedef void (APIENTRY * bglVertexAttrib4NbvARBProcPtr)(GLuint, const GLbyte *);
extern bglVertexAttrib4NbvARBProcPtr bglVertexAttrib4NbvARB;
typedef void (APIENTRY * bglVertexAttrib4NivARBProcPtr)(GLuint, const GLint *);
extern bglVertexAttrib4NivARBProcPtr bglVertexAttrib4NivARB;
typedef void (APIENTRY * bglVertexAttrib4NsvARBProcPtr)(GLuint, const GLshort *);
extern bglVertexAttrib4NsvARBProcPtr bglVertexAttrib4NsvARB;
typedef void (APIENTRY * bglVertexAttrib4NubARBProcPtr)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte);
extern bglVertexAttrib4NubARBProcPtr bglVertexAttrib4NubARB;
typedef void (APIENTRY * bglVertexAttrib4NubvARBProcPtr)(GLuint, const GLubyte *);
extern bglVertexAttrib4NubvARBProcPtr bglVertexAttrib4NubvARB;
typedef void (APIENTRY * bglVertexAttrib4NuivARBProcPtr)(GLuint, const GLuint *);
extern bglVertexAttrib4NuivARBProcPtr bglVertexAttrib4NuivARB;
typedef void (APIENTRY * bglVertexAttrib4NusvARBProcPtr)(GLuint, const GLushort *);
extern bglVertexAttrib4NusvARBProcPtr bglVertexAttrib4NusvARB;
typedef void (APIENTRY * bglVertexAttrib4bvARBProcPtr)(GLuint, const GLbyte *);
extern bglVertexAttrib4bvARBProcPtr bglVertexAttrib4bvARB;
typedef void (APIENTRY * bglVertexAttrib4dARBProcPtr)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble);
extern bglVertexAttrib4dARBProcPtr bglVertexAttrib4dARB;
typedef void (APIENTRY * bglVertexAttrib4dvARBProcPtr)(GLuint, const GLdouble *);
extern bglVertexAttrib4dvARBProcPtr bglVertexAttrib4dvARB;
typedef void (APIENTRY * bglVertexAttrib4fARBProcPtr)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
extern bglVertexAttrib4fARBProcPtr bglVertexAttrib4fARB;
typedef void (APIENTRY * bglVertexAttrib4fvARBProcPtr)(GLuint, const GLfloat *);
extern bglVertexAttrib4fvARBProcPtr bglVertexAttrib4fvARB;
typedef void (APIENTRY * bglVertexAttrib4ivARBProcPtr)(GLuint, const GLint *);
extern bglVertexAttrib4ivARBProcPtr bglVertexAttrib4ivARB;
typedef void (APIENTRY * bglVertexAttrib4sARBProcPtr)(GLuint, GLshort, GLshort, GLshort, GLshort);
extern bglVertexAttrib4sARBProcPtr bglVertexAttrib4sARB;
typedef void (APIENTRY * bglVertexAttrib4svARBProcPtr)(GLuint, const GLshort *);
extern bglVertexAttrib4svARBProcPtr bglVertexAttrib4svARB;
typedef void (APIENTRY * bglVertexAttrib4ubvARBProcPtr)(GLuint, const GLubyte *);
extern bglVertexAttrib4ubvARBProcPtr bglVertexAttrib4ubvARB;
typedef void (APIENTRY * bglVertexAttrib4uivARBProcPtr)(GLuint, const GLuint *);
extern bglVertexAttrib4uivARBProcPtr bglVertexAttrib4uivARB;
typedef void (APIENTRY * bglVertexAttrib4usvARBProcPtr)(GLuint, const GLushort *);
extern bglVertexAttrib4usvARBProcPtr bglVertexAttrib4usvARB;
typedef void (APIENTRY * bglVertexAttribPointerARBProcPtr)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
extern bglVertexAttribPointerARBProcPtr bglVertexAttribPointerARB;
typedef void (APIENTRY * bglEnableVertexAttribArrayARBProcPtr)(GLuint);
extern bglEnableVertexAttribArrayARBProcPtr bglEnableVertexAttribArrayARB;
typedef void (APIENTRY * bglDisableVertexAttribArrayARBProcPtr)(GLuint);
extern bglDisableVertexAttribArrayARBProcPtr bglDisableVertexAttribArrayARB;
typedef void (APIENTRY * bglGetVertexAttribdvARBProcPtr)(GLuint, GLenum, GLdouble *);
extern bglGetVertexAttribdvARBProcPtr bglGetVertexAttribdvARB;
typedef void (APIENTRY * bglGetVertexAttribfvARBProcPtr)(GLuint, GLenum, GLfloat *);
extern bglGetVertexAttribfvARBProcPtr bglGetVertexAttribfvARB;
typedef void (APIENTRY * bglGetVertexAttribivARBProcPtr)(GLuint, GLenum, GLint *);
extern bglGetVertexAttribivARBProcPtr bglGetVertexAttribivARB;
typedef void (APIENTRY * bglGetVertexAttribPointervARBProcPtr)(GLuint, GLenum, GLvoid* *);
extern bglGetVertexAttribPointervARBProcPtr bglGetVertexAttribPointervARB;
typedef void (APIENTRY * bglBindAttribLocationARBProcPtr)(GLhandleARB, GLuint, const GLcharARB *);
extern bglBindAttribLocationARBProcPtr bglBindAttribLocationARB;
typedef void (APIENTRY * bglGetActiveAttribARBProcPtr)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *);
extern bglGetActiveAttribARBProcPtr bglGetActiveAttribARB;
typedef GLint (APIENTRY * bglGetAttribLocationARBProcPtr)(GLhandleARB, const GLcharARB *);
extern bglGetAttribLocationARBProcPtr bglGetAttribLocationARB;
// Debug Output
#ifndef __APPLE__
typedef void (APIENTRY * bglDebugMessageControlARBProcPtr)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
extern bglDebugMessageControlARBProcPtr bglDebugMessageControlARB;
typedef void (APIENTRY * bglDebugMessageCallbackARBProcPtr)(GLDEBUGPROCARB callback, const GLvoid *userParam);
extern bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
#endif
#ifdef _WIN32
typedef BOOL (WINAPI * bwglSwapIntervalEXTProcPtr)(int32_t);
extern bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
typedef HGLRC (WINAPI * bwglCreateContextAttribsARBProcPtr)(HDC hDC, HGLRC hShareContext, const int *attribList);
extern bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
#endif
#else
#define bglBlendEquation glBlendEquation
#define bglTexImage3D glTexImage3D
#define bglCompressedTexImage2DARB glCompressedTexImage2DARB
#define bglGetCompressedTexImageARB glGetCompressedTexImageARB
// GPU Programs
#define bglGenProgramsARB glGenProgramsARB
#define bglBindProgramARB glBindProgramARB
#define bglProgramStringARB glProgramStringARB
#define bglDeleteProgramsARB glDeleteProgramsARB;
// Multitexturing
#define bglActiveTextureARB glActiveTextureARB
#define bglClientActiveTextureARB glClientActiveTextureARB
#define bglMultiTexCoord2dARB glMultiTexCoord2dARB
#define bglMultiTexCoord2fARB glMultiTexCoord2fARB
// Frame Buffer Objects
#define bglGenFramebuffersEXT glGenFramebuffersEXT
#define bglBindFramebufferEXT glBindFramebufferEXT
#define bglFramebufferTexture2DEXT glFramebufferTexture2DEXT
#define bglCheckFramebufferStatusEXT glCheckFramebufferStatusEXT
#define bglDeleteFramebuffersEXT glDeleteFramebuffersEXT
// Vertex Buffer Objects
#define bglGenBuffersARB glGenBuffersARB
#define bglBindBufferARB glBindBufferARB
#define bglDeleteBuffersARB glDeleteBuffersARB
#define bglBufferDataARB glBufferDataARB
#define bglBufferSubDataARB glBufferSubDataARB
#define bglMapBufferARB glMapBufferARB
#define bglUnmapBufferARB glUnmapBufferARB
// Occlusion queries
#define bglGenQueriesARB glGenQueriesARB
#define bglDeleteQueriesARB glDeleteQueriesARB
#define bglIsQueryARB glIsQueryARB
#define bglBeginQueryARB glBeginQueryARB
#define bglEndQueryARB glEndQueryARB
#define bglGetQueryivARB glGetQueryivARB
#define bglGetQueryObjectivARB glGetQueryObjectivARB
#define bglGetQueryObjectuivARB glGetQueryObjectuivARB
// Shader Objects
#define bglDeleteObjectARB glDeleteObjectARB
#define bglGetHandleARB glGetHandleARB
#define bglDetachObjectARB glDetachObjectARB
#define bglCreateShaderObjectARB glCreateShaderObjectARB
#define bglShaderSourceARB glShaderSourceARB
#define bglCompileShaderARB glCompileShaderARB
#define bglCreateProgramObjectARB glCreateProgramObjectARB
#define bglAttachObjectARB glAttachObjectARB
#define bglLinkProgramARB glLinkProgramARB
#define bglUseProgramObjectARB glUseProgramObjectARB
#define bglValidateProgramARB glValidateProgramARB
#define bglUniform1fARB glUniform1fARB
#define bglUniform2fARB glUniform2fARB
#define bglUniform3fARB glUniform3fARB
#define bglUniform4fARB glUniform4fARB
#define bglUniform1iARB glUniform1iARB
#define bglUniform2iARB glUniform2iARB
#define bglUniform3iARB glUniform3iARB
#define bglUniform4iARB glUniform4iARB
#define bglUniform1fvARB glUniform1fvARB
#define bglUniform2fvARB glUniform2fvARB
#define bglUniform3fvARB glUniform3fvARB
#define bglUniform4fvARB glUniform4fvARB
#define bglUniform1ivARB glUniform1ivARB
#define bglUniform2ivARB glUniform2ivARB
#define bglUniform3ivARB glUniform3ivARB
#define bglUniform4ivARB glUniform4ivARB
#define bglUniformMatrix2fvARB glUniformMatrix2fvARB
#define bglUniformMatrix3fvARB glUniformMatrix3fvARB
#define bglUniformMatrix4fvARB glUniformMatrix4fvARB
#define bglGetObjectParameterfvARB glGetObjectParameterfvARB
#define bglGetObjectParameterivARB glGetObjectParameterivARB
#define bglGetInfoLogARB glGetInfoLogARB
#define bglGetAttachedObjectsARB glGetAttachedObjectsARB
#define bglGetUniformLocationARB glGetUniformLocationARB
#define bglGetActiveUniformARB glGetActiveUniformARB
#define bglGetUniformfvARB glGetUniformfvARB
#define bglGetUniformivARB glGetUniformivARB
#define bglGetShaderSourceARB glGetShaderSourceARB
// Vertex Shaders
#define bglVertexAttrib1dARB glVertexAttrib1dARB
#define bglVertexAttrib1dvARB glVertexAttrib1dvARB
#define bglVertexAttrib1fARB glVertexAttrib1fARB
#define bglVertexAttrib1fvARB glVertexAttrib1fvARB
#define bglVertexAttrib1sARB glVertexAttrib1sARB
#define bglVertexAttrib1svARB glVertexAttrib1svARB
#define bglVertexAttrib2dARB glVertexAttrib2dARB
#define bglVertexAttrib2dvARB glVertexAttrib2dvARB
#define bglVertexAttrib2fARB glVertexAttrib2fARB
#define bglVertexAttrib2fvARB glVertexAttrib2fvARB
#define bglVertexAttrib2sARB glVertexAttrib2sARB
#define bglVertexAttrib2svARB glVertexAttrib2svARB
#define bglVertexAttrib3dARB glVertexAttrib3dARB
#define bglVertexAttrib3dvARB glVertexAttrib3dvARB
#define bglVertexAttrib3fARB glVertexAttrib3fARB
#define bglVertexAttrib3fvARB glVertexAttrib3fvARB
#define bglVertexAttrib3sARB glVertexAttrib3sARB
#define bglVertexAttrib3svARB glVertexAttrib3svARB
#define bglVertexAttrib4NbvARB glVertexAttrib4NbvARB
#define bglVertexAttrib4NivARB glVertexAttrib4NivARB
#define bglVertexAttrib4NsvARB glVertexAttrib4NsvARB
#define bglVertexAttrib4NubARB glVertexAttrib4NubARB
#define bglVertexAttrib4NubvARB glVertexAttrib4NubvARB
#define bglVertexAttrib4NuivARB glVertexAttrib4NuivARB
#define bglVertexAttrib4NusvARB glVertexAttrib4NusvARB
#define bglVertexAttrib4bvARB glVertexAttrib4bvARB
#define bglVertexAttrib4dARB glVertexAttrib4dARB
#define bglVertexAttrib4dvARB glVertexAttrib4dvARB
#define bglVertexAttrib4fARB glVertexAttrib4fARB
#define bglVertexAttrib4fvARB glVertexAttrib4fvARB
#define bglVertexAttrib4ivARB glVertexAttrib4ivARB
#define bglVertexAttrib4sARB glVertexAttrib4sARB
#define bglVertexAttrib4svARB glVertexAttrib4svARB
#define bglVertexAttrib4ubvARB glVertexAttrib4ubvARB
#define bglVertexAttrib4uivARB glVertexAttrib4uivARB
#define bglVertexAttrib4usvARB glVertexAttrib4usvARB
#define bglVertexAttribPointerARB glVertexAttribPointerARB
#define bglEnableVertexAttribArrayARB glEnableVertexAttribArrayARB
#define bglDisableVertexAttribArrayARB glDisableVertexAttribArrayARB
#define bglGetVertexAttribdvARB glGetVertexAttribdvARB
#define bglGetVertexAttribfvARB glGetVertexAttribfvARB
#define bglGetVertexAttribivARB glGetVertexAttribivARB
#define bglGetVertexAttribPointervARB glGetVertexAttribPointervARB
#define bglBindAttribLocationARB glBindAttribLocationARB
#define bglGetActiveAttribARB glGetActiveAttribARB
#define bglGetAttribLocationARB glGetAttribLocationARB
#define wglSetPixelFormat bwglSetPixelFormat
#endif
#if defined DYNAMIC_GLU
@ -942,23 +136,22 @@ void texdbg_bglDeleteTextures(GLsizei n, const GLuint *textures, const char *src
//#define DEBUG_TEXTURE_NAMES
#if defined DEBUGGINGAIDS && defined DEBUG_TEXTURE_NAMES
# undef bglGenTextures
# undef bglDeleteTextures
# define bglGenTextures(numtexs, texnamear) texdbg_bglGenTextures(numtexs, texnamear, __FILE__)
# define bglDeleteTextures(numtexs, texnamear) texdbg_bglDeleteTextures(numtexs, texnamear, __FILE__)
# define glGenTextures(numtexs, texnamear) texdbg_bglGenTextures(numtexs, texnamear, __FILE__)
# define glDeleteTextures(numtexs, texnamear) texdbg_bglDeleteTextures(numtexs, texnamear, __FILE__)
#endif
#endif //USE_OPENGL
#ifdef _WIN32
#if !defined RENDERTYPESDL && defined _WIN32 && defined DYNAMIC_GL
extern char *gldriver;
int32_t loadwgl(const char *driver);
int32_t unloadwgl(void);
#endif
int32_t loadgldriver(const char *driver);
int32_t loadglextensions(void);
int32_t unloadgldriver(void);
#ifdef POLYMER
int32_t loadglulibrary(const char *driver);
int32_t unloadglulibrary(void);
#endif
#endif

View file

@ -5,8 +5,9 @@
# include "compat.h"
# include "baselayer.h"
# include "glbuild.h"
# include "glad/glad.h"
# include "build.h"
# include "glbuild.h"
# include "osd.h"
# include "hightile.h"
# include "mdsprite.h"
@ -124,7 +125,7 @@ typedef struct s_prmaterial {
} _prmaterial;
typedef struct s_prrograminfo {
GLhandleARB handle;
GLuint handle;
// PR_BIT_ANIM_INTERPOLATION
GLint attrib_nextFrameData;
GLint attrib_nextFrameNormal;
@ -379,7 +380,7 @@ static inline void polymer_invalidateartmap(int32_t tilenum)
{
if (prartmaps[tilenum])
{
bglDeleteTextures(1, &prartmaps[tilenum]);
glDeleteTextures(1, &prartmaps[tilenum]);
prartmaps[tilenum] = 0;
}
}
@ -458,7 +459,7 @@ void PR_CALLBACK polymer_debugoutputcallback(GLenum source,GLenum type,GLuint
#define INDICE(n) ((p->indices) ? (p->indices[(i+n)%p->indicescount]) : (((i+n)%p->vertcount)))
#define SWITCH_CULL_DIRECTION { culledface = (culledface == GL_FRONT) ? GL_BACK : GL_FRONT; bglCullFace(culledface); }
#define SWITCH_CULL_DIRECTION { culledface = (culledface == GL_FRONT) ? GL_BACK : GL_FRONT; glCullFace(culledface); }
static inline GLfloat dot2f(GLfloat *v1, GLfloat *v2)
{

View file

@ -3,7 +3,7 @@
#ifdef USE_OPENGL
#include "glbuild.h"
#include "glad/glad.h"
#include "hightile.h"
#include "baselayer.h" // glinfo

View file

@ -54,9 +54,9 @@ void plotpixel(int32_t x, int32_t y, char col)
{
palette_t p = getpal(col);
bglRasterPos4i(x, y, 0, 1);
bglDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &p);
bglRasterPos4i(0, 0, 0, 1);
glRasterPos4i(x, y, 0, 1);
glDrawPixels(1, 1, GL_RGB, GL_UNSIGNED_BYTE, &p);
glRasterPos4i(0, 0, 0, 1);
return;
}
#endif
@ -75,14 +75,14 @@ void plotlines2d(const int32_t *xx, const int32_t *yy, int32_t numpoints, int co
{
palette_t p = getpal(col);
bglBegin(GL_LINE_STRIP);
glBegin(GL_LINE_STRIP);
bglColor4ub(p.r, p.g, p.b, 1);
glColor4ub(p.r, p.g, p.b, 1);
for (i=0; i<numpoints; i++)
bglVertex2i(xx[i], yy[i]);
glVertex2i(xx[i], yy[i]);
bglEnd();
glEnd();
return;
}
#endif
@ -126,28 +126,28 @@ static void drawlinegl(int32_t x1, int32_t y1, int32_t x2, int32_t y2, palette_t
{
// setpolymost2dview(); // JBF 20040205: more efficient setup
bglViewport(0, 0, xres, yres);
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
bglOrtho(0, xres, yres, 0, -1, 1);
glViewport(0, 0, xres, yres);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, xres, yres, 0, -1, 1);
if (getrendermode() == REND_POLYMER)
{
bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
gloy1 = -1;
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_TEXTURE_2D);
bglEnable(GL_BLEND); // When using line antialiasing, this is needed
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glEnable(GL_BLEND); // When using line antialiasing, this is needed
bglBegin(GL_LINES);
bglColor4ub(p.r, p.g, p.b, 255);
bglVertex2f((float) x1 * (1.f/4096.f), (float) y1 * (1.f/4096.f));
bglVertex2f((float) x2 * (1.f/4096.f), (float) y2 * (1.f/4096.f));
glBegin(GL_LINES);
glColor4ub(p.r, p.g, p.b, 255);
glVertex2f((float) x1 * (1.f/4096.f), (float) y1 * (1.f/4096.f));
glVertex2f((float) x2 * (1.f/4096.f), (float) y2 * (1.f/4096.f));
bglEnd();
glEnd();
}
#endif
@ -1393,22 +1393,22 @@ void setpolymost2dview(void)
#ifdef USE_OPENGL
if (getrendermode() < REND_POLYMOST) return;
bglViewport(0, 0, xres, yres);
glViewport(0, 0, xres, yres);
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
bglOrtho(0, xres, yres, 0, -1, 1);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, xres, yres, 0, -1, 1);
if (getrendermode() == REND_POLYMER)
{
bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
gloy1 = -1;
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_TEXTURE_2D);
bglDisable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_BLEND);
#endif
}

View file

@ -7,7 +7,7 @@
#include "compat.h"
#include "baselayer.h"
#include "build.h"
#include "glbuild.h"
#include "glad/glad.h"
#include "cache1d.h"
#undef UNUSED
@ -406,96 +406,96 @@ void animvpx_setup_glstate(int32_t animvpx_flags)
if (glinfo.glsl)
{
GLint gli;
GLhandleARB FSHandle, PHandle;
GLuint FSHandle, PHandle;
static char logbuf[512];
// first, compile the fragment shader
/* Set up program objects. */
PHandle = bglCreateProgramObjectARB();
FSHandle = bglCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB);
PHandle = glCreateProgram();
FSHandle = glCreateShader(GL_FRAGMENT_SHADER);
/* Compile the shader. */
bglShaderSourceARB(FSHandle, 1, (const GLcharARB **)&fragprog_src, NULL);
bglCompileShaderARB(FSHandle);
glShaderSource(FSHandle, 1, (const GLchar **)&fragprog_src, NULL);
glCompileShader(FSHandle);
/* Print the compilation log. */
bglGetObjectParameterivARB(FSHandle, GL_OBJECT_COMPILE_STATUS_ARB, &gli);
bglGetInfoLogARB(FSHandle, sizeof(logbuf), NULL, logbuf);
glGetShaderiv(FSHandle, GL_COMPILE_STATUS, &gli);
glGetShaderInfoLog(FSHandle, sizeof(logbuf), NULL, logbuf);
if (logbuf[0])
OSD_Printf("animvpx compile log: %s\n", logbuf);
/* Create a complete program object. */
bglAttachObjectARB(PHandle, FSHandle);
bglLinkProgramARB(PHandle);
glAttachShader(PHandle, FSHandle);
glLinkProgram(PHandle);
/* And print the link log. */
bglGetInfoLogARB(PHandle, sizeof(logbuf), NULL, logbuf);
glGetProgramInfoLog(PHandle, sizeof(logbuf), NULL, logbuf);
if (logbuf[0])
OSD_Printf("animvpx link log: %s\n", logbuf);
/* Finally, use the program. */
bglUseProgramObjectARB(PHandle);
glUseProgram(PHandle);
}
#endif
////////// GL STATE //////////
//Force fullscreen (glox1=-1 forces it to restore afterwards)
bglViewport(0,0,xdim,ydim); glox1 = -1;
glViewport(0,0,xdim,ydim); glox1 = -1;
bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
bglMatrixMode(GL_PROJECTION);
bglLoadIdentity();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
// bglPushAttrib(GL_ENABLE_BIT);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_BLEND);
bglDisable(GL_CULL_FACE);
bglEnable(GL_TEXTURE_2D);
// glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_ALPHA_TEST);
glDisable(GL_DEPTH_TEST);
glDisable(GL_BLEND);
glDisable(GL_CULL_FACE);
glEnable(GL_TEXTURE_2D);
#ifdef USE_GLEXT
bglActiveTextureARB(GL_TEXTURE0_ARB);
glActiveTexture(GL_TEXTURE0);
#endif
bglGenTextures(1, &texname);
bglBindTexture(GL_TEXTURE_2D, texname);
glGenTextures(1, &texname);
glBindTexture(GL_TEXTURE_2D, texname);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glinfo.clamptoedge?GL_CLAMP_TO_EDGE:GL_CLAMP);
if ((animvpx_flags & CUTSCENE_TEXTUREFILTER && gltexfiltermode == TEXFILTER_ON) || animvpx_flags & CUTSCENE_FORCEFILTER ||
(!(animvpx_flags & CUTSCENE_TEXTUREFILTER) && !(animvpx_flags & CUTSCENE_FORCENOFILTER))) // if no flags, then use filter for IVFs
{
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
}
else
{
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
texuploaded = 0;
////////////////////
bglClearColor(0.0,0.0,0.0,1.0);
bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glClearColor(0.0,0.0,0.0,1.0);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
void animvpx_restore_glstate(void)
{
#ifdef USE_GLEXT
if (glinfo.glsl)
bglUseProgramObjectARB(0);
glUseProgram(0);
#endif
// bglPopAttrib();
// glPopAttrib();
bglDeleteTextures(1, &texname);
glDeleteTextures(1, &texname);
texname = 0;
texuploaded = 0;
}
@ -514,16 +514,16 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
if (!texuploaded)
{
bglTexImage2D(GL_TEXTURE_2D, 0, fmt, codec->width,codec->height,
glTexImage2D(GL_TEXTURE_2D, 0, fmt, codec->width,codec->height,
0, fmt, GL_UNSIGNED_BYTE, codec->pic);
if (bglGetError() != GL_NO_ERROR) return 1;
if (glGetError() != GL_NO_ERROR) return 1;
texuploaded = 1;
}
else
{
bglTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, codec->width,codec->height,
glTexSubImage2D(GL_TEXTURE_2D, 0, 0,0, codec->width,codec->height,
fmt, GL_UNSIGNED_BYTE, codec->pic);
if (bglGetError() != GL_NO_ERROR) return 1;
if (glGetError() != GL_NO_ERROR) return 1;
}
float vid_wbyh = ((float)codec->width)/codec->height;
@ -543,24 +543,24 @@ int32_t animvpx_render_frame(animvpx_codec_ctx *codec, double animvpx_aspect)
y = scr_wbyh/vid_wbyh;
}
#endif
bglBegin(GL_QUADS);
glBegin(GL_QUADS);
if (!glinfo.glsl)
bglColor3f(1.0, 1.0, 1.0);
glColor3f(1.0, 1.0, 1.0);
bglTexCoord2f(0.0,1.0);
bglVertex3f(-x, -y, 0.0);
glTexCoord2f(0.0,1.0);
glVertex3f(-x, -y, 0.0);
bglTexCoord2f(0.0,0.0);
bglVertex3f(-x, y, 0.0);
glTexCoord2f(0.0,0.0);
glVertex3f(-x, y, 0.0);
bglTexCoord2f(1.0,0.0);
bglVertex3f(x, y, 0.0);
glTexCoord2f(1.0,0.0);
glVertex3f(x, y, 0.0);
bglTexCoord2f(1.0,1.0);
bglVertex3f(x, -y, 0.0);
glTexCoord2f(1.0,1.0);
glVertex3f(x, -y, 0.0);
bglEnd();
glEnd();
t = getticks()-t;
codec->sumtimes[2] += t;

View file

@ -255,31 +255,31 @@ extern int32_t nofog;
void fullscreen_tint_gl(uint8_t r, uint8_t g, uint8_t b, uint8_t f)
{
bglMatrixMode(GL_PROJECTION);
bglPushMatrix();
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglPushMatrix();
bglLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
bglDisable(GL_DEPTH_TEST);
bglDisable(GL_ALPHA_TEST);
bglDisable(GL_TEXTURE_2D);
bglDisable(GL_FOG);
glDisable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glDisable(GL_TEXTURE_2D);
glDisable(GL_FOG);
bglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bglEnable(GL_BLEND);
bglColor4ub(r, g, b, f);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
glColor4ub(r, g, b, f);
bglBegin(GL_TRIANGLES);
bglVertex2f(-2.5f, 1.f);
bglVertex2f(2.5f, 1.f);
bglVertex2f(.0f, -2.5f);
bglEnd();
glBegin(GL_TRIANGLES);
glVertex2f(-2.5f, 1.f);
glVertex2f(2.5f, 1.f);
glVertex2f(.0f, -2.5f);
glEnd();
bglPopMatrix();
bglMatrixMode(GL_PROJECTION);
bglPopMatrix();
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glPopMatrix();
}
struct glinfo_t glinfo =

View file

@ -252,18 +252,18 @@ void COMMON_clearbackground(int32_t numcols, int32_t numrows)
# ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && qsetmode==200)
{
// bglPushAttrib(GL_FOG_BIT);
bglDisable(GL_FOG);
// glPushAttrib(GL_FOG_BIT);
glDisable(GL_FOG);
setpolymost2dview();
bglColor4f(0.f, 0.f, 0.f, 0.67f);
bglEnable(GL_BLEND);
bglRecti(0, 0, xdim, 8*numrows+8);
bglColor4f(0.f, 0.f, 0.f, 1.f);
bglRecti(0, 8*numrows+4, xdim, 8*numrows+8);
glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND);
glRecti(0, 0, xdim, 8*numrows+8);
glColor4f(0.f, 0.f, 0.f, 1.f);
glRecti(0, 8*numrows+4, xdim, 8*numrows+8);
// bglPopAttrib();
bglEnable(GL_FOG);
// glPopAttrib();
glEnable(GL_FOG);
return;
}

View file

@ -22,7 +22,7 @@
#include "scriptfile.h"
#ifdef USE_OPENGL
# include "glbuild.h"
# include "glad/glad.h"
# include "mdsprite.h"
# ifdef POLYMER
# include "polymer.h"
@ -1028,7 +1028,7 @@ void yax_drawrooms(void (*SpriteAnimFunc)(int32_t,int32_t,int32_t,int32_t),
#ifdef USE_OPENGL
else
{
bglClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
}
#endif
}
@ -5800,17 +5800,17 @@ static void drawsprite(int32_t snum)
#ifdef USE_OPENGL
case REND_POLYMOST:
polymost_drawsprite(snum);
bglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// bglDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// glDepthRange(0.0, 1.0); //<- this is more widely supported than glPolygonOffset
return;
# ifdef POLYMER
case REND_POLYMER:
bglEnable(GL_ALPHA_TEST);
bglEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
polymer_drawsprite(snum);
bglDisable(GL_BLEND);
bglDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
return;
# endif
#endif
@ -5829,13 +5829,13 @@ static void drawmaskwall(int16_t damaskwallcnt)
# ifdef POLYMER
if (getrendermode() == REND_POLYMER)
{
bglEnable(GL_ALPHA_TEST);
bglEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glEnable(GL_BLEND);
polymer_drawmaskwall(damaskwallcnt);
bglDisable(GL_BLEND);
bglDisable(GL_ALPHA_TEST);
glDisable(GL_BLEND);
glDisable(GL_ALPHA_TEST);
return;
}
@ -8013,7 +8013,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
# endif
polymer_glinit();
polymer_drawrooms(daposx, daposy, daposz, daang, dahoriz, dacursectnum);
bglDisable(GL_CULL_FACE);
glDisable(GL_CULL_FACE);
gloy1 = 0;
return 0;
}
@ -8592,7 +8592,7 @@ killsprite:
#ifdef USE_OPENGL
if (getrendermode() == REND_POLYMOST)
{
bglDepthMask(GL_FALSE);
glDepthMask(GL_FALSE);
while (spritesortcnt)
{
@ -8605,7 +8605,7 @@ killsprite:
}
}
bglDepthMask(GL_TRUE);
glDepthMask(GL_TRUE);
}
#endif
spritesortcnt = 0;
@ -12215,11 +12215,11 @@ void clearview(int32_t dacol)
{
palette_t const p = getpal(dacol);
bglClearColor((float)p.r * (1.f/255.f),
glClearColor((float)p.r * (1.f/255.f),
(float)p.g * (1.f/255.f),
(float)p.b * (1.f/255.f),
0);
bglClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT);
return;
}
#endif
@ -12253,12 +12253,12 @@ void clearallviews(int32_t dacol)
{
palette_t const p = getpal(dacol);
bglViewport(0,0,xdim,ydim); glox1 = -1;
bglClearColor((float)p.r * (1.f/255.f),
glViewport(0,0,xdim,ydim); glox1 = -1;
glClearColor((float)p.r * (1.f/255.f),
(float)p.g * (1.f/255.f),
(float)p.b * (1.f/255.f),
0);
bglClear(GL_COLOR_BUFFER_BIT);
glClear(GL_COLOR_BUFFER_BIT);
return;
}
#endif
@ -12947,10 +12947,10 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
palette_t p=getpal(col), b=getpal(backcol);
setpolymost2dview();
bglDisable(GL_ALPHA_TEST);
bglDepthMask(GL_FALSE); // disable writing to the z-buffer
glDisable(GL_ALPHA_TEST);
glDepthMask(GL_FALSE); // disable writing to the z-buffer
bglBegin(GL_POINTS);
glBegin(GL_POINTS);
for (i=0; name[i]; i++)
{
@ -12983,16 +12983,16 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
if (letptr[y]&pow2char[7-fontsize-x])
{
if (lc!=col)
bglColor4ub(p.r,p.g,p.b,255);
glColor4ub(p.r,p.g,p.b,255);
lc = col;
bglVertex2i(xx+x,yy);
glVertex2i(xx+x,yy);
}
else if (backcol >= 0)
{
if (lc!=backcol)
bglColor4ub(b.r,b.g,b.b,255);
glColor4ub(b.r,b.g,b.b,255);
lc = backcol;
bglVertex2i(xx+x,yy);
glVertex2i(xx+x,yy);
}
}
yy--;
@ -13000,8 +13000,8 @@ void printext256(int32_t xpos, int32_t ypos, int16_t col, int16_t backcol, const
stx += charxsiz;
}
bglEnd();
bglDepthMask(GL_TRUE); // re-enable writing to the z-buffer
glEnd();
glDepthMask(GL_TRUE); // re-enable writing to the z-buffer
return;
}

View file

@ -1,4 +1,5 @@
#include "compat.h"
#include "glad/glad.h"
#include "glbuild.h"
#include "baselayer.h"
@ -12,7 +13,7 @@ GLenum BuildGLError;
void BuildGLErrorCheck(void)
{
volatile GLenum err;
while ((err = bglGetError()) != GL_NO_ERROR)
while ((err = glGetError()) != GL_NO_ERROR)
{
BuildGLError = err; // set a watchpoint/breakpoint here
}
@ -20,286 +21,18 @@ void BuildGLErrorCheck(void)
#if defined DYNAMIC_GL
#ifdef _WIN32
#if !defined RENDERTYPESDL && defined _WIN32
bwglCreateContextProcPtr bwglCreateContext;
bwglDeleteContextProcPtr bwglDeleteContext;
bwglGetProcAddressProcPtr bwglGetProcAddress;
bwglMakeCurrentProcPtr bwglMakeCurrent;
bwglSwapBuffersProcPtr bwglSwapBuffers;
bwglChoosePixelFormatProcPtr bwglChoosePixelFormat;
bwglDescribePixelFormatProcPtr bwglDescribePixelFormat;
bwglGetPixelFormatProcPtr bwglGetPixelFormat;
bwglSetPixelFormatProcPtr bwglSetPixelFormat;
#endif
bglClearColorProcPtr bglClearColor;
bglClearProcPtr bglClear;
bglColorMaskProcPtr bglColorMask;
bglAlphaFuncProcPtr bglAlphaFunc;
bglBlendFuncProcPtr bglBlendFunc;
bglCullFaceProcPtr bglCullFace;
bglFrontFaceProcPtr bglFrontFace;
bglPolygonOffsetProcPtr bglPolygonOffset;
bglPolygonModeProcPtr bglPolygonMode;
bglEnableProcPtr bglEnable;
bglDisableProcPtr bglDisable;
bglGetDoublevProcPtr bglGetDoublev;
bglGetFloatvProcPtr bglGetFloatv;
bglGetIntegervProcPtr bglGetIntegerv;
bglPushAttribProcPtr bglPushAttrib;
bglPopAttribProcPtr bglPopAttrib;
bglGetErrorProcPtr bglGetError;
bglGetStringProcPtr bglGetString;
bglHintProcPtr bglHint;
bglDrawBufferProcPtr bglDrawBuffer;
bglReadBufferProcPtr bglReadBuffer;
bglScissorProcPtr bglScissor;
bglClipPlaneProcPtr bglClipPlane;
// Depth
bglDepthFuncProcPtr bglDepthFunc;
bglDepthMaskProcPtr bglDepthMask;
//bglDepthRangeProcPtr bglDepthRange;
// Matrix
bglMatrixModeProcPtr bglMatrixMode;
bglOrthoProcPtr bglOrtho;
bglFrustumProcPtr bglFrustum;
bglViewportProcPtr bglViewport;
bglPushMatrixProcPtr bglPushMatrix;
bglPopMatrixProcPtr bglPopMatrix;
bglLoadIdentityProcPtr bglLoadIdentity;
bglLoadMatrixfProcPtr bglLoadMatrixf;
bglLoadMatrixdProcPtr bglLoadMatrixd;
bglMultMatrixfProcPtr bglMultMatrixf;
bglMultMatrixdProcPtr bglMultMatrixd;
bglRotatefProcPtr bglRotatef;
bglScalefProcPtr bglScalef;
bglTranslatefProcPtr bglTranslatef;
// Drawing
bglBeginProcPtr bglBegin;
bglEndProcPtr bglEnd;
bglVertex2fProcPtr bglVertex2f;
bglVertex2iProcPtr bglVertex2i;
bglVertex3fProcPtr bglVertex3f;
bglVertex3dProcPtr bglVertex3d;
bglVertex3fvProcPtr bglVertex3fv;
bglVertex3dvProcPtr bglVertex3dv;
bglRectiProcPtr bglRecti;
bglColor3fProcPtr bglColor3f;
bglColor4fProcPtr bglColor4f;
bglColor4ubProcPtr bglColor4ub;
bglTexCoord2dProcPtr bglTexCoord2d;
bglTexCoord2fProcPtr bglTexCoord2f;
bglTexCoord2iProcPtr bglTexCoord2i;
bglNormal3fProcPtr bglNormal3f;
// Lighting
bglShadeModelProcPtr bglShadeModel;
bglLightfvProcPtr bglLightfv;
// Raster funcs
bglReadPixelsProcPtr bglReadPixels;
bglRasterPos4iProcPtr bglRasterPos4i;
bglDrawPixelsProcPtr bglDrawPixels;
bglPixelStoreiProcPtr bglPixelStorei;
// Texture mapping
bglTexEnvfProcPtr bglTexEnvf;
bglGenTexturesProcPtr bglGenTextures;
bglDeleteTexturesProcPtr bglDeleteTextures;
bglBindTextureProcPtr bglBindTexture;
bglTexImage2DProcPtr bglTexImage2D;
bglCopyTexImage2DProcPtr bglCopyTexImage2D;
bglCopyTexSubImage2DProcPtr bglCopyTexSubImage2D;
bglTexSubImage2DProcPtr bglTexSubImage2D;
bglTexParameterfProcPtr bglTexParameterf;
bglTexParameteriProcPtr bglTexParameteri;
bglGetTexParameterivProcPtr bglGetTexParameteriv;
bglGetTexLevelParameterivProcPtr bglGetTexLevelParameteriv;
bglTexGenfvProcPtr bglTexGenfv;
// Fog
bglFogfProcPtr bglFogf;
bglFogiProcPtr bglFogi;
bglFogfvProcPtr bglFogfv;
// Display Lists
bglNewListProcPtr bglNewList;
bglEndListProcPtr bglEndList;
bglCallListProcPtr bglCallList;
bglDeleteListsProcPtr bglDeleteLists;
// Vertex Arrays
bglEnableClientStateProcPtr bglEnableClientState;
bglDisableClientStateProcPtr bglDisableClientState;
bglVertexPointerProcPtr bglVertexPointer;
bglNormalPointerProcPtr bglNormalPointer;
bglTexCoordPointerProcPtr bglTexCoordPointer;
bglDrawArraysProcPtr bglDrawArrays;
bglDrawElementsProcPtr bglDrawElements;
// Stencil Buffer
bglClearStencilProcPtr bglClearStencil;
bglStencilOpProcPtr bglStencilOp;
bglStencilFuncProcPtr bglStencilFunc;
#endif
#if defined DYNAMIC_GLEXT
bglBlendEquationProcPtr bglBlendEquation;
bglTexImage3DProcPtr bglTexImage3D;
bglCompressedTexImage2DARBProcPtr bglCompressedTexImage2DARB;
bglGetCompressedTexImageARBProcPtr bglGetCompressedTexImageARB;
// GPU Programs
bglGenProgramsARBProcPtr bglGenProgramsARB;
bglBindProgramARBProcPtr bglBindProgramARB;
bglProgramStringARBProcPtr bglProgramStringARB;
bglDeleteProgramsARBProcPtr bglDeleteProgramsARB;
// Multitexturing
bglActiveTextureARBProcPtr bglActiveTextureARB;
bglClientActiveTextureARBProcPtr bglClientActiveTextureARB;
bglMultiTexCoord2dARBProcPtr bglMultiTexCoord2dARB;
bglMultiTexCoord2fARBProcPtr bglMultiTexCoord2fARB;
// Frame Buffer Objects
bglGenFramebuffersEXTProcPtr bglGenFramebuffersEXT;
bglBindFramebufferEXTProcPtr bglBindFramebufferEXT;
bglFramebufferTexture2DEXTProcPtr bglFramebufferTexture2DEXT;
bglCheckFramebufferStatusEXTProcPtr bglCheckFramebufferStatusEXT;
bglDeleteFramebuffersEXTProcPtr bglDeleteFramebuffersEXT;
// Vertex Buffer Objects
bglGenBuffersARBProcPtr bglGenBuffersARB;
bglBindBufferARBProcPtr bglBindBufferARB;
bglDeleteBuffersARBProcPtr bglDeleteBuffersARB;
bglBufferDataARBProcPtr bglBufferDataARB;
bglBufferSubDataARBProcPtr bglBufferSubDataARB;
bglMapBufferARBProcPtr bglMapBufferARB;
bglUnmapBufferARBProcPtr bglUnmapBufferARB;
// ARB_buffer_storage
bglBufferStorageProcPtr bglBufferStorage;
// ARB_map_buffer_range
bglMapBufferRangeProcPtr bglMapBufferRange;
// Occlusion queries
bglGenQueriesARBProcPtr bglGenQueriesARB;
bglDeleteQueriesARBProcPtr bglDeleteQueriesARB;
bglIsQueryARBProcPtr bglIsQueryARB;
bglBeginQueryARBProcPtr bglBeginQueryARB;
bglEndQueryARBProcPtr bglEndQueryARB;
bglGetQueryivARBProcPtr bglGetQueryivARB;
bglGetQueryObjectivARBProcPtr bglGetQueryObjectivARB;
bglGetQueryObjectuivARBProcPtr bglGetQueryObjectuivARB;
// Shader Objects
bglDeleteObjectARBProcPtr bglDeleteObjectARB;
bglGetHandleARBProcPtr bglGetHandleARB;
bglDetachObjectARBProcPtr bglDetachObjectARB;
bglCreateShaderObjectARBProcPtr bglCreateShaderObjectARB;
bglShaderSourceARBProcPtr bglShaderSourceARB;
bglCompileShaderARBProcPtr bglCompileShaderARB;
bglCreateProgramObjectARBProcPtr bglCreateProgramObjectARB;
bglAttachObjectARBProcPtr bglAttachObjectARB;
bglLinkProgramARBProcPtr bglLinkProgramARB;
bglUseProgramObjectARBProcPtr bglUseProgramObjectARB;
bglValidateProgramARBProcPtr bglValidateProgramARB;
bglUniform1fARBProcPtr bglUniform1fARB;
bglUniform2fARBProcPtr bglUniform2fARB;
bglUniform3fARBProcPtr bglUniform3fARB;
bglUniform4fARBProcPtr bglUniform4fARB;
bglUniform1iARBProcPtr bglUniform1iARB;
bglUniform2iARBProcPtr bglUniform2iARB;
bglUniform3iARBProcPtr bglUniform3iARB;
bglUniform4iARBProcPtr bglUniform4iARB;
bglUniform1fvARBProcPtr bglUniform1fvARB;
bglUniform2fvARBProcPtr bglUniform2fvARB;
bglUniform3fvARBProcPtr bglUniform3fvARB;
bglUniform4fvARBProcPtr bglUniform4fvARB;
bglUniform1ivARBProcPtr bglUniform1ivARB;
bglUniform2ivARBProcPtr bglUniform2ivARB;
bglUniform3ivARBProcPtr bglUniform3ivARB;
bglUniform4ivARBProcPtr bglUniform4ivARB;
bglUniformMatrix2fvARBProcPtr bglUniformMatrix2fvARB;
bglUniformMatrix3fvARBProcPtr bglUniformMatrix3fvARB;
bglUniformMatrix4fvARBProcPtr bglUniformMatrix4fvARB;
bglGetObjectParameterfvARBProcPtr bglGetObjectParameterfvARB;
bglGetObjectParameterivARBProcPtr bglGetObjectParameterivARB;
bglGetInfoLogARBProcPtr bglGetInfoLogARB;
bglGetAttachedObjectsARBProcPtr bglGetAttachedObjectsARB;
bglGetUniformLocationARBProcPtr bglGetUniformLocationARB;
bglGetActiveUniformARBProcPtr bglGetActiveUniformARB;
bglGetUniformfvARBProcPtr bglGetUniformfvARB;
bglGetUniformivARBProcPtr bglGetUniformivARB;
bglGetShaderSourceARBProcPtr bglGetShaderSourceARB;
// Vertex Shaders
bglVertexAttrib1dARBProcPtr bglVertexAttrib1dARB;
bglVertexAttrib1dvARBProcPtr bglVertexAttrib1dvARB;
bglVertexAttrib1fARBProcPtr bglVertexAttrib1fARB;
bglVertexAttrib1fvARBProcPtr bglVertexAttrib1fvARB;
bglVertexAttrib1sARBProcPtr bglVertexAttrib1sARB;
bglVertexAttrib1svARBProcPtr bglVertexAttrib1svARB;
bglVertexAttrib2dARBProcPtr bglVertexAttrib2dARB;
bglVertexAttrib2dvARBProcPtr bglVertexAttrib2dvARB;
bglVertexAttrib2fARBProcPtr bglVertexAttrib2fARB;
bglVertexAttrib2fvARBProcPtr bglVertexAttrib2fvARB;
bglVertexAttrib2sARBProcPtr bglVertexAttrib2sARB;
bglVertexAttrib2svARBProcPtr bglVertexAttrib2svARB;
bglVertexAttrib3dARBProcPtr bglVertexAttrib3dARB;
bglVertexAttrib3dvARBProcPtr bglVertexAttrib3dvARB;
bglVertexAttrib3fARBProcPtr bglVertexAttrib3fARB;
bglVertexAttrib3fvARBProcPtr bglVertexAttrib3fvARB;
bglVertexAttrib3sARBProcPtr bglVertexAttrib3sARB;
bglVertexAttrib3svARBProcPtr bglVertexAttrib3svARB;
bglVertexAttrib4NbvARBProcPtr bglVertexAttrib4NbvARB;
bglVertexAttrib4NivARBProcPtr bglVertexAttrib4NivARB;
bglVertexAttrib4NsvARBProcPtr bglVertexAttrib4NsvARB;
bglVertexAttrib4NubARBProcPtr bglVertexAttrib4NubARB;
bglVertexAttrib4NubvARBProcPtr bglVertexAttrib4NubvARB;
bglVertexAttrib4NuivARBProcPtr bglVertexAttrib4NuivARB;
bglVertexAttrib4NusvARBProcPtr bglVertexAttrib4NusvARB;
bglVertexAttrib4bvARBProcPtr bglVertexAttrib4bvARB;
bglVertexAttrib4dARBProcPtr bglVertexAttrib4dARB;
bglVertexAttrib4dvARBProcPtr bglVertexAttrib4dvARB;
bglVertexAttrib4fARBProcPtr bglVertexAttrib4fARB;
bglVertexAttrib4fvARBProcPtr bglVertexAttrib4fvARB;
bglVertexAttrib4ivARBProcPtr bglVertexAttrib4ivARB;
bglVertexAttrib4sARBProcPtr bglVertexAttrib4sARB;
bglVertexAttrib4svARBProcPtr bglVertexAttrib4svARB;
bglVertexAttrib4ubvARBProcPtr bglVertexAttrib4ubvARB;
bglVertexAttrib4uivARBProcPtr bglVertexAttrib4uivARB;
bglVertexAttrib4usvARBProcPtr bglVertexAttrib4usvARB;
bglVertexAttribPointerARBProcPtr bglVertexAttribPointerARB;
bglEnableVertexAttribArrayARBProcPtr bglEnableVertexAttribArrayARB;
bglDisableVertexAttribArrayARBProcPtr bglDisableVertexAttribArrayARB;
bglGetVertexAttribdvARBProcPtr bglGetVertexAttribdvARB;
bglGetVertexAttribfvARBProcPtr bglGetVertexAttribfvARB;
bglGetVertexAttribivARBProcPtr bglGetVertexAttribivARB;
bglGetVertexAttribPointervARBProcPtr bglGetVertexAttribPointervARB;
bglBindAttribLocationARBProcPtr bglBindAttribLocationARB;
bglGetActiveAttribARBProcPtr bglGetActiveAttribARB;
bglGetAttribLocationARBProcPtr bglGetAttribLocationARB;
// Debug Output
#ifndef __APPLE__
bglDebugMessageControlARBProcPtr bglDebugMessageControlARB;
bglDebugMessageCallbackARBProcPtr bglDebugMessageCallbackARB;
#endif
#ifdef _WIN32
bwglSwapIntervalEXTProcPtr bwglSwapIntervalEXT;
bwglCreateContextAttribsARBProcPtr bwglCreateContextAttribsARB;
#endif
#endif
#if defined DYNAMIC_GLU
@ -325,7 +58,6 @@ bgluUnProjectProcPtr bgluUnProject;
#endif
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT || defined DYNAMIC_GLU
# if !defined _WIN32
# include <dlfcn.h>
@ -336,7 +68,6 @@ bgluUnProjectProcPtr bgluUnProject;
#if !defined RENDERTYPESDL && defined _WIN32
static HMODULE hGLDLL;
#endif
char *gldriver = NULL;
@ -360,665 +91,63 @@ static void *getproc_(const char *s, int32_t *err, int32_t fatal, int32_t extens
return t;
}
#define GETPROC(s) getproc_(s,&err,1,0)
#define GETPROCSOFT(s) getproc_(s,&err,0,0)
#define GETPROCEXT(s) getproc_(s,&err,1,1)
#define GETPROCEXTSOFT(s) getproc_(s,&err,0,1)
#endif
int32_t loadgldriver(const char *driver)
int32_t loadwgl(const char *driver)
{
#if defined EDUKE32_GLES
jwzgles_reset();
#endif
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
int32_t err=0;
#if !defined RENDERTYPESDL && defined _WIN32
if (hGLDLL) return 0;
#endif
if (!driver)
{
#ifdef _WIN32
driver = "opengl32.dll";
#elif defined EDUKE32_OSX
driver = "/System/Library/Frameworks/OpenGL.framework/OpenGL";
#elif defined __OpenBSD__
driver = "libGL.so";
#else
driver = "libGL.so.1";
#endif
}
#if defined RENDERTYPESDL && !defined EDUKE32_IOS
if (SDL_GL_LoadLibrary(driver))
{
initprintf("Failed loading \"%s\": %s\n", driver, SDL_GetError());
return -1;
}
#elif defined _WIN32
hGLDLL = LoadLibrary(driver);
if (!hGLDLL)
{
initprintf("Failed loading \"%s\"\n", driver);
return -1;
}
#endif
gldriver = Bstrdup(driver);
#endif
#if defined DYNAMIC_GL
#ifdef _WIN32
gldriver = Bstrdup(driver);
bwglCreateContext = (bwglCreateContextProcPtr) GETPROC("wglCreateContext");
bwglDeleteContext = (bwglDeleteContextProcPtr) GETPROC("wglDeleteContext");
bwglGetProcAddress = (bwglGetProcAddressProcPtr) GETPROC("wglGetProcAddress");
bwglMakeCurrent = (bwglMakeCurrentProcPtr) GETPROC("wglMakeCurrent");
bwglSwapBuffers = (bwglSwapBuffersProcPtr) GETPROC("wglSwapBuffers");
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) GETPROC("wglChoosePixelFormat");
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) GETPROC("wglDescribePixelFormat");
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) GETPROC("wglGetPixelFormat");
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) GETPROC("wglSetPixelFormat");
#endif
bglClearColor = (bglClearColorProcPtr) GETPROC("glClearColor");
bglClear = (bglClearProcPtr) GETPROC("glClear");
bglColorMask = (bglColorMaskProcPtr) GETPROC("glColorMask");
bglAlphaFunc = (bglAlphaFuncProcPtr) GETPROC("glAlphaFunc");
bglBlendFunc = (bglBlendFuncProcPtr) GETPROC("glBlendFunc");
bglCullFace = (bglCullFaceProcPtr) GETPROC("glCullFace");
bglFrontFace = (bglFrontFaceProcPtr) GETPROC("glFrontFace");
bglPolygonOffset = (bglPolygonOffsetProcPtr) GETPROC("glPolygonOffset");
bglPolygonMode = (bglPolygonModeProcPtr) GETPROC("glPolygonMode");
bglEnable = (bglEnableProcPtr) GETPROC("glEnable");
bglDisable = (bglDisableProcPtr) GETPROC("glDisable");
bglGetDoublev = (bglGetDoublevProcPtr) GETPROC("glGetDoublev");
bglGetFloatv = (bglGetFloatvProcPtr) GETPROC("glGetFloatv");
bglGetIntegerv = (bglGetIntegervProcPtr) GETPROC("glGetIntegerv");
bglPushAttrib = (bglPushAttribProcPtr) GETPROC("glPushAttrib");
bglPopAttrib = (bglPopAttribProcPtr) GETPROC("glPopAttrib");
bglGetError = (bglGetErrorProcPtr) GETPROC("glGetError");
bglGetString = (bglGetStringProcPtr) GETPROC("glGetString");
bglHint = (bglHintProcPtr) GETPROC("glHint");
bglDrawBuffer = (bglDrawBufferProcPtr) GETPROC("glDrawBuffer");
bglReadBuffer = (bglReadBufferProcPtr) GETPROC("glDrawBuffer");
bglScissor = (bglScissorProcPtr) GETPROC("glScissor");
bglClipPlane = (bglClipPlaneProcPtr) GETPROC("glClipPlane");
// Depth
bglDepthFunc = (bglDepthFuncProcPtr) GETPROC("glDepthFunc");
bglDepthMask = (bglDepthMaskProcPtr) GETPROC("glDepthMask");
// bglDepthRange = (bglDepthRangeProcPtr) GETPROC("glDepthRange");
// Matrix
bglMatrixMode = (bglMatrixModeProcPtr) GETPROC("glMatrixMode");
bglOrtho = (bglOrthoProcPtr) GETPROC("glOrtho");
bglFrustum = (bglFrustumProcPtr) GETPROC("glFrustum");
bglViewport = (bglViewportProcPtr) GETPROC("glViewport");
bglPushMatrix = (bglPushMatrixProcPtr) GETPROC("glPushMatrix");
bglPopMatrix = (bglPopMatrixProcPtr) GETPROC("glPopMatrix");
bglLoadIdentity = (bglLoadIdentityProcPtr) GETPROC("glLoadIdentity");
bglLoadMatrixf = (bglLoadMatrixfProcPtr) GETPROC("glLoadMatrixf");
bglLoadMatrixd = (bglLoadMatrixdProcPtr) GETPROC("glLoadMatrixd");
bglMultMatrixf = (bglMultMatrixfProcPtr) GETPROC("glMultMatrixf");
bglMultMatrixd = (bglMultMatrixdProcPtr) GETPROC("glMultMatrixd");
bglRotatef = (bglRotatefProcPtr) GETPROC("glRotatef");
bglScalef = (bglScalefProcPtr) GETPROC("glScalef");
bglTranslatef = (bglTranslatefProcPtr) GETPROC("glTranslatef");
// Drawing
bglBegin = (bglBeginProcPtr) GETPROC("glBegin");
bglEnd = (bglEndProcPtr) GETPROC("glEnd");
bglVertex2f = (bglVertex2fProcPtr) GETPROC("glVertex2f");
bglVertex2i = (bglVertex2iProcPtr) GETPROC("glVertex2i");
bglVertex3f = (bglVertex3fProcPtr) GETPROC("glVertex3f");
bglVertex3d = (bglVertex3dProcPtr) GETPROC("glVertex3d");
bglVertex3fv = (bglVertex3fvProcPtr) GETPROC("glVertex3fv");
bglVertex3dv = (bglVertex3dvProcPtr) GETPROC("glVertex3dv");
bglRecti = (bglRectiProcPtr) GETPROC("glRecti");
bglColor3f = (bglColor3fProcPtr) GETPROC("glColor3f");
bglColor4f = (bglColor4fProcPtr) GETPROC("glColor4f");
bglColor4ub = (bglColor4ubProcPtr) GETPROC("glColor4ub");
bglTexCoord2d = (bglTexCoord2dProcPtr) GETPROC("glTexCoord2d");
bglTexCoord2f = (bglTexCoord2fProcPtr) GETPROC("glTexCoord2f");
bglTexCoord2i = (bglTexCoord2iProcPtr) GETPROC("glTexCoord2i");
bglNormal3f = (bglNormal3fProcPtr) GETPROC("glNormal3f");
// Lighting
bglShadeModel = (bglShadeModelProcPtr) GETPROC("glShadeModel");
bglLightfv = (bglLightfvProcPtr) GETPROC("glLightfv");
// Raster funcs
bglReadPixels = (bglReadPixelsProcPtr) GETPROC("glReadPixels");
bglRasterPos4i = (bglRasterPos4iProcPtr) GETPROC("glRasterPos4i");
bglDrawPixels = (bglDrawPixelsProcPtr) GETPROC("glDrawPixels");
bglPixelStorei = (bglPixelStoreiProcPtr) GETPROC("glPixelStorei");
// Texture mapping
bglTexEnvf = (bglTexEnvfProcPtr) GETPROC("glTexEnvf");
bglGenTextures = (bglGenTexturesProcPtr) GETPROC("glGenTextures");
bglDeleteTextures = (bglDeleteTexturesProcPtr) GETPROC("glDeleteTextures");
bglBindTexture = (bglBindTextureProcPtr) GETPROC("glBindTexture");
bglTexImage2D = (bglTexImage2DProcPtr) GETPROC("glTexImage2D");
bglCopyTexImage2D = (bglCopyTexImage2DProcPtr) GETPROC("glCopyTexImage2D");
bglCopyTexSubImage2D = (bglCopyTexSubImage2DProcPtr) GETPROC("glCopyTexSubImage2D");
bglTexSubImage2D = (bglTexSubImage2DProcPtr) GETPROC("glTexSubImage2D");
bglTexParameterf = (bglTexParameterfProcPtr) GETPROC("glTexParameterf");
bglTexParameteri = (bglTexParameteriProcPtr) GETPROC("glTexParameteri");
bglGetTexParameteriv = (bglGetTexParameterivProcPtr) GETPROC("glGetTexParameteriv");
bglGetTexLevelParameteriv = (bglGetTexLevelParameterivProcPtr) GETPROC("glGetTexLevelParameteriv");
bglTexGenfv = (bglTexGenfvProcPtr) GETPROC("glTexGenfv");
// Fog
bglFogf = (bglFogfProcPtr) GETPROC("glFogf");
bglFogi = (bglFogiProcPtr) GETPROC("glFogi");
bglFogfv = (bglFogfvProcPtr) GETPROC("glFogfv");
// Display Lists
bglNewList = (bglNewListProcPtr) GETPROC("glNewList");
bglEndList = (bglEndListProcPtr) GETPROC("glEndList");
bglCallList = (bglCallListProcPtr) GETPROC("glCallList");
bglDeleteLists = (bglDeleteListsProcPtr) GETPROC("glDeleteLists");
// Vertex Arrays
bglEnableClientState = (bglEnableClientStateProcPtr) GETPROC("glEnableClientState");
bglDisableClientState = (bglDisableClientStateProcPtr) GETPROC("glDisableClientState");
bglVertexPointer = (bglVertexPointerProcPtr) GETPROC("glVertexPointer");
bglNormalPointer = (bglNormalPointerProcPtr) GETPROC("glNormalPointer");
bglTexCoordPointer = (bglTexCoordPointerProcPtr) GETPROC("glTexCoordPointer");
bglDrawArrays = (bglDrawArraysProcPtr) GETPROC("glDrawArrays");
bglDrawElements = (bglDrawElementsProcPtr) GETPROC("glDrawElements");
// Stencil Buffer
bglClearStencil = (bglClearStencilProcPtr) GETPROC("glClearStencil");
bglStencilOp = (bglStencilOpProcPtr) GETPROC("glStencilOp");
bglStencilFunc = (bglStencilFuncProcPtr) GETPROC("glStencilFunc");
#endif
loadglextensions();
loadglulibrary(getenv("BUILD_GLULIB"));
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
if (err) unloadgldriver();
if (err) unloadwgl();
return err;
#else
UNREFERENCED_PARAMETER(driver);
return 0;
#endif
}
int32_t loadglextensions(void)
int32_t unloadwgl(void)
{
#if defined DYNAMIC_GLEXT
int32_t err = 0;
#if !defined RENDERTYPESDL && defined _WIN32
if (!hGLDLL) return 0;
#endif
bglBlendEquation = (bglBlendEquationProcPtr) GETPROCEXTSOFT("glBlendEquation");
bglTexImage3D = (bglTexImage3DProcPtr) GETPROCEXTSOFT("glTexImage3D");
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) GETPROCEXTSOFT("glCompressedTexImage2DARB");
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) GETPROCEXTSOFT("glGetCompressedTexImageARB");
// GPU Programs
bglGenProgramsARB = (bglGenProgramsARBProcPtr) GETPROCEXTSOFT("glGenProgramsARB");
bglBindProgramARB = (bglBindProgramARBProcPtr) GETPROCEXTSOFT("glBindProgramARB");
bglProgramStringARB = (bglProgramStringARBProcPtr) GETPROCEXTSOFT("glProgramStringARB");
bglDeleteProgramsARB = (bglDeleteProgramsARBProcPtr) GETPROCEXTSOFT("glDeleteProgramsARB");
// Multitexturing
bglActiveTextureARB = (bglActiveTextureARBProcPtr) GETPROCEXTSOFT("glActiveTextureARB");
bglClientActiveTextureARB = (bglClientActiveTextureARBProcPtr) GETPROCEXTSOFT("glClientActiveTextureARB");
bglMultiTexCoord2dARB = (bglMultiTexCoord2dARBProcPtr) GETPROCEXTSOFT("glMultiTexCoord2dARB");
bglMultiTexCoord2fARB = (bglMultiTexCoord2fARBProcPtr) GETPROCEXTSOFT("glMultiTexCoord2fARB");
// Frame Buffer Objects
bglGenFramebuffersEXT = (bglGenFramebuffersEXTProcPtr) GETPROCEXTSOFT("glGenFramebuffersEXT");
bglBindFramebufferEXT = (bglBindFramebufferEXTProcPtr) GETPROCEXTSOFT("glBindFramebufferEXT");
bglFramebufferTexture2DEXT = (bglFramebufferTexture2DEXTProcPtr) GETPROCEXTSOFT("glFramebufferTexture2DEXT");
bglCheckFramebufferStatusEXT = (bglCheckFramebufferStatusEXTProcPtr) GETPROCEXTSOFT("glCheckFramebufferStatusEXT");
bglDeleteFramebuffersEXT = (bglDeleteFramebuffersEXTProcPtr) GETPROCEXTSOFT("glDeleteFramebuffersEXT");
// Vertex Buffer Objects
bglGenBuffersARB = (bglGenBuffersARBProcPtr) GETPROCEXTSOFT("glGenBuffersARB");
bglBindBufferARB = (bglBindBufferARBProcPtr) GETPROCEXTSOFT("glBindBufferARB");
bglDeleteBuffersARB = (bglDeleteBuffersARBProcPtr) GETPROCEXTSOFT("glDeleteBuffersARB");
bglBufferDataARB = (bglBufferDataARBProcPtr) GETPROCEXTSOFT("glBufferDataARB");
bglBufferSubDataARB = (bglBufferSubDataARBProcPtr) GETPROCEXTSOFT("glBufferSubDataARB");
bglMapBufferARB = (bglMapBufferARBProcPtr) GETPROCEXTSOFT("glMapBufferARB");
bglUnmapBufferARB = (bglUnmapBufferARBProcPtr) GETPROCEXTSOFT("glUnmapBufferARB");
// ARB_buffer_storage
bglBufferStorage = (bglBufferStorageProcPtr)GETPROCEXTSOFT("glBufferStorage");
// ARB_map_buffer_range
bglMapBufferRange = (bglMapBufferRangeProcPtr)GETPROCEXTSOFT("glMapBufferRange");
// Occlusion queries
bglGenQueriesARB = (bglGenQueriesARBProcPtr) GETPROCEXTSOFT("glGenQueriesARB");
bglDeleteQueriesARB = (bglDeleteQueriesARBProcPtr) GETPROCEXTSOFT("glDeleteQueriesARB");
bglIsQueryARB = (bglIsQueryARBProcPtr) GETPROCEXTSOFT("glIsQueryARB");
bglBeginQueryARB = (bglBeginQueryARBProcPtr) GETPROCEXTSOFT("glBeginQueryARB");
bglEndQueryARB = (bglEndQueryARBProcPtr) GETPROCEXTSOFT("glEndQueryARB");
bglGetQueryivARB = (bglGetQueryivARBProcPtr) GETPROCEXTSOFT("glGetQueryivARB");
bglGetQueryObjectivARB = (bglGetQueryObjectivARBProcPtr) GETPROCEXTSOFT("glGetQueryObjectivARB");
bglGetQueryObjectuivARB = (bglGetQueryObjectuivARBProcPtr) GETPROCEXTSOFT("glGetQueryObjectuivARB");
// Shader Objects
bglDeleteObjectARB = (bglDeleteObjectARBProcPtr) GETPROCEXTSOFT("glDeleteObjectARB");
bglGetHandleARB = (bglGetHandleARBProcPtr) GETPROCEXTSOFT("glGetHandleARB");
bglDetachObjectARB = (bglDetachObjectARBProcPtr) GETPROCEXTSOFT("glDetachObjectARB");
bglCreateShaderObjectARB = (bglCreateShaderObjectARBProcPtr) GETPROCEXTSOFT("glCreateShaderObjectARB");
bglShaderSourceARB = (bglShaderSourceARBProcPtr) GETPROCEXTSOFT("glShaderSourceARB");
bglCompileShaderARB = (bglCompileShaderARBProcPtr) GETPROCEXTSOFT("glCompileShaderARB");
bglCreateProgramObjectARB = (bglCreateProgramObjectARBProcPtr) GETPROCEXTSOFT("glCreateProgramObjectARB");
bglAttachObjectARB = (bglAttachObjectARBProcPtr) GETPROCEXTSOFT("glAttachObjectARB");
bglLinkProgramARB = (bglLinkProgramARBProcPtr) GETPROCEXTSOFT("glLinkProgramARB");
bglUseProgramObjectARB = (bglUseProgramObjectARBProcPtr) GETPROCEXTSOFT("glUseProgramObjectARB");
bglValidateProgramARB = (bglValidateProgramARBProcPtr) GETPROCEXTSOFT("glValidateProgramARB");
bglUniform1fARB = (bglUniform1fARBProcPtr) GETPROCEXTSOFT("glUniform1fARB");
bglUniform2fARB = (bglUniform2fARBProcPtr) GETPROCEXTSOFT("glUniform2fARB");
bglUniform3fARB = (bglUniform3fARBProcPtr) GETPROCEXTSOFT("glUniform3fARB");
bglUniform4fARB = (bglUniform4fARBProcPtr) GETPROCEXTSOFT("glUniform4fARB");
bglUniform1iARB = (bglUniform1iARBProcPtr) GETPROCEXTSOFT("glUniform1iARB");
bglUniform2iARB = (bglUniform2iARBProcPtr) GETPROCEXTSOFT("glUniform2iARB");
bglUniform3iARB = (bglUniform3iARBProcPtr) GETPROCEXTSOFT("glUniform3iARB");
bglUniform4iARB = (bglUniform4iARBProcPtr) GETPROCEXTSOFT("glUniform4iARB");
bglUniform1fvARB = (bglUniform1fvARBProcPtr) GETPROCEXTSOFT("glUniform1fvARB");
bglUniform2fvARB = (bglUniform2fvARBProcPtr) GETPROCEXTSOFT("glUniform2fvARB");
bglUniform3fvARB = (bglUniform3fvARBProcPtr) GETPROCEXTSOFT("glUniform3fvARB");
bglUniform4fvARB = (bglUniform4fvARBProcPtr) GETPROCEXTSOFT("glUniform4fvARB");
bglUniform1ivARB = (bglUniform1ivARBProcPtr) GETPROCEXTSOFT("glUniform1ivARB");
bglUniform2ivARB = (bglUniform2ivARBProcPtr) GETPROCEXTSOFT("glUniform2ivARB");
bglUniform3ivARB = (bglUniform3ivARBProcPtr) GETPROCEXTSOFT("glUniform3ivARB");
bglUniform4ivARB = (bglUniform4ivARBProcPtr) GETPROCEXTSOFT("glUniform4ivARB");
bglUniformMatrix2fvARB = (bglUniformMatrix2fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix2fvARB");
bglUniformMatrix3fvARB = (bglUniformMatrix3fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix3fvARB");
bglUniformMatrix4fvARB = (bglUniformMatrix4fvARBProcPtr) GETPROCEXTSOFT("glUniformMatrix4fvARB");
bglGetObjectParameterfvARB = (bglGetObjectParameterfvARBProcPtr) GETPROCEXTSOFT("glGetObjectParameterfvARB");
bglGetObjectParameterivARB = (bglGetObjectParameterivARBProcPtr) GETPROCEXTSOFT("glGetObjectParameterivARB");
bglGetInfoLogARB = (bglGetInfoLogARBProcPtr) GETPROCEXTSOFT("glGetInfoLogARB");
bglGetAttachedObjectsARB = (bglGetAttachedObjectsARBProcPtr) GETPROCEXTSOFT("glGetAttachedObjectsARB");
bglGetUniformLocationARB = (bglGetUniformLocationARBProcPtr) GETPROCEXTSOFT("glGetUniformLocationARB");
bglGetActiveUniformARB = (bglGetActiveUniformARBProcPtr) GETPROCEXTSOFT("glGetActiveUniformARB");
bglGetUniformfvARB = (bglGetUniformfvARBProcPtr) GETPROCEXTSOFT("glGetUniformfvARB");
bglGetUniformivARB = (bglGetUniformivARBProcPtr) GETPROCEXTSOFT("glGetUniformivARB");
bglGetShaderSourceARB = (bglGetShaderSourceARBProcPtr) GETPROCEXTSOFT("glGetShaderSourceARB");
// Vertex Shaders
bglVertexAttrib1dARB = (bglVertexAttrib1dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1dARB");
bglVertexAttrib1dvARB = (bglVertexAttrib1dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1dvARB");
bglVertexAttrib1fARB = (bglVertexAttrib1fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1fARB");
bglVertexAttrib1fvARB = (bglVertexAttrib1fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1fvARB");
bglVertexAttrib1sARB = (bglVertexAttrib1sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1sARB");
bglVertexAttrib1svARB = (bglVertexAttrib1svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib1svARB");
bglVertexAttrib2dARB = (bglVertexAttrib2dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2dARB");
bglVertexAttrib2dvARB = (bglVertexAttrib2dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2dvARB");
bglVertexAttrib2fARB = (bglVertexAttrib2fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2fARB");
bglVertexAttrib2fvARB = (bglVertexAttrib2fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2fvARB");
bglVertexAttrib2sARB = (bglVertexAttrib2sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2sARB");
bglVertexAttrib2svARB = (bglVertexAttrib2svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib2svARB");
bglVertexAttrib3dARB = (bglVertexAttrib3dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3dARB");
bglVertexAttrib3dvARB = (bglVertexAttrib3dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3dvARB");
bglVertexAttrib3fARB = (bglVertexAttrib3fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3fARB");
bglVertexAttrib3fvARB = (bglVertexAttrib3fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3fvARB");
bglVertexAttrib3sARB = (bglVertexAttrib3sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3sARB");
bglVertexAttrib3svARB = (bglVertexAttrib3svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib3svARB");
bglVertexAttrib4NbvARB = (bglVertexAttrib4NbvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NbvARB");
bglVertexAttrib4NivARB = (bglVertexAttrib4NivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NivARB");
bglVertexAttrib4NsvARB = (bglVertexAttrib4NsvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NsvARB");
bglVertexAttrib4NubARB = (bglVertexAttrib4NubARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NubARB");
bglVertexAttrib4NubvARB = (bglVertexAttrib4NubvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NubvARB");
bglVertexAttrib4NuivARB = (bglVertexAttrib4NuivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NuivARB");
bglVertexAttrib4NusvARB = (bglVertexAttrib4NusvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4NusvARB");
bglVertexAttrib4bvARB = (bglVertexAttrib4bvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4bvARB");
bglVertexAttrib4dARB = (bglVertexAttrib4dARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4dARB");
bglVertexAttrib4dvARB = (bglVertexAttrib4dvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4dvARB");
bglVertexAttrib4fARB = (bglVertexAttrib4fARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4fARB");
bglVertexAttrib4fvARB = (bglVertexAttrib4fvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4fvARB");
bglVertexAttrib4ivARB = (bglVertexAttrib4ivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4ivARB");
bglVertexAttrib4sARB = (bglVertexAttrib4sARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4sARB");
bglVertexAttrib4svARB = (bglVertexAttrib4svARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4svARB");
bglVertexAttrib4ubvARB = (bglVertexAttrib4ubvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4ubvARB");
bglVertexAttrib4uivARB = (bglVertexAttrib4uivARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4uivARB");
bglVertexAttrib4usvARB = (bglVertexAttrib4usvARBProcPtr) GETPROCEXTSOFT("glVertexAttrib4usvARB");
bglVertexAttribPointerARB = (bglVertexAttribPointerARBProcPtr) GETPROCEXTSOFT("glVertexAttribPointerARB");
bglEnableVertexAttribArrayARB = (bglEnableVertexAttribArrayARBProcPtr) GETPROCEXTSOFT("glEnableVertexAttribArrayARB");
bglDisableVertexAttribArrayARB = (bglDisableVertexAttribArrayARBProcPtr) GETPROCEXTSOFT("glDisableVertexAttribArrayARB");
bglGetVertexAttribdvARB = (bglGetVertexAttribdvARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribdvARB");
bglGetVertexAttribfvARB = (bglGetVertexAttribfvARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribfvARB");
bglGetVertexAttribivARB = (bglGetVertexAttribivARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribivARB");
bglGetVertexAttribPointervARB = (bglGetVertexAttribPointervARBProcPtr) GETPROCEXTSOFT("glGetVertexAttribPointervARB");
bglBindAttribLocationARB = (bglBindAttribLocationARBProcPtr) GETPROCEXTSOFT("glBindAttribLocationARB");
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) GETPROCEXTSOFT("glGetActiveAttribARB");
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) GETPROCEXTSOFT("glGetAttribLocationARB");
// Debug Output
#ifndef __APPLE__
bglDebugMessageControlARB = (bglDebugMessageControlARBProcPtr) GETPROCEXTSOFT("glDebugMessageControlARB");
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) GETPROCEXTSOFT("glDebugMessageCallbackARB");
#endif
#ifdef _WIN32
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) GETPROCEXTSOFT("wglSwapIntervalEXT");
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB");
#endif
// the following ARB functions are used in POLYMER=0 builds:
// glActiveTextureARB,
// glDeleteBuffersARB, glGenBuffersARB, glBindBufferARB,
// glMapBufferARB, glUnmapBufferARB, glBufferDataARB,
// glClientActiveTextureARB,
// glGetCompressedTexImageARB, glCompressedTexImage2DARB
return err;
#else
return 0;
#endif
}
int32_t unloadgldriver(void)
{
unloadglulibrary();
#if defined DYNAMIC_GL || defined DYNAMIC_GLEXT
#if !defined RENDERTYPESDL && defined _WIN32
if (!hGLDLL) return 0;
#endif
DO_FREE_AND_NULL(gldriver);
#if !defined RENDERTYPESDL && defined _WIN32
FreeLibrary(hGLDLL);
hGLDLL = NULL;
#endif
#endif
#if defined DYNAMIC_GL
#ifdef _WIN32
bwglCreateContext = (bwglCreateContextProcPtr) NULL;
bwglDeleteContext = (bwglDeleteContextProcPtr) NULL;
bwglGetProcAddress = (bwglGetProcAddressProcPtr) NULL;
bwglMakeCurrent = (bwglMakeCurrentProcPtr) NULL;
bwglSwapBuffers = (bwglSwapBuffersProcPtr) NULL;
bwglChoosePixelFormat = (bwglChoosePixelFormatProcPtr) NULL;
bwglDescribePixelFormat = (bwglDescribePixelFormatProcPtr) NULL;
bwglGetPixelFormat = (bwglGetPixelFormatProcPtr) NULL;
bwglSetPixelFormat = (bwglSetPixelFormatProcPtr) NULL;
#endif
bglClearColor = (bglClearColorProcPtr) NULL;
bglClear = (bglClearProcPtr) NULL;
bglColorMask = (bglColorMaskProcPtr) NULL;
bglAlphaFunc = (bglAlphaFuncProcPtr) NULL;
bglBlendFunc = (bglBlendFuncProcPtr) NULL;
bglCullFace = (bglCullFaceProcPtr) NULL;
bglFrontFace = (bglFrontFaceProcPtr) NULL;
bglPolygonOffset = (bglPolygonOffsetProcPtr) NULL;
bglPolygonMode = (bglPolygonModeProcPtr) NULL;
bglEnable = (bglEnableProcPtr) NULL;
bglDisable = (bglDisableProcPtr) NULL;
bglGetDoublev = (bglGetDoublevProcPtr) NULL;
bglGetFloatv = (bglGetFloatvProcPtr) NULL;
bglGetIntegerv = (bglGetIntegervProcPtr) NULL;
bglPushAttrib = (bglPushAttribProcPtr) NULL;
bglPopAttrib = (bglPopAttribProcPtr) NULL;
bglGetError = (bglGetErrorProcPtr) NULL;
bglGetString = (bglGetStringProcPtr) NULL;
bglHint = (bglHintProcPtr) NULL;
bglDrawBuffer = (bglDrawBufferProcPtr) NULL;
bglReadBuffer = (bglReadBufferProcPtr) NULL;
bglScissor = (bglScissorProcPtr) NULL;
bglClipPlane = (bglClipPlaneProcPtr) NULL;
// Depth
bglDepthFunc = (bglDepthFuncProcPtr) NULL;
bglDepthMask = (bglDepthMaskProcPtr) NULL;
// bglDepthRange = (bglDepthRangeProcPtr) NULL;
// Matrix
bglMatrixMode = (bglMatrixModeProcPtr) NULL;
bglOrtho = (bglOrthoProcPtr) NULL;
bglFrustum = (bglFrustumProcPtr) NULL;
bglViewport = (bglViewportProcPtr) NULL;
bglPushMatrix = (bglPushMatrixProcPtr) NULL;
bglPopMatrix = (bglPopMatrixProcPtr) NULL;
bglLoadIdentity = (bglLoadIdentityProcPtr) NULL;
bglLoadMatrixf = (bglLoadMatrixfProcPtr) NULL;
bglLoadMatrixd = (bglLoadMatrixdProcPtr) NULL;
bglMultMatrixf = (bglMultMatrixfProcPtr) NULL;
bglMultMatrixd = (bglMultMatrixdProcPtr) NULL;
bglRotatef = (bglRotatefProcPtr) NULL;
bglScalef = (bglScalefProcPtr) NULL;
bglTranslatef = (bglTranslatefProcPtr) NULL;
// Drawing
bglBegin = (bglBeginProcPtr) NULL;
bglEnd = (bglEndProcPtr) NULL;
bglVertex2f = (bglVertex2fProcPtr) NULL;
bglVertex2i = (bglVertex2iProcPtr) NULL;
bglVertex3f = (bglVertex3fProcPtr) NULL;
bglVertex3d = (bglVertex3dProcPtr) NULL;
bglVertex3fv = (bglVertex3fvProcPtr) NULL;
bglVertex3dv = (bglVertex3dvProcPtr) NULL;
bglRecti = (bglRectiProcPtr) NULL;
bglColor3f = (bglColor3fProcPtr) NULL;
bglColor4f = (bglColor4fProcPtr) NULL;
bglColor4ub = (bglColor4ubProcPtr) NULL;
bglTexCoord2d = (bglTexCoord2dProcPtr) NULL;
bglTexCoord2f = (bglTexCoord2fProcPtr) NULL;
bglTexCoord2i = (bglTexCoord2iProcPtr) NULL;
bglNormal3f = (bglNormal3fProcPtr) NULL;
// Lighting
bglShadeModel = (bglShadeModelProcPtr) NULL;
bglLightfv = (bglLightfvProcPtr) NULL;
// Raster funcs
bglReadPixels = (bglReadPixelsProcPtr) NULL;
bglRasterPos4i = (bglRasterPos4iProcPtr) NULL;
bglDrawPixels = (bglDrawPixelsProcPtr) NULL;
bglPixelStorei = (bglPixelStoreiProcPtr) NULL;
// Texture mapping
bglTexEnvf = (bglTexEnvfProcPtr) NULL;
bglGenTextures = (bglGenTexturesProcPtr) NULL;
bglDeleteTextures = (bglDeleteTexturesProcPtr) NULL;
bglBindTexture = (bglBindTextureProcPtr) NULL;
bglTexImage2D = (bglTexImage2DProcPtr) NULL;
bglCopyTexImage2D = (bglCopyTexImage2DProcPtr) NULL;
bglCopyTexSubImage2D = (bglCopyTexSubImage2DProcPtr) NULL;
bglTexSubImage2D = (bglTexSubImage2DProcPtr) NULL;
bglTexParameterf = (bglTexParameterfProcPtr) NULL;
bglTexParameteri = (bglTexParameteriProcPtr) NULL;
bglGetTexParameteriv = (bglGetTexParameterivProcPtr) NULL;
bglGetTexLevelParameteriv = (bglGetTexLevelParameterivProcPtr) NULL;
bglTexGenfv = (bglTexGenfvProcPtr) NULL;
// Fog
bglFogf = (bglFogfProcPtr) NULL;
bglFogi = (bglFogiProcPtr) NULL;
bglFogfv = (bglFogfvProcPtr) NULL;
// Display Lists
bglNewList = (bglNewListProcPtr) NULL;
bglEndList = (bglEndListProcPtr) NULL;
bglCallList = (bglCallListProcPtr) NULL;
bglDeleteLists = (bglDeleteListsProcPtr) NULL;
// Vertex Arrays
bglEnableClientState = (bglEnableClientStateProcPtr) NULL;
bglDisableClientState = (bglDisableClientStateProcPtr) NULL;
bglVertexPointer = (bglVertexPointerProcPtr) NULL;
bglNormalPointer = (bglNormalPointerProcPtr) NULL;
bglTexCoordPointer = (bglTexCoordPointerProcPtr) NULL;
bglDrawArrays = (bglDrawArraysProcPtr) NULL;
bglDrawElements = (bglDrawElementsProcPtr) NULL;
// Stencil Buffer
bglClearStencil = (bglClearStencilProcPtr) NULL;
bglStencilOp = (bglStencilOpProcPtr) NULL;
bglStencilFunc = (bglStencilFuncProcPtr) NULL;
#endif
#if defined DYNAMIC_GLEXT
bglBlendEquation = (bglBlendEquationProcPtr) NULL;
bglTexImage3D = (bglTexImage3DProcPtr) NULL;
bglCompressedTexImage2DARB = (bglCompressedTexImage2DARBProcPtr) NULL;
bglGetCompressedTexImageARB = (bglGetCompressedTexImageARBProcPtr) NULL;
// GPU Programs
bglGenProgramsARB = (bglGenProgramsARBProcPtr) NULL;
bglBindProgramARB = (bglBindProgramARBProcPtr) NULL;
bglProgramStringARB = (bglProgramStringARBProcPtr) NULL;
bglDeleteProgramsARB = (bglDeleteProgramsARBProcPtr) NULL;
// Multitexturing
bglActiveTextureARB = (bglActiveTextureARBProcPtr) NULL;
bglClientActiveTextureARB = (bglClientActiveTextureARBProcPtr) NULL;
bglMultiTexCoord2dARB = (bglMultiTexCoord2dARBProcPtr) NULL;
bglMultiTexCoord2fARB = (bglMultiTexCoord2fARBProcPtr) NULL;
// Frame Buffer Objects
bglGenFramebuffersEXT = (bglGenFramebuffersEXTProcPtr) NULL;
bglBindFramebufferEXT = (bglBindFramebufferEXTProcPtr) NULL;
bglFramebufferTexture2DEXT = (bglFramebufferTexture2DEXTProcPtr) NULL;
bglCheckFramebufferStatusEXT = (bglCheckFramebufferStatusEXTProcPtr) NULL;
bglDeleteFramebuffersEXT = (bglDeleteFramebuffersEXTProcPtr) NULL;
// Vertex Buffer Objects
bglGenBuffersARB = (bglGenBuffersARBProcPtr) NULL;
bglBindBufferARB = (bglBindBufferARBProcPtr) NULL;
bglDeleteBuffersARB = (bglDeleteBuffersARBProcPtr) NULL;
bglBufferDataARB = (bglBufferDataARBProcPtr) NULL;
bglBufferSubDataARB = (bglBufferSubDataARBProcPtr) NULL;
bglMapBufferARB = (bglMapBufferARBProcPtr) NULL;
bglUnmapBufferARB = (bglUnmapBufferARBProcPtr) NULL;
// ARB_buffer_storage
bglBufferStorage = (bglBufferStorageProcPtr) NULL;
// ARB_map_buffer_range
bglMapBufferRange = (bglMapBufferRangeProcPtr)NULL;
// Occlusion queries
bglGenQueriesARB = (bglGenQueriesARBProcPtr) NULL;
bglDeleteQueriesARB = (bglDeleteQueriesARBProcPtr) NULL;
bglIsQueryARB = (bglIsQueryARBProcPtr) NULL;
bglBeginQueryARB = (bglBeginQueryARBProcPtr) NULL;
bglEndQueryARB = (bglEndQueryARBProcPtr) NULL;
bglGetQueryivARB = (bglGetQueryivARBProcPtr) NULL;
bglGetQueryObjectivARB = (bglGetQueryObjectivARBProcPtr) NULL;
bglGetQueryObjectuivARB = (bglGetQueryObjectuivARBProcPtr) NULL;
// Shader Objects
bglDeleteObjectARB = (bglDeleteObjectARBProcPtr) NULL;
bglGetHandleARB = (bglGetHandleARBProcPtr) NULL;
bglDetachObjectARB = (bglDetachObjectARBProcPtr) NULL;
bglCreateShaderObjectARB = (bglCreateShaderObjectARBProcPtr) NULL;
bglShaderSourceARB = (bglShaderSourceARBProcPtr) NULL;
bglCompileShaderARB = (bglCompileShaderARBProcPtr) NULL;
bglCreateProgramObjectARB = (bglCreateProgramObjectARBProcPtr) NULL;
bglAttachObjectARB = (bglAttachObjectARBProcPtr) NULL;
bglLinkProgramARB = (bglLinkProgramARBProcPtr) NULL;
bglUseProgramObjectARB = (bglUseProgramObjectARBProcPtr) NULL;
bglValidateProgramARB = (bglValidateProgramARBProcPtr) NULL;
bglUniform1fARB = (bglUniform1fARBProcPtr) NULL;
bglUniform2fARB = (bglUniform2fARBProcPtr) NULL;
bglUniform3fARB = (bglUniform3fARBProcPtr) NULL;
bglUniform4fARB = (bglUniform4fARBProcPtr) NULL;
bglUniform1iARB = (bglUniform1iARBProcPtr) NULL;
bglUniform2iARB = (bglUniform2iARBProcPtr) NULL;
bglUniform3iARB = (bglUniform3iARBProcPtr) NULL;
bglUniform4iARB = (bglUniform4iARBProcPtr) NULL;
bglUniform1fvARB = (bglUniform1fvARBProcPtr) NULL;
bglUniform2fvARB = (bglUniform2fvARBProcPtr) NULL;
bglUniform3fvARB = (bglUniform3fvARBProcPtr) NULL;
bglUniform4fvARB = (bglUniform4fvARBProcPtr) NULL;
bglUniform1ivARB = (bglUniform1ivARBProcPtr) NULL;
bglUniform2ivARB = (bglUniform2ivARBProcPtr) NULL;
bglUniform3ivARB = (bglUniform3ivARBProcPtr) NULL;
bglUniform4ivARB = (bglUniform4ivARBProcPtr) NULL;
bglUniformMatrix2fvARB = (bglUniformMatrix2fvARBProcPtr) NULL;
bglUniformMatrix3fvARB = (bglUniformMatrix3fvARBProcPtr) NULL;
bglUniformMatrix4fvARB = (bglUniformMatrix4fvARBProcPtr) NULL;
bglGetObjectParameterfvARB = (bglGetObjectParameterfvARBProcPtr) NULL;
bglGetObjectParameterivARB = (bglGetObjectParameterivARBProcPtr) NULL;
bglGetInfoLogARB = (bglGetInfoLogARBProcPtr) NULL;
bglGetAttachedObjectsARB = (bglGetAttachedObjectsARBProcPtr) NULL;
bglGetUniformLocationARB = (bglGetUniformLocationARBProcPtr) NULL;
bglGetActiveUniformARB = (bglGetActiveUniformARBProcPtr) NULL;
bglGetUniformfvARB = (bglGetUniformfvARBProcPtr) NULL;
bglGetUniformivARB = (bglGetUniformivARBProcPtr) NULL;
bglGetShaderSourceARB = (bglGetShaderSourceARBProcPtr) NULL;
// Vertex Shaders
bglVertexAttrib1dARB = (bglVertexAttrib1dARBProcPtr) NULL;
bglVertexAttrib1dvARB = (bglVertexAttrib1dvARBProcPtr) NULL;
bglVertexAttrib1fARB = (bglVertexAttrib1fARBProcPtr) NULL;
bglVertexAttrib1fvARB = (bglVertexAttrib1fvARBProcPtr) NULL;
bglVertexAttrib1sARB = (bglVertexAttrib1sARBProcPtr) NULL;
bglVertexAttrib1svARB = (bglVertexAttrib1svARBProcPtr) NULL;
bglVertexAttrib2dARB = (bglVertexAttrib2dARBProcPtr) NULL;
bglVertexAttrib2dvARB = (bglVertexAttrib2dvARBProcPtr) NULL;
bglVertexAttrib2fARB = (bglVertexAttrib2fARBProcPtr) NULL;
bglVertexAttrib2fvARB = (bglVertexAttrib2fvARBProcPtr) NULL;
bglVertexAttrib2sARB = (bglVertexAttrib2sARBProcPtr) NULL;
bglVertexAttrib2svARB = (bglVertexAttrib2svARBProcPtr) NULL;
bglVertexAttrib3dARB = (bglVertexAttrib3dARBProcPtr) NULL;
bglVertexAttrib3dvARB = (bglVertexAttrib3dvARBProcPtr) NULL;
bglVertexAttrib3fARB = (bglVertexAttrib3fARBProcPtr) NULL;
bglVertexAttrib3fvARB = (bglVertexAttrib3fvARBProcPtr) NULL;
bglVertexAttrib3sARB = (bglVertexAttrib3sARBProcPtr) NULL;
bglVertexAttrib3svARB = (bglVertexAttrib3svARBProcPtr) NULL;
bglVertexAttrib4NbvARB = (bglVertexAttrib4NbvARBProcPtr) NULL;
bglVertexAttrib4NivARB = (bglVertexAttrib4NivARBProcPtr) NULL;
bglVertexAttrib4NsvARB = (bglVertexAttrib4NsvARBProcPtr) NULL;
bglVertexAttrib4NubARB = (bglVertexAttrib4NubARBProcPtr) NULL;
bglVertexAttrib4NubvARB = (bglVertexAttrib4NubvARBProcPtr) NULL;
bglVertexAttrib4NuivARB = (bglVertexAttrib4NuivARBProcPtr) NULL;
bglVertexAttrib4NusvARB = (bglVertexAttrib4NusvARBProcPtr) NULL;
bglVertexAttrib4bvARB = (bglVertexAttrib4bvARBProcPtr) NULL;
bglVertexAttrib4dARB = (bglVertexAttrib4dARBProcPtr) NULL;
bglVertexAttrib4dvARB = (bglVertexAttrib4dvARBProcPtr) NULL;
bglVertexAttrib4fARB = (bglVertexAttrib4fARBProcPtr) NULL;
bglVertexAttrib4fvARB = (bglVertexAttrib4fvARBProcPtr) NULL;
bglVertexAttrib4ivARB = (bglVertexAttrib4ivARBProcPtr) NULL;
bglVertexAttrib4sARB = (bglVertexAttrib4sARBProcPtr) NULL;
bglVertexAttrib4svARB = (bglVertexAttrib4svARBProcPtr) NULL;
bglVertexAttrib4ubvARB = (bglVertexAttrib4ubvARBProcPtr) NULL;
bglVertexAttrib4uivARB = (bglVertexAttrib4uivARBProcPtr) NULL;
bglVertexAttrib4usvARB = (bglVertexAttrib4usvARBProcPtr) NULL;
bglVertexAttribPointerARB = (bglVertexAttribPointerARBProcPtr) NULL;
bglEnableVertexAttribArrayARB = (bglEnableVertexAttribArrayARBProcPtr) NULL;
bglDisableVertexAttribArrayARB = (bglDisableVertexAttribArrayARBProcPtr) NULL;
bglGetVertexAttribdvARB = (bglGetVertexAttribdvARBProcPtr) NULL;
bglGetVertexAttribfvARB = (bglGetVertexAttribfvARBProcPtr) NULL;
bglGetVertexAttribivARB = (bglGetVertexAttribivARBProcPtr) NULL;
bglGetVertexAttribPointervARB = (bglGetVertexAttribPointervARBProcPtr) NULL;
bglBindAttribLocationARB = (bglBindAttribLocationARBProcPtr) NULL;
bglGetActiveAttribARB = (bglGetActiveAttribARBProcPtr) NULL;
bglGetAttribLocationARB = (bglGetAttribLocationARBProcPtr) NULL;
// Debug Output
#ifndef __APPLE__
bglDebugMessageControlARB = (bglDebugMessageControlARBProcPtr) NULL;
bglDebugMessageCallbackARB = (bglDebugMessageCallbackARBProcPtr) NULL;
#endif
#ifdef _WIN32
bwglSwapIntervalEXT = (bwglSwapIntervalEXTProcPtr) NULL;
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) NULL;
#endif
#endif
return 0;
}
#endif
#endif
#if defined DYNAMIC_GLU
#if defined _WIN32

View file

@ -4,7 +4,7 @@
#include "compat.h"
#include "build.h"
#include "glbuild.h"
#include "glad/glad.h"
#include "pragmas.h"
#include "baselayer.h"
#include "engine_priv.h"
@ -103,15 +103,15 @@ void md_freevbos()
if (m->vbos)
{
// OSD_Printf("freeing model %d vbo\n",i);
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
glDeleteBuffers(m->head.numsurfs, m->vbos);
DO_FREE_AND_NULL(m->vbos);
}
}
if (allocvbos)
{
bglDeleteBuffersARB(allocvbos, indexvbos);
bglDeleteBuffersARB(allocvbos, vertvbos);
glDeleteBuffers(allocvbos, indexvbos);
glDeleteBuffers(allocvbos, vertvbos);
allocvbos = 0;
}
}
@ -192,7 +192,7 @@ void clearskins(int32_t type)
for (j=0; j<MAXPALOOKUPS; j++)
if (v->texid[j])
{
bglDeleteTextures(1, &v->texid[j]);
glDeleteTextures(1, &v->texid[j]);
v->texid[j] = 0;
}
}
@ -206,7 +206,7 @@ void clearskins(int32_t type)
{
GLuint otexid = m2->texid[j];
bglDeleteTextures(1, &m2->texid[j]);
glDeleteTextures(1, &m2->texid[j]);
m2->texid[j] = 0;
nullskintexids(otexid);
@ -218,7 +218,7 @@ void clearskins(int32_t type)
{
GLuint otexid = sk->texid[j];
bglDeleteTextures(1, &sk->texid[j]);
glDeleteTextures(1, &sk->texid[j]);
sk->texid[j] = 0;
nullskintexids(otexid);
@ -234,7 +234,7 @@ void clearskins(int32_t type)
for (j=0; j<MAXPALOOKUPS; j++)
if (v->texid[j])
{
bglDeleteTextures(1, &v->texid[j]);
glDeleteTextures(1, &v->texid[j]);
v->texid[j] = 0;
}
}
@ -900,9 +900,9 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
if (pal < (MAXPALOOKUPS - RESERVEDPALS))
m->usesalpha = hasalpha;
if ((doalloc&3)==1)
bglGenTextures(1, texidx);
glGenTextures(1, texidx);
bglBindTexture(GL_TEXTURE_2D, *texidx);
glBindTexture(GL_TEXTURE_2D, *texidx);
//gluBuild2DMipmaps(GL_TEXTURE_2D,GL_RGBA,xsiz,ysiz,GL_BGRA_EXT,GL_UNSIGNED_BYTE,(char *)fptr);
@ -957,14 +957,14 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
int32_t const filter = sk->flags & HICR_FORCEFILTER ? TEXFILTER_ON : gltexfiltermode;
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[filter].mag);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[filter].min);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[filter].mag);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[filter].min);
#ifdef USE_GLEXT
if (glinfo.maxanisotropy > 1.0)
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
#endif
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT);
#if defined USE_GLEXT && !defined EDUKE32_GLES
if (!gotcache && glinfo.texcompr && glusetexcache && !(sk->flags & HICR_NOTEXCOMPRESS) &&
@ -1183,16 +1183,16 @@ static void mdloadvbos(md3model_t *m)
int32_t i;
m->vbos = (GLuint *)Xmalloc(m->head.numsurfs * sizeof(GLuint));
bglGenBuffersARB(m->head.numsurfs, m->vbos);
glGenBuffers(m->head.numsurfs, m->vbos);
i = 0;
while (i < m->head.numsurfs)
{
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->vbos[i]);
bglBufferDataARB(GL_ARRAY_BUFFER_ARB, m->head.surfs[i].numverts * sizeof(md3uv_t), m->head.surfs[i].uv, GL_STATIC_DRAW_ARB);
glBindBuffer(GL_ARRAY_BUFFER, m->vbos[i]);
glBufferData(GL_ARRAY_BUFFER, m->head.surfs[i].numverts * sizeof(md3uv_t), m->head.surfs[i].uv, GL_STATIC_DRAW);
i++;
}
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
#endif
@ -2067,7 +2067,7 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle,
return;
}
bglBegin(GL_TRIANGLES);
glBegin(GL_TRIANGLES);
for (i=s->numtris-1; i>=0; i--)
{
uint16_t tri = M ? M->indexes[i] : i;
@ -2078,20 +2078,20 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle,
int32_t k = s->tris[tri].i[j];
#ifdef USE_GLEXT
if (texunits > GL_TEXTURE0_ARB)
if (texunits > GL_TEXTURE0)
{
int32_t l = GL_TEXTURE0_ARB;
int32_t l = GL_TEXTURE0;
while (l <= texunits)
bglMultiTexCoord2fARB(l++, s->uv[k].u, s->uv[k].v);
glMultiTexCoord2f(l++, s->uv[k].u, s->uv[k].v);
}
else
#endif
bglTexCoord2f(s->uv[k].u, s->uv[k].v);
glTexCoord2f(s->uv[k].u, s->uv[k].v);
bglVertex3fv((float *) &vertlist[k]);
glVertex3fv((float *) &vertlist[k]);
}
}
bglEnd();
glEnd();
#ifndef USE_GLEXT
UNREFERENCED_PARAMETER(texunits);
@ -2105,7 +2105,7 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
int32_t i, surfi;
float f, g, k0, k1, k2=0, k3=0, mat[16]; // inits: compiler-happy
GLfloat pc[4];
int32_t texunits = GL_TEXTURE0_ARB;
int32_t texunits = GL_TEXTURE0;
const int32_t owner = tspr->owner;
// PK: XXX: These owner bound checks are redundant because sext is
@ -2214,18 +2214,18 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
#else
double f = (double) (tspr->owner + 1) * (FLT_EPSILON * 8.0);
if (f != 0.0) f *= 1.0/(double) (sepldist(globalposx - tspr->x, globalposy - tspr->y)>>5);
// bglBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
// glBlendFunc(GL_SRC_ALPHA, GL_DST_COLOR);
#endif
bglDepthFunc(GL_LEQUAL);
// bglDepthRange(0.0 - f, 1.0 - f);
glDepthFunc(GL_LEQUAL);
// glDepthRange(0.0 - f, 1.0 - f);
}
// bglPushAttrib(GL_POLYGON_BIT);
if ((grhalfxdown10x >= 0) ^((globalorientation&8) != 0) ^((globalorientation&4) != 0)) bglFrontFace(GL_CW); else bglFrontFace(GL_CCW);
bglEnable(GL_CULL_FACE);
bglCullFace(GL_BACK);
// glPushAttrib(GL_POLYGON_BIT);
if ((grhalfxdown10x >= 0) ^((globalorientation&8) != 0) ^((globalorientation&4) != 0)) glFrontFace(GL_CW); else glFrontFace(GL_CCW);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
bglEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
// tinting
pc[0] = pc[1] = pc[2] = ((float)(numshades-min(max((globalshade * shadescale)+m->shadeoff,0),numshades)))/((float)numshades);
@ -2248,25 +2248,25 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
if (m->usesalpha) //Sprites with alpha in texture
{
// bglEnable(GL_BLEND);// bglBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// bglEnable(GL_ALPHA_TEST); bglAlphaFunc(GL_GREATER,0.32);
// glEnable(GL_BLEND);// glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
// glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER,0.32);
// float al = 0.32;
// PLAG : default cutoff removed
float al = 0.0;
if (alphahackarray[globalpicnum] != 0)
al=alphahackarray[globalpicnum] * (1.f/255.f);
bglEnable(GL_BLEND);
bglEnable(GL_ALPHA_TEST);
bglAlphaFunc(GL_GREATER,al);
glEnable(GL_BLEND);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER,al);
}
else
{
if ((tspr->cstat&2) || sext->alpha > 0.f || pc[3] < 1.0f)
bglEnable(GL_BLEND); //else bglDisable(GL_BLEND);
glEnable(GL_BLEND); //else glDisable(GL_BLEND);
}
bglColor4f(pc[0],pc[1],pc[2],pc[3]);
glColor4f(pc[0],pc[1],pc[2],pc[3]);
//if (MFLAGS_NOCONV(m))
// bglColor4f(0.0f, 0.0f, 1.0f, 1.0f);
// glColor4f(0.0f, 0.0f, 1.0f, 1.0f);
//------------
// PLAG: Cleaner model rotation code
@ -2314,8 +2314,8 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
if (++curvbo >= r_vbocount)
curvbo = 0;
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[curvbo]);
vbotemp = bglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
glBindBuffer(GL_ARRAY_BUFFER, vertvbos[curvbo]);
vbotemp = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
vertexhandle = (vec3f_t *)vbotemp;
}
#endif
@ -2373,25 +2373,25 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
#ifdef USE_GLEXT
if (r_vertexarrays && r_vbos)
{
bglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glUnmapBuffer(GL_ARRAY_BUFFER);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}
#endif
bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
glMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; glLoadMatrixf(mat);
// PLAG: End
i = mdloadskin((md2model_t *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,globalpal,surfi);
if (!i)
continue;
//i = mdloadskin((md2model *)m,tile2model[Ptile2tile(tspr->picnum,lpal)].skinnum,surfi); //hack for testing multiple surfaces per MD3
bglBindTexture(GL_TEXTURE_2D, i);
glBindTexture(GL_TEXTURE_2D, i);
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglTranslatef(xpanning, ypanning, 1.0f);
bglMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(xpanning, ypanning, 1.0f);
glMatrixMode(GL_MODELVIEW);
if (!(tspr->extra&TSPR_EXTRA_MDHACK))
{
@ -2408,11 +2408,11 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
if ((int32_t) sk->palette == DETAILPAL && sk->skinnum == tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum && sk->surfnum == surfi)
f = sk->param;
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglTranslatef(xpanning, ypanning, 1.0f);
bglScalef(f, f, 1.0f);
bglMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(xpanning, ypanning, 1.0f);
glScalef(f, f, 1.0f);
glMatrixMode(GL_MODELVIEW);
}
i = r_glowmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, GLOWPAL, surfi) : 0;
@ -2421,16 +2421,16 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
{
polymost_setupglowtexture(++texunits, i);
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglTranslatef(xpanning, ypanning, 1.0f);
bglMatrixMode(GL_MODELVIEW);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glTranslatef(xpanning, ypanning, 1.0f);
glMatrixMode(GL_MODELVIEW);
}
if (r_vertexarrays && r_vbos)
{
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]);
vbotemp = bglMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexvbos[curvbo]);
vbotemp = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
indexhandle = (uint16_t *) vbotemp;
}
else
@ -2484,8 +2484,8 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
#ifdef USE_GLEXT
if (r_vertexarrays && r_vbos)
{
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]);
vbotemp = bglMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexvbos[curvbo]);
vbotemp = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
indexhandle = (uint16_t *) vbotemp;
}
else
@ -2502,88 +2502,88 @@ static int32_t polymost_md3draw(md3model_t *m, const uspritetype *tspr)
if (r_vbos)
{
bglUnmapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB);
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, m->vbos[surfi]);
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, m->vbos[surfi]);
l = GL_TEXTURE0_ARB;
l = GL_TEXTURE0;
do
{
bglClientActiveTextureARB(l++);
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
bglTexCoordPointer(2, GL_FLOAT, 0, 0);
glClientActiveTexture(l++);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
} while (l <= texunits);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[curvbo]);
bglVertexPointer(3, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, vertvbos[curvbo]);
glVertexPointer(3, GL_FLOAT, 0, 0);
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]);
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexvbos[curvbo]);
glDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, 0);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
}
else // r_vbos
{
l = GL_TEXTURE0_ARB;
l = GL_TEXTURE0;
do
{
bglClientActiveTextureARB(l++);
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
bglTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u));
glClientActiveTexture(l++);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u));
} while (l <= texunits);
bglVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x));
glVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x));
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes);
glDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes);
} // r_vbos
while (texunits > GL_TEXTURE0_ARB)
while (texunits > GL_TEXTURE0)
{
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
bglDisable(GL_TEXTURE_2D);
bglDisableClientState(GL_TEXTURE_COORD_ARRAY);
bglClientActiveTextureARB(texunits - 1);
bglActiveTextureARB(--texunits);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(texunits - 1);
glActiveTexture(--texunits);
}
#else
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
bglTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u));
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u));
bglVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x));
glVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x));
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes);
glDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes);
#endif
}
#ifdef USE_GLEXT
else // r_vertexarrays
{
while (texunits > GL_TEXTURE0_ARB)
while (texunits > GL_TEXTURE0)
{
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
bglDisable(GL_TEXTURE_2D);
bglActiveTextureARB(--texunits);
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE, 1.0f);
glDisable(GL_TEXTURE_2D);
glActiveTexture(--texunits);
}
} // r_vertexarrays
#endif
}
//------------
if (m->usesalpha) bglDisable(GL_ALPHA_TEST);
if (m->usesalpha) glDisable(GL_ALPHA_TEST);
bglDisable(GL_CULL_FACE);
// bglPopAttrib();
glDisable(GL_CULL_FACE);
// glPopAttrib();
bglMatrixMode(GL_TEXTURE);
bglLoadIdentity();
bglMatrixMode(GL_MODELVIEW);
bglLoadIdentity();
glMatrixMode(GL_TEXTURE);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
polymost_resetVertexPointers();
@ -2634,7 +2634,7 @@ static void md3free(md3model_t *m)
#ifdef USE_GLEXT
if (m->vbos)
{
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
glDeleteBuffers(m->head.numsurfs, m->vbos);
DO_FREE_AND_NULL(m->vbos);
}
#endif
@ -2711,21 +2711,21 @@ void md_allocvbos(void)
if (r_vbocount != allocvbos)
{
bglGenBuffersARB(r_vbocount - allocvbos, &(indexvbos[allocvbos]));
bglGenBuffersARB(r_vbocount - allocvbos, &(vertvbos[allocvbos]));
glGenBuffers(r_vbocount - allocvbos, &(indexvbos[allocvbos]));
glGenBuffers(r_vbocount - allocvbos, &(vertvbos[allocvbos]));
i = allocvbos;
while (i < r_vbocount)
{
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[i]);
bglBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, maxmodeltris * 3 * sizeof(uint16_t), NULL, GL_STREAM_DRAW_ARB);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, vertvbos[i]);
bglBufferDataARB(GL_ARRAY_BUFFER_ARB, maxmodelverts * sizeof(vec3f_t), NULL, GL_STREAM_DRAW_ARB);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, indexvbos[i]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, maxmodeltris * 3 * sizeof(uint16_t), NULL, GL_STREAM_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, vertvbos[i]);
glBufferData(GL_ARRAY_BUFFER, maxmodelverts * sizeof(vec3f_t), NULL, GL_STREAM_DRAW);
i++;
}
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
allocvbos = r_vbocount;
}

View file

@ -502,12 +502,12 @@ void handle_blend(uint8_t enable, uint8_t blend, uint8_t def)
if (!enable)
{
bglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
return;
}
glblenddef_t const * const glbdef = glblend[blend].def + def;
bglBlendFunc(blendFuncTokens[glbdef->src], blendFuncTokens[glbdef->dst]);
glBlendFunc(blendFuncTokens[glbdef->src], blendFuncTokens[glbdef->dst]);
}
#endif

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -70,7 +70,7 @@ int screencapture(const char *filename, char inverseit)
#ifdef USE_OPENGL
if (HICOLOR)
{
bglReadPixels(0, 0, xdim, ydim, GL_RGB, GL_UNSIGNED_BYTE, imgBuf);
glReadPixels(0, 0, xdim, ydim, GL_RGB, GL_UNSIGNED_BYTE, imgBuf);
int const bytesPerLine = xdim * 3;
if (inverseit)
@ -198,7 +198,7 @@ int screencapture_tga(const char *filename, char inverseit)
int const size = xdim * ydim * 3;
uint8_t *inversebuf = (uint8_t *) Xmalloc(size);
bglReadPixels(0, 0, xdim, ydim, GL_RGB, GL_UNSIGNED_BYTE, inversebuf);
glReadPixels(0, 0, xdim, ydim, GL_RGB, GL_UNSIGNED_BYTE, inversebuf);
for (i = 0; i < size; i += 3)
swapchar(&inversebuf[i], &inversebuf[i + 2]);

View file

@ -17,6 +17,7 @@
#include "palette.h"
#ifdef USE_OPENGL
# include "glad/glad.h"
# include "glbuild.h"
#endif
@ -616,11 +617,18 @@ int32_t initsystem(void)
if (!novideo)
{
#ifdef USE_OPENGL
if (loadgldriver(getenv("BUILD_GLDRV")))
if (SDL_GL_LoadLibrary(0))
{
initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n");
initprintf("Failed loading OpenGL Driver. GL modes will be unavailable. Error: %s\n", SDL_GetError());
nogl = 1;
}
#ifdef POLYMER
if (loadglulibrary(getenv("BUILD_GLULIB")))
{
initprintf("Failed loading GLU. GL modes will be unavailable. Error: %s\n", SDL_GetError());
nogl = 1;
}
#endif
#endif
#ifndef _WIN32
@ -658,7 +666,10 @@ void uninitsystem(void)
#endif
#ifdef USE_OPENGL
unloadgldriver();
SDL_GL_UnloadLibrary();
#ifdef POLYMER
unloadglulibrary();
#endif
#endif
}
@ -1294,20 +1305,20 @@ void sdlayer_setvideomode_opengl(void)
{
polymost_glreset();
bglEnable(GL_TEXTURE_2D);
bglShadeModel(GL_SMOOTH); // GL_FLAT
bglClearColor(0, 0, 0, 1.0); // Black Background
bglHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Use FASTEST for ortho!
// bglHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH); // GL_FLAT
glClearColor(0, 0, 0, 1.0); // Black Background
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); // Use FASTEST for ortho!
// glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
#ifndef EDUKE32_GLES
bglDisable(GL_DITHER);
glDisable(GL_DITHER);
#endif
glinfo.vendor = (const char *) bglGetString(GL_VENDOR);
glinfo.renderer = (const char *) bglGetString(GL_RENDERER);
glinfo.version = (const char *) bglGetString(GL_VERSION);
glinfo.extensions = (const char *) bglGetString(GL_EXTENSIONS);
glinfo.vendor = (const char *) glGetString(GL_VENDOR);
glinfo.renderer = (const char *) glGetString(GL_RENDERER);
glinfo.version = (const char *) glGetString(GL_VERSION);
glinfo.extensions = (const char *) glGetString(GL_EXTENSIONS);
#ifdef POLYMER
if (!Bstrcmp(glinfo.vendor, "ATI Technologies Inc."))
@ -1355,7 +1366,7 @@ void sdlayer_setvideomode_opengl(void)
#if !defined EDUKE32_GLES
glinfo.texcompr = !!Bstrstr(glinfo.extensions, "GL_ARB_texture_compression") && Bstrcmp(glinfo.vendor, "ATI Technologies Inc.");
# ifdef DYNAMIC_GLEXT
if (glinfo.texcompr && (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB))
if (glinfo.texcompr && (!glCompressedTexImage2D || !glGetCompressedTexImage))
{
// lacking the necessary extensions to do this
initprintf("Warning: the GL driver lacks necessary functions to use caching\n");
@ -1394,7 +1405,7 @@ void sdlayer_setvideomode_opengl(void)
#endif
// if (Bstrstr(glinfo.extensions, "GL_EXT_texture_filter_anisotropic"))
bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
if (!glinfo.dumped)
{
@ -1627,14 +1638,12 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
return -1;
}
gladLoadGLLoader(SDL_GL_GetProcAddress);
SDL_SetWindowFullscreen(sdl_window, ((fs & 1) ? SDL_WINDOW_FULLSCREEN : 0));
SDL_GL_SetSwapInterval(vsync_renderlayer);
setrefreshrate();
#ifdef _WIN32
loadglextensions();
#endif
} while (multisamplecheck--);
}
else

View file

@ -93,11 +93,18 @@ int32_t initsystem(void)
char drvname[32];
#ifdef USE_OPENGL
if (loadgldriver(getenv("BUILD_GLDRV")))
if (SDL_GL_LoadLibrary(0))
{
initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n");
nogl = 1;
}
#ifdef POLYMER
if (loadglulibrary(getenv("BUILD_GLULIB")))
{
initprintf("Failed loading GLU. GL modes will be unavailable.\n");
nogl = 1;
}
#endif
#endif
if (SDL_VideoDriverName(drvname, 32))

View file

@ -11,7 +11,7 @@
#include "xxhash.h"
#include "kplib.h"
#define CLEAR_GL_ERRORS() while(bglGetError() != GL_NO_ERROR) { }
#define CLEAR_GL_ERRORS() while(glGetError() != GL_NO_ERROR) { }
#define TEXCACHE_FREEBUFS() { Bfree(pic), Bfree(packbuf), Bfree(midbuf); }
globaltexcache texcache;
@ -23,8 +23,8 @@ static const char *texcache_errors[TEXCACHEERRORS] = {
"out of memory!",
"read too few bytes from cache file",
"dedxtfilter failed",
"bglCompressedTexImage2DARB failed",
"bglGetTexLevelParameteriv failed",
"glCompressedTexImage2DARB failed",
"glGetTexLevelParameteriv failed",
};
static pthtyp *texcache_tryart(int32_t const dapicnum, int32_t const dapalnum, int32_t const dashade, int32_t const dameth)
@ -544,14 +544,14 @@ void texcache_prewritetex(texcacheheader *head)
head->quality = B_LITTLE32(head->quality);
}
#define WRITEX_FAIL_ON_ERROR() if (bglGetError() != GL_NO_ERROR) goto failure
#define WRITEX_FAIL_ON_ERROR() if (glGetError() != GL_NO_ERROR) goto failure
void texcache_writetex_fromdriver(char const * const cacheid, texcacheheader *head)
{
if (!texcache_enabled()) return;
GLint gi = GL_FALSE;
bglGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED_ARB, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_COMPRESSED, &gi);
if (gi != GL_TRUE)
{
static GLint glGetTexLevelParameterivOK = GL_TRUE;
@ -581,12 +581,12 @@ void texcache_writetex_fromdriver(char const * const cacheid, texcacheheader *he
for (uint32_t level = 0, padx = 0, pady = 0; level == 0 || (padx > 1 || pady > 1); ++level)
{
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_ARB, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED, &gi);
WRITEX_FAIL_ON_ERROR();
if (gi != GL_TRUE)
goto failure; // an uncompressed mipmap
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &gi);
WRITEX_FAIL_ON_ERROR();
#if defined __APPLE__ && defined POLYMER
@ -595,25 +595,25 @@ void texcache_writetex_fromdriver(char const * const cacheid, texcacheheader *he
// native -> external (little endian)
pict.format = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_WIDTH, &gi);
WRITEX_FAIL_ON_ERROR();
padx = gi;
pict.xdim = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_HEIGHT, &gi);
WRITEX_FAIL_ON_ERROR();
pady = gi;
pict.ydim = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_BORDER, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_BORDER, &gi);
WRITEX_FAIL_ON_ERROR();
pict.border = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_DEPTH, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_DEPTH, &gi);
WRITEX_FAIL_ON_ERROR();
pict.depth = B_LITTLE32(gi);
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB, &gi);
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_COMPRESSED_IMAGE_SIZE, &gi);
WRITEX_FAIL_ON_ERROR();
uint32_t miplen = gi;
pict.size = B_LITTLE32(gi);
@ -626,7 +626,7 @@ void texcache_writetex_fromdriver(char const * const cacheid, texcacheheader *he
midbuf = (void *)Xrealloc(midbuf, miplen);
}
bglGetCompressedTexImageARB(GL_TEXTURE_2D, level, pic);
glGetCompressedTexImage(GL_TEXTURE_2D, level, pic);
WRITEX_FAIL_ON_ERROR();
if (Bwrite(texcache.handle, &pict, sizeof(texcachepicture)) != sizeof(texcachepicture)) goto failure;
@ -698,11 +698,11 @@ static void texcache_setuptexture(int32_t *doalloc, GLuint *glpic)
{
if (*doalloc&1)
{
bglGenTextures(1, glpic); //# of textures (make OpenGL allocate structure)
*doalloc |= 2; // prevents bglGenTextures being called again if we fail in here
glGenTextures(1, glpic); //# of textures (make OpenGL allocate structure)
*doalloc |= 2; // prevents glGenTextures being called again if we fail in here
}
bglBindTexture(GL_TEXTURE_2D, *glpic);
glBindTexture(GL_TEXTURE_2D, *glpic);
}
static int32_t texcache_loadmips(const texcacheheader *head, GLenum *glerr)
@ -751,16 +751,16 @@ static int32_t texcache_loadmips(const texcacheheader *head, GLenum *glerr)
return TEXCACHERR_DEDXT;
}
bglCompressedTexImage2DARB(GL_TEXTURE_2D, level, pict.format, pict.xdim, pict.ydim, pict.border, pict.size, pic);
if ((*glerr=bglGetError()) != GL_NO_ERROR)
glCompressedTexImage2D(GL_TEXTURE_2D, level, pict.format, pict.xdim, pict.ydim, pict.border, pict.size, pic);
if ((*glerr=glGetError()) != GL_NO_ERROR)
{
TEXCACHE_FREEBUFS();
return TEXCACHERR_COMPTEX;
}
GLint format;
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format);
if ((*glerr = bglGetError()) != GL_NO_ERROR)
glGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format);
if ((*glerr = glGetError()) != GL_NO_ERROR)
{
TEXCACHE_FREEBUFS();
return TEXCACHERR_GETTEXLEVEL;

View file

@ -4,7 +4,7 @@
#include "compat.h"
#include "build.h"
#include "glbuild.h"
#include "glad/glad.h"
#include "pragmas.h"
#include "baselayer.h"
#include "engine_priv.h"
@ -71,11 +71,11 @@ uint32_t gloadtex(int32_t *picbuf, int32_t xsiz, int32_t ysiz, int32_t is8bit, i
uint32_t rtexid;
bglGenTextures(1, (GLuint *) &rtexid);
bglBindTexture(GL_TEXTURE_2D, rtexid);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
bglTexImage2D(GL_TEXTURE_2D, 0, 4, xsiz, ysiz, 0, GL_RGBA, GL_UNSIGNED_BYTE, (char *) pic2);
glGenTextures(1, (GLuint *) &rtexid);
glBindTexture(GL_TEXTURE_2D, rtexid);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexImage2D(GL_TEXTURE_2D, 0, 4, xsiz, ysiz, 0, GL_RGBA, GL_UNSIGNED_BYTE, (char *) pic2);
Bfree(pic2);
@ -954,21 +954,21 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
if (tspr->extra&TSPR_EXTRA_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// bglDepthRange(0.0, 0.9999);
glDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// glDepthRange(0.0, 0.9999);
}
// bglPushAttrib(GL_POLYGON_BIT);
// glPushAttrib(GL_POLYGON_BIT);
if ((grhalfxdown10x >= 0) /*^ ((globalorientation&8) != 0) ^ ((globalorientation&4) != 0)*/)
bglFrontFace(GL_CW);
glFrontFace(GL_CW);
else
bglFrontFace(GL_CCW);
glFrontFace(GL_CCW);
bglEnable(GL_CULL_FACE);
bglCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
bglEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
float pc[4];
@ -982,7 +982,7 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
handle_blend(!!(tspr->cstat & 2), tspr->blend, !!(tspr->cstat & 512));
if ((tspr->cstat&2) || spriteext[tspr->owner].alpha > 0.f || pc[3] < 1.0f)
bglEnable(GL_BLEND); //else bglDisable(GL_BLEND);
glEnable(GL_BLEND); //else glDisable(GL_BLEND);
//------------
//transform to Build coords
@ -998,10 +998,10 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
mat[13] -= (m->piv.x*mat[1] + m->piv.y*mat[5] + (m->piv.z+m->siz.z*.5f)*mat[9]);
mat[14] -= (m->piv.x*mat[2] + m->piv.y*mat[6] + (m->piv.z+m->siz.z*.5f)*mat[10]);
//
bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
glMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f;
bglLoadMatrixf(mat);
glLoadMatrixf(mat);
const float ru = 1.f/((float)m->mytexx);
const float rv = 1.f/((float)m->mytexy);
@ -1014,16 +1014,16 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
if (!m->texid[globalpal])
m->texid[globalpal] = gloadtex(m->mytex, m->mytexx, m->mytexy, m->is8bit, globalpal);
else
bglBindTexture(GL_TEXTURE_2D, m->texid[globalpal]);
glBindTexture(GL_TEXTURE_2D, m->texid[globalpal]);
bglBegin(GL_QUADS); // {{{
glBegin(GL_QUADS); // {{{
for (bssize_t i=0, fi=0; i<m->qcnt; i++)
{
if (i == m->qfacind[fi])
{
f = 1 /*clut[fi++]*/;
bglColor4f(pc[0]*f, pc[1]*f, pc[2]*f, pc[3]*f);
glColor4f(pc[0]*f, pc[1]*f, pc[2]*f, pc[3]*f);
}
const vert_t *const vptr = &m->quad[i].v[0];
@ -1036,30 +1036,30 @@ int32_t polymost_voxdraw(voxmodel_t *m, const uspritetype *tspr)
{
vec3f_t fp;
#if (VOXBORDWIDTH == 0)
bglTexCoord2f(((float)vptr[j].u)*ru + uhack[vptr[j].u!=vptr[0].u],
glTexCoord2f(((float)vptr[j].u)*ru + uhack[vptr[j].u!=vptr[0].u],
((float)vptr[j].v)*rv + vhack[vptr[j].v!=vptr[0].v]);
#else
bglTexCoord2f(((float)vptr[j].u)*ru, ((float)vptr[j].v)*rv);
glTexCoord2f(((float)vptr[j].u)*ru, ((float)vptr[j].v)*rv);
#endif
fp.x = ((float)vptr[j].x) - phack[xx>vptr[j].x*2] + phack[xx<vptr[j].x*2];
fp.y = ((float)vptr[j].y) - phack[yy>vptr[j].y*2] + phack[yy<vptr[j].y*2];
fp.z = ((float)vptr[j].z) - phack[zz>vptr[j].z*2] + phack[zz<vptr[j].z*2];
bglVertex3fv((float *)&fp);
glVertex3fv((float *)&fp);
}
}
bglEnd(); // }}}
glEnd(); // }}}
//------------
bglDisable(GL_CULL_FACE);
// bglPopAttrib();
glDisable(GL_CULL_FACE);
// glPopAttrib();
if (tspr->extra&TSPR_EXTRA_MDHACK)
{
bglDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// bglDepthRange(0.0, 0.99999);
glDepthFunc(GL_LESS); //NEVER,LESS,(,L)EQUAL,GREATER,(NOT,G)EQUAL,ALWAYS
// glDepthRange(0.0, 0.99999);
}
bglLoadIdentity();
glLoadIdentity();
return 1;
}

View file

@ -5,6 +5,11 @@
#include "build.h"
#ifdef USE_OPENGL
#include "glbuild.h"
#include "glad/glad_wgl.h"
#endif
#define NEED_DINPUT_H
#define NEED_DDRAW_H
#ifdef _MSC_VER
@ -488,7 +493,7 @@ int32_t initsystem(void)
win_init();
#ifdef USE_OPENGL
if (loadgldriver(getenv("BUILD_GLDRV")))
if (loadwgl(getenv("BUILD_GLDRV")))
{
initprintf("Failure loading OpenGL. GL modes are unavailable.\n");
nogl = 1;
@ -539,7 +544,12 @@ void uninitsystem(void)
win_uninit();
#ifdef USE_OPENGL
unloadgldriver();
//POGO: there is no equivalent to unloadgldriver() with GLAD's loader, but this shouldn't be a problem.
//unloadgldriver();
unloadwgl();
#ifdef POLYMER
unloadglulibrary();
#endif
#endif
}
@ -1631,7 +1641,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
}
#if defined USE_OPENGL && defined USE_GLEXT
if (hGLWindow && glinfo.vsync) bwglSwapIntervalEXT(vsync_renderlayer);
if (hGLWindow && glinfo.vsync) wglSwapIntervalEXT(vsync_renderlayer);
#endif
if (inp) AcquireInputDevices(1);
modechange=1;
@ -1667,7 +1677,7 @@ int32_t setvsync(int32_t newSync)
return 0;
}
# ifdef USE_GLEXT
bwglSwapIntervalEXT(newSync);
wglSwapIntervalEXT(newSync);
# endif
#endif
@ -1902,7 +1912,7 @@ void showframe(int32_t w)
if (palfadedelta)
fullscreen_tint_gl(palfadergb.r, palfadergb.g, palfadergb.b, palfadedelta);
bwglSwapBuffers(hDC);
SwapBuffers(hDC);
return;
}
#endif
@ -2568,8 +2578,8 @@ static void ReleaseOpenGL(void)
if (hGLRC)
{
polymost_glreset();
if (!bwglMakeCurrent(0,0)) { }
if (!bwglDeleteContext(hGLRC)) { }
if (!wglMakeCurrent(0,0)) { }
if (!wglDeleteContext(hGLRC)) { }
hGLRC = NULL;
}
if (hGLWindow)
@ -2650,7 +2660,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
minidriver = Bstrcasecmp(gldriver,"opengl32.dll");
if (minidriver) PixelFormat = bwglChoosePixelFormat(hDC,&pfd);
if (minidriver) PixelFormat = wglChoosePixelFormat(hDC,&pfd);
else PixelFormat = ChoosePixelFormat(hDC,&pfd);
if (!PixelFormat)
{
@ -2659,7 +2669,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
return TRUE;
}
if (minidriver) err = bwglSetPixelFormat(hDC, PixelFormat, &pfd);
if (minidriver) err = wglSetPixelFormat(hDC, PixelFormat, &pfd);
else err = SetPixelFormat(hDC, PixelFormat, &pfd);
if (!err)
{
@ -2668,7 +2678,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
return TRUE;
}
hGLRC = bwglCreateContext(hDC);
hGLRC = wglCreateContext(hDC);
if (!hGLRC)
{
@ -2677,19 +2687,40 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
return TRUE;
}
if (!bwglMakeCurrent(hDC, hGLRC))
if (!wglMakeCurrent(hDC, hGLRC))
{
ReleaseOpenGL();
ShowErrorBox("Can't activate GL RC");
return TRUE;
}
loadglextensions();
static int32_t glLoaded = 0;
if (!glLoaded)
{
if (!gladLoadWGL(hDC) || !gladLoadGL())
{
initprintf("Failure loading OpenGL. GL modes are unavailable.\n");
nogl = 1;
ReleaseOpenGL();
return TRUE;
#ifdef POLYMER
} else if (loadglulibrary(getenv("BUILD_GLULIB")))
{
initprintf("Failure loading GLU. GL modes are unavailable.\n");
nogl = 1;
ReleaseOpenGL();
return TRUE;
#endif
} else
{
glLoaded = 1;
}
}
# if defined DEBUGGINGAIDS && defined USE_GLEXT
// We should really be checking for the new WGL extension string instead
// Enable this to leverage ARB_debug_output
if (bwglCreateContextAttribsARB) {
if (wglCreateContextAttribsARB) {
HGLRC debuggingContext = hGLRC;
// This corresponds to WGL_CONTEXT_FLAGS_ARB set to WGL_CONTEXT_DEBUG_BIT_ARB
@ -2699,37 +2730,34 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
0
};
debuggingContext = bwglCreateContextAttribsARB(hDC, NULL, attribs);
debuggingContext = wglCreateContextAttribsARB(hDC, NULL, attribs);
if (debuggingContext) {
bwglDeleteContext(hGLRC);
bwglMakeCurrent(hDC, debuggingContext);
wglDeleteContext(hGLRC);
wglMakeCurrent(hDC, debuggingContext);
hGLRC = debuggingContext;
// This should be able to get the ARB_debug_output symbols
loadglextensions();
}
}
# endif
polymost_glreset();
bglEnable(GL_TEXTURE_2D);
bglShadeModel(GL_SMOOTH); //GL_FLAT
bglClearColor(0,0,0,0.5); //Black Background
bglHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); //Use FASTEST for ortho!
bglHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
bglHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
bglDisable(GL_DITHER);
glEnable(GL_TEXTURE_2D);
glShadeModel(GL_SMOOTH); //GL_FLAT
glClearColor(0,0,0,0.5); //Black Background
glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST); //Use FASTEST for ortho!
glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
glDisable(GL_DITHER);
{
GLubyte *p,*p2,*p3;
int32_t err = 0;
glinfo.vendor = (char const *)bglGetString(GL_VENDOR);
glinfo.renderer = (char const *)bglGetString(GL_RENDERER);
glinfo.version = (char const *)bglGetString(GL_VERSION);
glinfo.extensions = (char const *)bglGetString(GL_EXTENSIONS);
glinfo.vendor = (char const *)glGetString(GL_VENDOR);
glinfo.renderer = (char const *)glGetString(GL_RENDERER);
glinfo.version = (char const *)glGetString(GL_VERSION);
glinfo.extensions = (char const *)glGetString(GL_EXTENSIONS);
// GL driver blacklist
@ -2779,7 +2807,9 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
OSD_Printf("Unsupported OpenGL driver detected. GL modes will be unavailable. Use -forcegl to override.\n");
wm_msgbox("Unsupported OpenGL driver", "Unsupported OpenGL driver detected. GL modes will be unavailable.");
ReleaseOpenGL();
unloadgldriver();
//POGO: there is no equivalent to unloadgldriver() with GLAD's loader, but this shouldn't be a problem.
//unloadgldriver();
unloadwgl();
nogl = 1;
modeschecked = 0;
getvalidmodes();
@ -2798,7 +2828,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
if (!Bstrcmp((char *)p2, "GL_EXT_texture_filter_anisotropic"))
{
// supports anisotropy. get the maximum anisotropy level
bglGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &glinfo.maxanisotropy);
}
else if (!Bstrcmp((char *)p2, "GL_EXT_texture_edge_clamp") ||
!Bstrcmp((char *)p2, "GL_SGIS_texture_edge_clamp"))
@ -2817,7 +2847,7 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
glinfo.texcompr = 1;
#ifdef DYNAMIC_GLEXT
if (!bglCompressedTexImage2DARB || !bglGetCompressedTexImageARB)
if (!glCompressedTexImage2D || !glGetCompressedTexImage)
{
// lacking the necessary extensions to do this
initprintf("Warning: the GL driver lacks necessary functions to use caching\n");

View file

@ -2362,7 +2362,7 @@ static void m32_showmouse(void)
if (getrendermode() >= REND_POLYMOST)
{
push_nofog();
bglDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_2D);
}
#endif
@ -2509,15 +2509,15 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
static inline void pushDisableFog(void)
{
#ifdef USE_OPENGL
bglPushAttrib(GL_ENABLE_BIT);
bglDisable(GL_FOG);
glPushAttrib(GL_ENABLE_BIT);
glDisable(GL_FOG);
#endif
}
static inline void popDisableFog(void)
{
#ifdef USE_OPENGL
bglPopAttrib();
glPopAttrib();
#endif
}
@ -3264,7 +3264,7 @@ static int32_t OnSelectTile(int32_t tileNum)
setpolymost2dview();
#ifdef USE_OPENGL
bglEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
#endif
clearview(-1);
@ -3497,10 +3497,10 @@ static int32_t DrawTiles(int32_t iTopLeft, int32_t iSelected, int32_t nXTiles, i
if (getrendermode() >= REND_POLYMOST)
{
bglEnable(GL_TEXTURE_2D);
glEnable(GL_TEXTURE_2D);
if (lazyselector)
bglDrawBuffer(GL_FRONT_AND_BACK);
glDrawBuffer(GL_FRONT_AND_BACK);
}
#endif
clearview(-1);
@ -3577,7 +3577,7 @@ restart:
showframe(1);
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && lazyselector)
bglDrawBuffer(GL_BACK);
glDrawBuffer(GL_BACK);
#endif
return 1;
}
@ -3609,7 +3609,7 @@ restart:
#ifdef USE_OPENGL
if (getrendermode() >= REND_POLYMOST && lazyselector)
bglDrawBuffer(GL_BACK);
glDrawBuffer(GL_BACK);
#endif
return 0;

View file

@ -62,7 +62,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# include <shellapi.h>
# define UPDATEINTERVAL 604800 // 1w
# include "winbits.h"
@ -670,7 +670,7 @@ static void G_ReadGLFrame(void)
}
begindrawing();
bglReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame);
glReadPixels(0, 0, xdim, ydim, GL_RGBA, GL_UNSIGNED_BYTE, frame);
enddrawing();
for (y = 0; y < 200; y++)

View file

@ -145,18 +145,18 @@ void GAME_clearbackground(int32_t numcols, int32_t numrows)
if (getrendermode() >= REND_POLYMOST && qsetmode==200)
{
const int32_t i8n8 = OSD_SCALE(OSDCHAR_HEIGHT*numrows);
// bglPushAttrib(GL_FOG_BIT);
bglDisable(GL_FOG);
// glPushAttrib(GL_FOG_BIT);
glDisable(GL_FOG);
setpolymost2dview();
bglColor4f(0.f, 0.f, 0.f, 0.67f);
bglEnable(GL_BLEND);
bglRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT);
bglColor4f(0.f, 0.f, 0.f, 1.f);
bglRecti(0, i8n8+4, xdim, i8n8+OSDCHAR_HEIGHT);
glColor4f(0.f, 0.f, 0.f, 0.67f);
glEnable(GL_BLEND);
glRecti(0, 0, xdim, i8n8+OSDCHAR_HEIGHT);
glColor4f(0.f, 0.f, 0.f, 1.f);
glRecti(0, i8n8+4, xdim, i8n8+OSDCHAR_HEIGHT);
if (!nofog)
bglEnable(GL_FOG);
// bglPopAttrib();
glEnable(GL_FOG);
// glPopAttrib();
return;
}

3
source/glad/README.TXT Normal file
View file

@ -0,0 +1,3 @@
Generated with GLAD (GL/GLES/EGL/GLX/WGL Loader-Generator):
GL: http://glad.dav1d.de/#profile=compatibility&api=gl%3D2.0&api=gles1%3D1.0&api=gles2%3D2.0&api=glsc2%3Dnone&extensions=GL_ARB_buffer_storage&extensions=GL_ARB_debug_output&extensions=GL_ARB_map_buffer_range&extensions=GL_ARB_texture_rectangle&extensions=GL_EXT_fog_coord&extensions=GL_EXT_framebuffer_object&extensions=GL_EXT_texture_compression_s3tc&extensions=GL_EXT_texture_filter_anisotropic&extensions=GL_NV_fog_distance&extensions=GL_NV_multisample_filter_hint&extensions=GL_SGIS_fog_function&extensions=GL_SGIX_fog_offset&language=c&specification=gl&loader=on
WGL: http://glad.dav1d.de/#specification=wgl&api=wgl%3D1.0&extensions=WGL_ARB_create_context&extensions=WGL_ARB_create_context_profile&extensions=WGL_ARB_extensions_string&extensions=WGL_ARB_pixel_format&extensions=WGL_EXT_extensions_string&extensions=WGL_EXT_swap_control&language=c&loader=on

View file

@ -0,0 +1,284 @@
#ifndef __khrplatform_h_
#define __khrplatform_h_
/*
** Copyright (c) 2008-2009 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
** "Materials"), to deal in the Materials without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Materials, and to
** permit persons to whom the Materials are furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be included
** in all copies or substantial portions of the Materials.
**
** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
*/
/* Khronos platform-specific types and definitions.
*
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
* group so that they can be included in future versions of this file.
* Please submit changes by sending them to the public Khronos Bugzilla
* (http://khronos.org/bugzilla) by filing a bug against product
* "Khronos (general)" component "Registry".
*
* A predefined template which fills in some of the bug fields can be
* reached using http://tinyurl.com/khrplatform-h-bugreport, but you
* must create a Bugzilla login first.
*
*
* See the Implementer's Guidelines for information about where this file
* should be located on your system and for more details of its use:
* http://www.khronos.org/registry/implementers_guide.pdf
*
* This file should be included as
* #include <KHR/khrplatform.h>
* by Khronos client API header files that use its types and defines.
*
* The types in khrplatform.h should only be used to define API-specific types.
*
* Types defined in khrplatform.h:
* khronos_int8_t signed 8 bit
* khronos_uint8_t unsigned 8 bit
* khronos_int16_t signed 16 bit
* khronos_uint16_t unsigned 16 bit
* khronos_int32_t signed 32 bit
* khronos_uint32_t unsigned 32 bit
* khronos_int64_t signed 64 bit
* khronos_uint64_t unsigned 64 bit
* khronos_intptr_t signed same number of bits as a pointer
* khronos_uintptr_t unsigned same number of bits as a pointer
* khronos_ssize_t signed size
* khronos_usize_t unsigned size
* khronos_float_t signed 32 bit floating point
* khronos_time_ns_t unsigned 64 bit time in nanoseconds
* khronos_utime_nanoseconds_t unsigned time interval or absolute time in
* nanoseconds
* khronos_stime_nanoseconds_t signed time interval in nanoseconds
* khronos_boolean_enum_t enumerated boolean type. This should
* only be used as a base type when a client API's boolean type is
* an enum. Client APIs which use an integer or other type for
* booleans cannot use this as the base type for their boolean.
*
* Tokens defined in khrplatform.h:
*
* KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
*
* KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
* KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
*
* Calling convention macros defined in this file:
* KHRONOS_APICALL
* KHRONOS_APIENTRY
* KHRONOS_APIATTRIBUTES
*
* These may be used in function prototypes as:
*
* KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
* int arg1,
* int arg2) KHRONOS_APIATTRIBUTES;
*/
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APICALL
*-------------------------------------------------------------------------
* This precedes the return type of the function in the function prototype.
*/
#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# define KHRONOS_APICALL __attribute__((visibility("default")))
#else
# define KHRONOS_APICALL
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIENTRY
*-------------------------------------------------------------------------
* This follows the return type of the function and precedes the function
* name in the function prototype.
*/
#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
/* Win32 but not WinCE */
# define KHRONOS_APIENTRY __stdcall
#else
# define KHRONOS_APIENTRY
#endif
/*-------------------------------------------------------------------------
* Definition of KHRONOS_APIATTRIBUTES
*-------------------------------------------------------------------------
* This follows the closing parenthesis of the function prototype arguments.
*/
#if defined (__ARMCC_2__)
#define KHRONOS_APIATTRIBUTES __softfp
#else
#define KHRONOS_APIATTRIBUTES
#endif
/*-------------------------------------------------------------------------
* basic type definitions
*-----------------------------------------------------------------------*/
#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
/*
* Using <stdint.h>
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__VMS ) || defined(__sgi)
/*
* Using <inttypes.h>
*/
#include <inttypes.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
/*
* Win32
*/
typedef __int32 khronos_int32_t;
typedef unsigned __int32 khronos_uint32_t;
typedef __int64 khronos_int64_t;
typedef unsigned __int64 khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif defined(__sun__) || defined(__digital__)
/*
* Sun or Digital
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#if defined(__arch64__) || defined(_LP64)
typedef long int khronos_int64_t;
typedef unsigned long int khronos_uint64_t;
#else
typedef long long int khronos_int64_t;
typedef unsigned long long int khronos_uint64_t;
#endif /* __arch64__ */
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#elif 0
/*
* Hypothetical platform with no float or int64 support
*/
typedef int khronos_int32_t;
typedef unsigned int khronos_uint32_t;
#define KHRONOS_SUPPORT_INT64 0
#define KHRONOS_SUPPORT_FLOAT 0
#else
/*
* Generic fallback
*/
#include <stdint.h>
typedef int32_t khronos_int32_t;
typedef uint32_t khronos_uint32_t;
typedef int64_t khronos_int64_t;
typedef uint64_t khronos_uint64_t;
#define KHRONOS_SUPPORT_INT64 1
#define KHRONOS_SUPPORT_FLOAT 1
#endif
/*
* Types that are (so far) the same on all platforms
*/
typedef signed char khronos_int8_t;
typedef unsigned char khronos_uint8_t;
typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
#ifdef _WIN64
typedef signed long long int khronos_intptr_t;
typedef unsigned long long int khronos_uintptr_t;
typedef signed long long int khronos_ssize_t;
typedef unsigned long long int khronos_usize_t;
#else
typedef signed long int khronos_intptr_t;
typedef unsigned long int khronos_uintptr_t;
typedef signed long int khronos_ssize_t;
typedef unsigned long int khronos_usize_t;
#endif
#if KHRONOS_SUPPORT_FLOAT
/*
* Float type
*/
typedef float khronos_float_t;
#endif
#if KHRONOS_SUPPORT_INT64
/* Time types
*
* These types can be used to represent a time interval in nanoseconds or
* an absolute Unadjusted System Time. Unadjusted System Time is the number
* of nanoseconds since some arbitrary system event (e.g. since the last
* time the system booted). The Unadjusted System Time is an unsigned
* 64 bit value that wraps back to 0 every 584 years. Time intervals
* may be either signed or unsigned.
*/
typedef khronos_uint64_t khronos_utime_nanoseconds_t;
typedef khronos_int64_t khronos_stime_nanoseconds_t;
#endif
/*
* Dummy value used to pad enum types to 32 bits.
*/
#ifndef KHRONOS_MAX_ENUM
#define KHRONOS_MAX_ENUM 0x7FFFFFFF
#endif
/*
* Enumerated boolean type
*
* Values other than zero should be considered to be true. Therefore
* comparisons should not be made against KHRONOS_TRUE.
*/
typedef enum {
KHRONOS_FALSE = 0,
KHRONOS_TRUE = 1,
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,220 @@
/*
WGL loader generated by glad 0.1.16a0 on Sat Jan 27 08:40:53 2018.
Language/Generator: C/C++
Specification: wgl
APIs: wgl=1.0
Profile: -
Extensions:
WGL_ARB_create_context,
WGL_ARB_create_context_profile,
WGL_ARB_extensions_string,
WGL_ARB_pixel_format,
WGL_EXT_extensions_string,
WGL_EXT_swap_control
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
--api="wgl=1.0" --generator="c" --spec="wgl" --extensions="WGL_ARB_create_context,WGL_ARB_create_context_profile,WGL_ARB_extensions_string,WGL_ARB_pixel_format,WGL_EXT_extensions_string,WGL_EXT_swap_control"
Online:
http://glad.dav1d.de/#language=c&specification=wgl&loader=on&api=wgl%3D1.0&extensions=WGL_ARB_create_context&extensions=WGL_ARB_create_context_profile&extensions=WGL_ARB_extensions_string&extensions=WGL_ARB_pixel_format&extensions=WGL_EXT_extensions_string&extensions=WGL_EXT_swap_control
*/
#ifndef WINAPI
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#ifndef NOMINMAX
#define NOMINMAX 1
#endif
#include <windows.h>
#endif
#include <glad/glad.h>
#ifndef __glad_wglext_h_
#ifdef __wglext_h_
#error WGL header already included, remove this include, glad already provides it
#endif
#define __glad_wglext_h_
#define __wglext_h_
#ifndef APIENTRY
#define APIENTRY
#endif
#ifndef APIENTRYP
#define APIENTRYP APIENTRY *
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef void* (* GLADloadproc)(const char *name);
#ifndef GLAPI
# if defined(GLAD_GLAPI_EXPORT)
# if defined(_WIN32) || defined(__CYGWIN__)
# if defined(GLAD_GLAPI_EXPORT_BUILD)
# if defined(__GNUC__)
# define GLAPI __attribute__ ((dllexport)) extern
# else
# define GLAPI __declspec(dllexport) extern
# endif
# else
# if defined(__GNUC__)
# define GLAPI __attribute__ ((dllimport)) extern
# else
# define GLAPI __declspec(dllimport) extern
# endif
# endif
# elif defined(__GNUC__) && defined(GLAD_GLAPI_EXPORT_BUILD)
# define GLAPI __attribute__ ((visibility ("default"))) extern
# else
# define GLAPI extern
# endif
# else
# define GLAPI extern
# endif
#endif
GLAPI int gladLoadWGL(HDC hdc);
GLAPI int gladLoadWGLLoader(GLADloadproc, HDC hdc);
struct _GPU_DEVICE {
DWORD cb;
CHAR DeviceName[32];
CHAR DeviceString[128];
DWORD Flags;
RECT rcVirtualScreen;
};
DECLARE_HANDLE(HPBUFFERARB);
DECLARE_HANDLE(HPBUFFEREXT);
DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
DECLARE_HANDLE(HPVIDEODEV);
DECLARE_HANDLE(HPGPUNV);
DECLARE_HANDLE(HGPUNV);
DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
typedef struct _GPU_DEVICE GPU_DEVICE;
typedef struct _GPU_DEVICE *PGPU_DEVICE;
#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
#define WGL_CONTEXT_FLAGS_ARB 0x2094
#define ERROR_INVALID_VERSION_ARB 0x2095
#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
#define ERROR_INVALID_PROFILE_ARB 0x2096
#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
#define WGL_DRAW_TO_BITMAP_ARB 0x2002
#define WGL_ACCELERATION_ARB 0x2003
#define WGL_NEED_PALETTE_ARB 0x2004
#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
#define WGL_SWAP_METHOD_ARB 0x2007
#define WGL_NUMBER_OVERLAYS_ARB 0x2008
#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
#define WGL_TRANSPARENT_ARB 0x200A
#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
#define WGL_SHARE_DEPTH_ARB 0x200C
#define WGL_SHARE_STENCIL_ARB 0x200D
#define WGL_SHARE_ACCUM_ARB 0x200E
#define WGL_SUPPORT_GDI_ARB 0x200F
#define WGL_SUPPORT_OPENGL_ARB 0x2010
#define WGL_DOUBLE_BUFFER_ARB 0x2011
#define WGL_STEREO_ARB 0x2012
#define WGL_PIXEL_TYPE_ARB 0x2013
#define WGL_COLOR_BITS_ARB 0x2014
#define WGL_RED_BITS_ARB 0x2015
#define WGL_RED_SHIFT_ARB 0x2016
#define WGL_GREEN_BITS_ARB 0x2017
#define WGL_GREEN_SHIFT_ARB 0x2018
#define WGL_BLUE_BITS_ARB 0x2019
#define WGL_BLUE_SHIFT_ARB 0x201A
#define WGL_ALPHA_BITS_ARB 0x201B
#define WGL_ALPHA_SHIFT_ARB 0x201C
#define WGL_ACCUM_BITS_ARB 0x201D
#define WGL_ACCUM_RED_BITS_ARB 0x201E
#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
#define WGL_DEPTH_BITS_ARB 0x2022
#define WGL_STENCIL_BITS_ARB 0x2023
#define WGL_AUX_BUFFERS_ARB 0x2024
#define WGL_NO_ACCELERATION_ARB 0x2025
#define WGL_GENERIC_ACCELERATION_ARB 0x2026
#define WGL_FULL_ACCELERATION_ARB 0x2027
#define WGL_SWAP_EXCHANGE_ARB 0x2028
#define WGL_SWAP_COPY_ARB 0x2029
#define WGL_SWAP_UNDEFINED_ARB 0x202A
#define WGL_TYPE_RGBA_ARB 0x202B
#define WGL_TYPE_COLORINDEX_ARB 0x202C
#ifndef WGL_ARB_create_context
#define WGL_ARB_create_context 1
GLAPI int GLAD_WGL_ARB_create_context;
typedef HGLRC (APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC)(HDC hDC, HGLRC hShareContext, const int *attribList);
GLAPI PFNWGLCREATECONTEXTATTRIBSARBPROC glad_wglCreateContextAttribsARB;
#define wglCreateContextAttribsARB glad_wglCreateContextAttribsARB
#endif
#ifndef WGL_ARB_create_context_profile
#define WGL_ARB_create_context_profile 1
GLAPI int GLAD_WGL_ARB_create_context_profile;
#endif
#ifndef WGL_ARB_extensions_string
#define WGL_ARB_extensions_string 1
GLAPI int GLAD_WGL_ARB_extensions_string;
typedef const char * (APIENTRYP PFNWGLGETEXTENSIONSSTRINGARBPROC)(HDC hdc);
GLAPI PFNWGLGETEXTENSIONSSTRINGARBPROC glad_wglGetExtensionsStringARB;
#define wglGetExtensionsStringARB glad_wglGetExtensionsStringARB
#endif
#ifndef WGL_ARB_pixel_format
#define WGL_ARB_pixel_format 1
GLAPI int GLAD_WGL_ARB_pixel_format;
typedef BOOL (APIENTRYP PFNWGLGETPIXELFORMATATTRIBIVARBPROC)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
GLAPI PFNWGLGETPIXELFORMATATTRIBIVARBPROC glad_wglGetPixelFormatAttribivARB;
#define wglGetPixelFormatAttribivARB glad_wglGetPixelFormatAttribivARB
typedef BOOL (APIENTRYP PFNWGLGETPIXELFORMATATTRIBFVARBPROC)(HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
GLAPI PFNWGLGETPIXELFORMATATTRIBFVARBPROC glad_wglGetPixelFormatAttribfvARB;
#define wglGetPixelFormatAttribfvARB glad_wglGetPixelFormatAttribfvARB
typedef BOOL (APIENTRYP PFNWGLCHOOSEPIXELFORMATARBPROC)(HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
GLAPI PFNWGLCHOOSEPIXELFORMATARBPROC glad_wglChoosePixelFormatARB;
#define wglChoosePixelFormatARB glad_wglChoosePixelFormatARB
#endif
#ifndef WGL_EXT_extensions_string
#define WGL_EXT_extensions_string 1
GLAPI int GLAD_WGL_EXT_extensions_string;
typedef const char * (APIENTRYP PFNWGLGETEXTENSIONSSTRINGEXTPROC)(void);
GLAPI PFNWGLGETEXTENSIONSSTRINGEXTPROC glad_wglGetExtensionsStringEXT;
#define wglGetExtensionsStringEXT glad_wglGetExtensionsStringEXT
#endif
#ifndef WGL_EXT_swap_control
#define WGL_EXT_swap_control 1
GLAPI int GLAD_WGL_EXT_swap_control;
typedef BOOL (APIENTRYP PFNWGLSWAPINTERVALEXTPROC)(int interval);
GLAPI PFNWGLSWAPINTERVALEXTPROC glad_wglSwapIntervalEXT;
#define wglSwapIntervalEXT glad_wglSwapIntervalEXT
typedef int (APIENTRYP PFNWGLGETSWAPINTERVALEXTPROC)(void);
GLAPI PFNWGLGETSWAPINTERVALEXTPROC glad_wglGetSwapIntervalEXT;
#define wglGetSwapIntervalEXT glad_wglGetSwapIntervalEXT
#endif
#ifdef __cplusplus
}
#endif
#endif

2031
source/glad/src/glad.c Normal file

File diff suppressed because it is too large Load diff

250
source/glad/src/glad_wgl.c Normal file
View file

@ -0,0 +1,250 @@
/*
WGL loader generated by glad 0.1.16a0 on Sat Jan 27 08:40:53 2018.
Language/Generator: C/C++
Specification: wgl
APIs: wgl=1.0
Profile: -
Extensions:
WGL_ARB_create_context,
WGL_ARB_create_context_profile,
WGL_ARB_extensions_string,
WGL_ARB_pixel_format,
WGL_EXT_extensions_string,
WGL_EXT_swap_control
Loader: True
Local files: False
Omit khrplatform: False
Commandline:
--api="wgl=1.0" --generator="c" --spec="wgl" --extensions="WGL_ARB_create_context,WGL_ARB_create_context_profile,WGL_ARB_extensions_string,WGL_ARB_pixel_format,WGL_EXT_extensions_string,WGL_EXT_swap_control"
Online:
http://glad.dav1d.de/#language=c&specification=wgl&loader=on&api=wgl%3D1.0&extensions=WGL_ARB_create_context&extensions=WGL_ARB_create_context_profile&extensions=WGL_ARB_extensions_string&extensions=WGL_ARB_pixel_format&extensions=WGL_EXT_extensions_string&extensions=WGL_EXT_swap_control
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glad/glad_wgl.h>
static void* get_proc(const char *namez);
#ifdef _WIN32
#include <windows.h>
static HMODULE libGL;
typedef void* (APIENTRYP PFNWGLGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNWGLGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
static
int open_gl(void) {
libGL = LoadLibraryW(L"opengl32.dll");
if(libGL != NULL) {
gladGetProcAddressPtr = (PFNWGLGETPROCADDRESSPROC_PRIVATE)GetProcAddress(
libGL, "wglGetProcAddress");
return gladGetProcAddressPtr != NULL;
}
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
FreeLibrary(libGL);
libGL = NULL;
}
}
#else
#include <dlfcn.h>
static void* libGL;
#ifndef __APPLE__
typedef void* (APIENTRYP PFNGLXGETPROCADDRESSPROC_PRIVATE)(const char*);
static PFNGLXGETPROCADDRESSPROC_PRIVATE gladGetProcAddressPtr;
#endif
static
int open_gl(void) {
#ifdef __APPLE__
static const char *NAMES[] = {
"../Frameworks/OpenGL.framework/OpenGL",
"/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/OpenGL",
"/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL"
};
#else
static const char *NAMES[] = {"libGL.so.1", "libGL.so"};
#endif
unsigned int index = 0;
for(index = 0; index < (sizeof(NAMES) / sizeof(NAMES[0])); index++) {
libGL = dlopen(NAMES[index], RTLD_NOW | RTLD_GLOBAL);
if(libGL != NULL) {
#ifdef __APPLE__
return 1;
#else
gladGetProcAddressPtr = (PFNGLXGETPROCADDRESSPROC_PRIVATE)dlsym(libGL,
"glXGetProcAddressARB");
return gladGetProcAddressPtr != NULL;
#endif
}
}
return 0;
}
static
void close_gl(void) {
if(libGL != NULL) {
dlclose(libGL);
libGL = NULL;
}
}
#endif
static
void* get_proc(const char *namez) {
void* result = NULL;
if(libGL == NULL) return NULL;
#ifndef __APPLE__
if(gladGetProcAddressPtr != NULL) {
result = gladGetProcAddressPtr(namez);
}
#endif
if(result == NULL) {
#ifdef _WIN32
result = (void*)GetProcAddress(libGL, namez);
#else
result = dlsym(libGL, namez);
#endif
}
return result;
}
int gladLoadWGL(HDC hdc) {
int status = 0;
if(open_gl()) {
status = gladLoadWGLLoader((GLADloadproc)get_proc, hdc);
close_gl();
}
return status;
}
static HDC GLADWGLhdc = (HDC)INVALID_HANDLE_VALUE;
static int get_exts(void) {
return 1;
}
static void free_exts(void) {
return;
}
static int has_ext(const char *ext) {
const char *terminator;
const char *loc;
const char *extensions;
if(wglGetExtensionsStringEXT == NULL && wglGetExtensionsStringARB == NULL)
return 0;
if(wglGetExtensionsStringARB == NULL || GLADWGLhdc == INVALID_HANDLE_VALUE)
extensions = wglGetExtensionsStringEXT();
else
extensions = wglGetExtensionsStringARB(GLADWGLhdc);
if(extensions == NULL || ext == NULL)
return 0;
while(1) {
loc = strstr(extensions, ext);
if(loc == NULL)
break;
terminator = loc + strlen(ext);
if((loc == extensions || *(loc - 1) == ' ') &&
(*terminator == ' ' || *terminator == '\0'))
{
return 1;
}
extensions = terminator;
}
return 0;
}
int GLAD_WGL_VERSION_1_0;
int GLAD_WGL_EXT_swap_control;
int GLAD_WGL_ARB_pixel_format;
int GLAD_WGL_ARB_create_context_profile;
int GLAD_WGL_ARB_create_context;
int GLAD_WGL_ARB_extensions_string;
int GLAD_WGL_EXT_extensions_string;
PFNWGLCREATECONTEXTATTRIBSARBPROC glad_wglCreateContextAttribsARB;
PFNWGLGETEXTENSIONSSTRINGARBPROC glad_wglGetExtensionsStringARB;
PFNWGLGETPIXELFORMATATTRIBIVARBPROC glad_wglGetPixelFormatAttribivARB;
PFNWGLGETPIXELFORMATATTRIBFVARBPROC glad_wglGetPixelFormatAttribfvARB;
PFNWGLCHOOSEPIXELFORMATARBPROC glad_wglChoosePixelFormatARB;
PFNWGLGETEXTENSIONSSTRINGEXTPROC glad_wglGetExtensionsStringEXT;
PFNWGLSWAPINTERVALEXTPROC glad_wglSwapIntervalEXT;
PFNWGLGETSWAPINTERVALEXTPROC glad_wglGetSwapIntervalEXT;
static void load_WGL_ARB_create_context(GLADloadproc load) {
if(!GLAD_WGL_ARB_create_context) return;
glad_wglCreateContextAttribsARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)load("wglCreateContextAttribsARB");
}
static void load_WGL_ARB_extensions_string(GLADloadproc load) {
if(!GLAD_WGL_ARB_extensions_string) return;
glad_wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)load("wglGetExtensionsStringARB");
}
static void load_WGL_ARB_pixel_format(GLADloadproc load) {
if(!GLAD_WGL_ARB_pixel_format) return;
glad_wglGetPixelFormatAttribivARB = (PFNWGLGETPIXELFORMATATTRIBIVARBPROC)load("wglGetPixelFormatAttribivARB");
glad_wglGetPixelFormatAttribfvARB = (PFNWGLGETPIXELFORMATATTRIBFVARBPROC)load("wglGetPixelFormatAttribfvARB");
glad_wglChoosePixelFormatARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)load("wglChoosePixelFormatARB");
}
static void load_WGL_EXT_extensions_string(GLADloadproc load) {
if(!GLAD_WGL_EXT_extensions_string) return;
glad_wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)load("wglGetExtensionsStringEXT");
}
static void load_WGL_EXT_swap_control(GLADloadproc load) {
if(!GLAD_WGL_EXT_swap_control) return;
glad_wglSwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)load("wglSwapIntervalEXT");
glad_wglGetSwapIntervalEXT = (PFNWGLGETSWAPINTERVALEXTPROC)load("wglGetSwapIntervalEXT");
}
static int find_extensionsWGL(void) {
if (!get_exts()) return 0;
GLAD_WGL_ARB_create_context = has_ext("WGL_ARB_create_context");
GLAD_WGL_ARB_create_context_profile = has_ext("WGL_ARB_create_context_profile");
GLAD_WGL_ARB_extensions_string = has_ext("WGL_ARB_extensions_string");
GLAD_WGL_ARB_pixel_format = has_ext("WGL_ARB_pixel_format");
GLAD_WGL_EXT_extensions_string = has_ext("WGL_EXT_extensions_string");
GLAD_WGL_EXT_swap_control = has_ext("WGL_EXT_swap_control");
free_exts();
return 1;
}
static void find_coreWGL(HDC hdc) {
GLADWGLhdc = hdc;
}
int gladLoadWGLLoader(GLADloadproc load, HDC hdc) {
wglGetExtensionsStringARB = (PFNWGLGETEXTENSIONSSTRINGARBPROC)load("wglGetExtensionsStringARB");
wglGetExtensionsStringEXT = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)load("wglGetExtensionsStringEXT");
if(wglGetExtensionsStringARB == NULL && wglGetExtensionsStringEXT == NULL) return 0;
find_coreWGL(hdc);
if (!find_extensionsWGL()) return 0;
load_WGL_ARB_create_context(load);
load_WGL_ARB_extensions_string(load);
load_WGL_ARB_pixel_format(load);
load_WGL_EXT_extensions_string(load);
load_WGL_EXT_swap_control(load);
return 1;
}

View file

@ -1,7 +1,7 @@
#include "compat.h"
#include "build.h"
#include "glbuild.h"
#include "glad/glad.h"
#include "mdsprite.h"