mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-22 20:51:31 +00:00
begin implementing ref_gl3
so far it can't even be loaded completely and has no code for rendering yet
This commit is contained in:
parent
c901ad9bb6
commit
324eaa8048
9 changed files with 4229 additions and 3 deletions
107
Makefile
107
Makefile
|
@ -310,12 +310,12 @@ endif
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# Phony targets
|
# Phony targets
|
||||||
.PHONY : all client game icon server ref_gl
|
.PHONY : all client game icon server ref_gl ref_gl3
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# Builds everything
|
# Builds everything
|
||||||
all: config client server game ref_gl
|
all: config client server game ref_gl ref_gl3
|
||||||
|
|
||||||
# Print config values
|
# Print config values
|
||||||
config:
|
config:
|
||||||
|
@ -525,7 +525,7 @@ endif
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
# The renderer lib
|
# The OpenGL 1.x renderer lib
|
||||||
|
|
||||||
ifeq ($(OSTYPE), Windows)
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
|
||||||
|
@ -577,6 +577,57 @@ build/ref_gl/%.o: %.c
|
||||||
${Q}mkdir -p $(@D)
|
${Q}mkdir -p $(@D)
|
||||||
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(X11CFLAGS) $(INCLUDE) -o $@ $<
|
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(X11CFLAGS) $(INCLUDE) -o $@ $<
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
|
# The OpenGL 3.x renderer lib
|
||||||
|
|
||||||
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
|
||||||
|
ref_gl3:
|
||||||
|
@echo "===> Building ref_gl3.dll"
|
||||||
|
$(MAKE) release/ref_gl3.dll
|
||||||
|
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
release/ref_gl3.dll : CFLAGS += -DSDL2
|
||||||
|
endif
|
||||||
|
|
||||||
|
# FIXME: -lopengl32 ?? shouldn't be needed, SDL should load it dynamically..
|
||||||
|
release/ref_gl3.dll : LDFLAGS += -shared
|
||||||
|
|
||||||
|
else ifeq ($(OSTYPE), Darwin)
|
||||||
|
|
||||||
|
ref_gl3:
|
||||||
|
@echo "===> Building ref_gl3.dylib"
|
||||||
|
$(MAKE) release/ref_gl3.dylib
|
||||||
|
|
||||||
|
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
release/ref_gl3.dylib : CFLAGS += -DSDL2
|
||||||
|
endif
|
||||||
|
|
||||||
|
else # not Windows or Darwin
|
||||||
|
|
||||||
|
ref_gl3:
|
||||||
|
@echo "===> Building ref_gl3.so"
|
||||||
|
$(MAKE) release/ref_gl3.so
|
||||||
|
|
||||||
|
|
||||||
|
release/ref_gl3.so : CFLAGS += -fPIC
|
||||||
|
release/ref_gl3.so : LDFLAGS += -shared
|
||||||
|
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
release/ref_gl3.so : CFLAGS += -DSDL2
|
||||||
|
endif
|
||||||
|
|
||||||
|
endif # OS specific ref_gl3 shit
|
||||||
|
|
||||||
|
# TODO: glad_dbg support
|
||||||
|
GLAD_INCLUDE = -Isrc/client/refresh/gl3/glad/include
|
||||||
|
|
||||||
|
build/ref_gl3/%.o: %.c
|
||||||
|
@echo "===> CC $<"
|
||||||
|
${Q}mkdir -p $(@D)
|
||||||
|
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) $(GLAD_INCLUDE) -o $@ $<
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
|
@ -789,6 +840,37 @@ endif
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
|
REFGL3_OBJS_ := \
|
||||||
|
src/client/refresh/gl3/gl3_main.o \
|
||||||
|
src/client/refresh/gl3/gl3_sdl.o \
|
||||||
|
src/client/refresh/gl3/gl3_draw.o \
|
||||||
|
src/client/refresh/files/pcx.o \
|
||||||
|
src/common/shared/flash.o \
|
||||||
|
src/common/shared/rand.o \
|
||||||
|
src/common/shared/shared.o
|
||||||
|
|
||||||
|
# TODO: filetype support for gl3 renderer - can we reuse same code?
|
||||||
|
REFGL3_TODO_ := \
|
||||||
|
src/client/refresh/files/md2.o \
|
||||||
|
src/client/refresh/files/pcx.o \
|
||||||
|
src/client/refresh/files/sp2.o \
|
||||||
|
src/client/refresh/files/stb.o \
|
||||||
|
src/client/refresh/files/wal.o
|
||||||
|
|
||||||
|
# TODO: glad_dbg support
|
||||||
|
REFGL3_OBJS_ += \
|
||||||
|
src/client/refresh/gl3/glad/src/glad.o
|
||||||
|
|
||||||
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
REFGL3_OBJS_ += \
|
||||||
|
src/backends/windows/shared/mem.o
|
||||||
|
else # not Windows
|
||||||
|
REFGL3_OBJS_ += \
|
||||||
|
src/backends/unix/shared/hunk.o
|
||||||
|
endif
|
||||||
|
|
||||||
|
# ----------
|
||||||
|
|
||||||
# Used by the server
|
# Used by the server
|
||||||
SERVER_OBJS_ := \
|
SERVER_OBJS_ := \
|
||||||
src/common/argproc.o \
|
src/common/argproc.o \
|
||||||
|
@ -841,6 +923,7 @@ endif
|
||||||
# Rewrite pathes to our object directory
|
# Rewrite pathes to our object directory
|
||||||
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
|
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
|
||||||
REFGL_OBJS = $(patsubst %,build/ref_gl/%,$(REFGL_OBJS_))
|
REFGL_OBJS = $(patsubst %,build/ref_gl/%,$(REFGL_OBJS_))
|
||||||
|
REFGL3_OBJS = $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_))
|
||||||
SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_))
|
SERVER_OBJS = $(patsubst %,build/server/%,$(SERVER_OBJS_))
|
||||||
GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
|
GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
|
||||||
|
|
||||||
|
@ -849,6 +932,7 @@ GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
|
||||||
# Generate header dependencies
|
# Generate header dependencies
|
||||||
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
|
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
|
||||||
REFGL_DEPS= $(REFGL_OBJS:.o=.d)
|
REFGL_DEPS= $(REFGL_OBJS:.o=.d)
|
||||||
|
REFGL3_DEPS= $(REFGL3_OBJS:.o=.d)
|
||||||
SERVER_DEPS= $(SERVER_OBJS:.o=.d)
|
SERVER_DEPS= $(SERVER_OBJS:.o=.d)
|
||||||
GAME_DEPS= $(GAME_OBJS:.o=.d)
|
GAME_DEPS= $(GAME_OBJS:.o=.d)
|
||||||
|
|
||||||
|
@ -857,6 +941,7 @@ GAME_DEPS= $(GAME_OBJS:.o=.d)
|
||||||
# Suck header dependencies in
|
# Suck header dependencies in
|
||||||
-include $(CLIENT_DEPS)
|
-include $(CLIENT_DEPS)
|
||||||
-include $(REFGL_DEPS)
|
-include $(REFGL_DEPS)
|
||||||
|
-include $(REFGL3_DEPS)
|
||||||
-include $(SERVER_DEPS)
|
-include $(SERVER_DEPS)
|
||||||
-include $(GAME_DEPS)
|
-include $(GAME_DEPS)
|
||||||
|
|
||||||
|
@ -902,6 +987,22 @@ release/ref_gl.so : $(REFGL_OBJS)
|
||||||
${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
|
${Q}$(CC) $(REFGL_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
# release/ref_gl3.so
|
||||||
|
ifeq ($(OSTYPE), Windows)
|
||||||
|
release/ref_gl3.dll : $(REFGL3_OBJS)
|
||||||
|
@echo "===> LD $@"
|
||||||
|
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(DLL_SDLLDFLAGS) -o $@
|
||||||
|
$(Q)strip $@
|
||||||
|
else ifeq ($(OSTYPE), Darwin)
|
||||||
|
release/ref_gl3.dylib : $(REFGL3_OBJS)
|
||||||
|
@echo "===> LD $@"
|
||||||
|
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
|
||||||
|
else
|
||||||
|
release/ref_gl3.so : $(REFGL3_OBJS)
|
||||||
|
@echo "===> LD $@"
|
||||||
|
${Q}$(CC) $(REFGL3_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
|
||||||
|
endif
|
||||||
|
|
||||||
# release/baseq2/game.so
|
# release/baseq2/game.so
|
||||||
ifeq ($(OSTYPE), Windows)
|
ifeq ($(OSTYPE), Windows)
|
||||||
release/baseq2/game.dll : $(GAME_OBJS)
|
release/baseq2/game.dll : $(GAME_OBJS)
|
||||||
|
|
65
src/client/refresh/gl3/gl3_draw.c
Normal file
65
src/client/refresh/gl3/gl3_draw.c
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (C) 2016 Daniel Gibson
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*
|
||||||
|
* Drawing of all images that are not textures
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "header/local.h"
|
||||||
|
|
||||||
|
unsigned d_8to24table[256];
|
||||||
|
|
||||||
|
int
|
||||||
|
GL3_Draw_GetPalette(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
int r, g, b;
|
||||||
|
unsigned v;
|
||||||
|
byte *pic, *pal;
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
/* get the palette */
|
||||||
|
LoadPCX("pics/colormap.pcx", &pic, &pal, &width, &height);
|
||||||
|
|
||||||
|
if (!pal)
|
||||||
|
{
|
||||||
|
ri.Sys_Error(ERR_FATAL, "Couldn't load pics/colormap.pcx");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
|
r = pal[i * 3 + 0];
|
||||||
|
g = pal[i * 3 + 1];
|
||||||
|
b = pal[i * 3 + 2];
|
||||||
|
|
||||||
|
v = (255 << 24) + (r << 0) + (g << 8) + (b << 16);
|
||||||
|
d_8to24table[i] = LittleLong(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
d_8to24table[255] &= LittleLong(0xffffff); /* 255 is transparent */
|
||||||
|
|
||||||
|
free(pic);
|
||||||
|
free(pal);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
479
src/client/refresh/gl3/gl3_main.c
Normal file
479
src/client/refresh/gl3/gl3_main.c
Normal file
|
@ -0,0 +1,479 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (C) 2016 Daniel Gibson
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*
|
||||||
|
* Refresher setup and main part of the frame generation, for OpenGL3
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "../../header/ref.h"
|
||||||
|
#include "header/local.h"
|
||||||
|
#include "header/qgl.h"
|
||||||
|
|
||||||
|
// TODO: put this in local.h ?
|
||||||
|
#define REF_VERSION "Yamagi Quake II OpenGL3 Refresher"
|
||||||
|
|
||||||
|
refimport_t ri;
|
||||||
|
|
||||||
|
gl3config_t gl3config;
|
||||||
|
gl3state_t gl3state;
|
||||||
|
|
||||||
|
viddef_t vid;
|
||||||
|
|
||||||
|
cvar_t *gl_msaa_samples;
|
||||||
|
cvar_t *gl_swapinterval;
|
||||||
|
cvar_t *gl_retexturing;
|
||||||
|
cvar_t *vid_fullscreen;
|
||||||
|
cvar_t *gl_mode;
|
||||||
|
cvar_t *gl_customwidth;
|
||||||
|
cvar_t *gl_customheight;
|
||||||
|
cvar_t *vid_gamma;
|
||||||
|
|
||||||
|
cvar_t *gl3_debugcontext;
|
||||||
|
|
||||||
|
static void
|
||||||
|
GL3_Register(void)
|
||||||
|
{
|
||||||
|
gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
|
||||||
|
gl_msaa_samples = ri.Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
|
||||||
|
gl_retexturing = ri.Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
|
||||||
|
gl3_debugcontext = ri.Cvar_Get("gl3_debugcontext", "0", 0); // TODO: really archive?
|
||||||
|
gl_mode = ri.Cvar_Get("gl_mode", "4", CVAR_ARCHIVE);
|
||||||
|
gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
|
||||||
|
gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
||||||
|
vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||||
|
vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
#if 0 // TODO!
|
||||||
|
gl_lefthand = ri.Cvar_Get("hand", "0", CVAR_USERINFO | CVAR_ARCHIVE);
|
||||||
|
gl_farsee = ri.Cvar_Get("gl_farsee", "0", CVAR_LATCH | CVAR_ARCHIVE);
|
||||||
|
gl_norefresh = ri.Cvar_Get("gl_norefresh", "0", 0);
|
||||||
|
gl_fullbright = ri.Cvar_Get("gl_fullbright", "0", 0);
|
||||||
|
gl_drawentities = ri.Cvar_Get("gl_drawentities", "1", 0);
|
||||||
|
gl_drawworld = ri.Cvar_Get("gl_drawworld", "1", 0);
|
||||||
|
gl_novis = ri.Cvar_Get("gl_novis", "0", 0);
|
||||||
|
gl_lerpmodels = ri.Cvar_Get("gl_lerpmodels", "1", 0);
|
||||||
|
gl_speeds = ri.Cvar_Get("gl_speeds", "0", 0);
|
||||||
|
|
||||||
|
gl_lightlevel = ri.Cvar_Get("gl_lightlevel", "0", 0);
|
||||||
|
gl_overbrightbits = ri.Cvar_Get("gl_overbrightbits", "0", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
gl_particle_min_size = ri.Cvar_Get("gl_particle_min_size", "2", CVAR_ARCHIVE);
|
||||||
|
gl_particle_max_size = ri.Cvar_Get("gl_particle_max_size", "40", CVAR_ARCHIVE);
|
||||||
|
gl_particle_size = ri.Cvar_Get("gl_particle_size", "40", CVAR_ARCHIVE);
|
||||||
|
gl_particle_att_a = ri.Cvar_Get("gl_particle_att_a", "0.01", CVAR_ARCHIVE);
|
||||||
|
gl_particle_att_b = ri.Cvar_Get("gl_particle_att_b", "0.0", CVAR_ARCHIVE);
|
||||||
|
gl_particle_att_c = ri.Cvar_Get("gl_particle_att_c", "0.01", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
gl_modulate = ri.Cvar_Get("gl_modulate", "1", CVAR_ARCHIVE);
|
||||||
|
//gl_mode = ri.Cvar_Get("gl_mode", "4", CVAR_ARCHIVE);
|
||||||
|
gl_lightmap = ri.Cvar_Get("gl_lightmap", "0", 0);
|
||||||
|
gl_shadows = ri.Cvar_Get("gl_shadows", "0", CVAR_ARCHIVE);
|
||||||
|
gl_stencilshadow = ri.Cvar_Get("gl_stencilshadow", "0", CVAR_ARCHIVE);
|
||||||
|
gl_dynamic = ri.Cvar_Get("gl_dynamic", "1", 0);
|
||||||
|
gl_nobind = ri.Cvar_Get("gl_nobind", "0", 0);
|
||||||
|
gl_round_down = ri.Cvar_Get("gl_round_down", "1", 0);
|
||||||
|
gl_picmip = ri.Cvar_Get("gl_picmip", "0", 0);
|
||||||
|
gl_showtris = ri.Cvar_Get("gl_showtris", "0", 0);
|
||||||
|
gl_ztrick = ri.Cvar_Get("gl_ztrick", "0", 0);
|
||||||
|
gl_zfix = ri.Cvar_Get("gl_zfix", "0", 0);
|
||||||
|
gl_finish = ri.Cvar_Get("gl_finish", "0", CVAR_ARCHIVE);
|
||||||
|
gl_clear = ri.Cvar_Get("gl_clear", "0", 0);
|
||||||
|
gl_cull = ri.Cvar_Get("gl_cull", "1", 0);
|
||||||
|
gl_polyblend = ri.Cvar_Get("gl_polyblend", "1", 0);
|
||||||
|
gl_flashblend = ri.Cvar_Get("gl_flashblend", "0", 0);
|
||||||
|
|
||||||
|
gl_texturemode = ri.Cvar_Get("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST", CVAR_ARCHIVE);
|
||||||
|
gl_texturealphamode = ri.Cvar_Get("gl_texturealphamode", "default", CVAR_ARCHIVE);
|
||||||
|
gl_texturesolidmode = ri.Cvar_Get("gl_texturesolidmode", "default", CVAR_ARCHIVE);
|
||||||
|
gl_anisotropic = ri.Cvar_Get("gl_anisotropic", "0", CVAR_ARCHIVE);
|
||||||
|
gl_lockpvs = ri.Cvar_Get("gl_lockpvs", "0", 0);
|
||||||
|
|
||||||
|
gl_palettedtexture = ri.Cvar_Get("gl_palettedtexture", "0", CVAR_ARCHIVE);
|
||||||
|
gl_pointparameters = ri.Cvar_Get("gl_pointparameters", "1", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
gl_drawbuffer = ri.Cvar_Get("gl_drawbuffer", "GL_BACK", 0);
|
||||||
|
//gl_swapinterval = ri.Cvar_Get("gl_swapinterval", "1", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
gl_saturatelighting = ri.Cvar_Get("gl_saturatelighting", "0", 0);
|
||||||
|
|
||||||
|
//vid_fullscreen = ri.Cvar_Get("vid_fullscreen", "0", CVAR_ARCHIVE);
|
||||||
|
//vid_gamma = ri.Cvar_Get("vid_gamma", "1.0", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
//gl_customwidth = ri.Cvar_Get("gl_customwidth", "1024", CVAR_ARCHIVE);
|
||||||
|
//gl_customheight = ri.Cvar_Get("gl_customheight", "768", CVAR_ARCHIVE);
|
||||||
|
//gl_msaa_samples = ri.Cvar_Get ( "gl_msaa_samples", "0", CVAR_ARCHIVE );
|
||||||
|
|
||||||
|
//gl_retexturing = ri.Cvar_Get("gl_retexturing", "1", CVAR_ARCHIVE);
|
||||||
|
|
||||||
|
|
||||||
|
gl_stereo = ri.Cvar_Get( "gl_stereo", "0", CVAR_ARCHIVE );
|
||||||
|
gl_stereo_separation = ri.Cvar_Get( "gl_stereo_separation", "-0.4", CVAR_ARCHIVE );
|
||||||
|
gl_stereo_anaglyph_colors = ri.Cvar_Get( "gl_stereo_anaglyph_colors", "rc", CVAR_ARCHIVE );
|
||||||
|
gl_stereo_convergence = ri.Cvar_Get( "gl_stereo_convergence", "1", CVAR_ARCHIVE );
|
||||||
|
|
||||||
|
ri.Cmd_AddCommand("imagelist", R_ImageList_f);
|
||||||
|
ri.Cmd_AddCommand("screenshot", R_ScreenShot);
|
||||||
|
ri.Cmd_AddCommand("modellist", Mod_Modellist_f);
|
||||||
|
ri.Cmd_AddCommand("gl_strings", R_Strings);
|
||||||
|
#endif // 0
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Changes the video mode
|
||||||
|
*/
|
||||||
|
|
||||||
|
// the following is only used in the next to functions,
|
||||||
|
// no need to put it in a header
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
rserr_ok,
|
||||||
|
|
||||||
|
rserr_invalid_fullscreen,
|
||||||
|
rserr_invalid_mode,
|
||||||
|
|
||||||
|
rserr_unknown
|
||||||
|
};
|
||||||
|
|
||||||
|
static int
|
||||||
|
SetMode_impl(int *pwidth, int *pheight, int mode, qboolean fullscreen)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "setting mode %d:", mode);
|
||||||
|
|
||||||
|
/* mode -1 is not in the vid mode table - so we keep the values in pwidth
|
||||||
|
and pheight and don't even try to look up the mode info */
|
||||||
|
if ((mode != -1) && !ri.Vid_GetModeInfo(pwidth, pheight, mode))
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, " invalid mode\n");
|
||||||
|
return rserr_invalid_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, " %d %d\n", *pwidth, *pheight);
|
||||||
|
|
||||||
|
if (!ri.GLimp_InitGraphics(fullscreen, pwidth, pheight))
|
||||||
|
{
|
||||||
|
return rserr_invalid_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rserr_ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean
|
||||||
|
GL3_SetMode(void)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
qboolean fullscreen;
|
||||||
|
|
||||||
|
fullscreen = vid_fullscreen->value;
|
||||||
|
|
||||||
|
vid_fullscreen->modified = false;
|
||||||
|
gl_mode->modified = false;
|
||||||
|
|
||||||
|
/* a bit hackish approach to enable custom resolutions:
|
||||||
|
Glimp_SetMode needs these values set for mode -1 */
|
||||||
|
vid.width = gl_customwidth->value;
|
||||||
|
vid.height = gl_customheight->value;
|
||||||
|
|
||||||
|
if ((err = SetMode_impl(&vid.width, &vid.height, gl_mode->value,
|
||||||
|
fullscreen)) == rserr_ok)
|
||||||
|
{
|
||||||
|
if (gl_mode->value == -1)
|
||||||
|
{
|
||||||
|
gl3state.prev_mode = 4; /* safe default for custom mode */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gl3state.prev_mode = gl_mode->value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (err == rserr_invalid_fullscreen)
|
||||||
|
{
|
||||||
|
ri.Cvar_SetValue("vid_fullscreen", 0);
|
||||||
|
vid_fullscreen->modified = false;
|
||||||
|
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - fullscreen unavailable in this mode\n");
|
||||||
|
|
||||||
|
if ((err = SetMode_impl(&vid.width, &vid.height, gl_mode->value, false)) == rserr_ok)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (err == rserr_invalid_mode)
|
||||||
|
{
|
||||||
|
ri.Cvar_SetValue("gl_mode", gl3state.prev_mode);
|
||||||
|
gl_mode->modified = false;
|
||||||
|
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - invalid mode\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* try setting it back to something safe */
|
||||||
|
if ((err = SetMode_impl(&vid.width, &vid.height, gl3state.prev_mode, false)) != rserr_ok)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "ref_gl::R_SetMode() - could not revert to safe mode\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static qboolean
|
||||||
|
GL3_Init(void)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
extern float r_turbsin[256];
|
||||||
|
|
||||||
|
Swap_Init(); // FIXME: for fucks sake, this doesn't have to be done at runtime!
|
||||||
|
|
||||||
|
/* TODO!
|
||||||
|
for (j = 0; j < 256; j++)
|
||||||
|
{
|
||||||
|
r_turbsin[j] *= 0.5;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
/* Options */
|
||||||
|
R_Printf(PRINT_ALL, "Refresher build options:\n");
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, " + Retexturing support\n");
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
|
||||||
|
|
||||||
|
GL3_Draw_GetPalette();
|
||||||
|
|
||||||
|
GL3_Register();
|
||||||
|
|
||||||
|
/* initialize our QGL dynamic bindings */
|
||||||
|
//QGL_Init();
|
||||||
|
|
||||||
|
/* initialize OS-specific parts of OpenGL */
|
||||||
|
if (!ri.GLimp_Init())
|
||||||
|
{
|
||||||
|
//QGL_Shutdown();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* set our "safe" mode */
|
||||||
|
gl3state.prev_mode = 4;
|
||||||
|
//gl_state.stereo_mode = gl_stereo->value;
|
||||||
|
|
||||||
|
/* create the window and set up the context */
|
||||||
|
if (!GL3_SetMode())
|
||||||
|
{
|
||||||
|
//QGL_Shutdown();
|
||||||
|
R_Printf(PRINT_ALL, "ref_gl3::R_Init() - could not R_SetMode()\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
ri.Vid_MenuInit();
|
||||||
|
|
||||||
|
/* get our various GL strings */
|
||||||
|
R_Printf(PRINT_ALL, "\nOpenGL setting:\n");
|
||||||
|
|
||||||
|
gl3config.vendor_string = (const char*)glGetString(GL_VENDOR);
|
||||||
|
R_Printf(PRINT_ALL, "GL_VENDOR: %s\n", gl3config.vendor_string);
|
||||||
|
|
||||||
|
gl3config.renderer_string = (const char*)glGetString(GL_RENDERER);
|
||||||
|
R_Printf(PRINT_ALL, "GL_RENDERER: %s\n", gl3config.renderer_string);
|
||||||
|
|
||||||
|
gl3config.version_string = (const char*)glGetString(GL_VERSION);
|
||||||
|
R_Printf(PRINT_ALL, "GL_VERSION: %s\n", gl3config.version_string);
|
||||||
|
|
||||||
|
gl3config.version_string = (const char*)glGetString(GL_SHADING_LANGUAGE_VERSION);
|
||||||
|
R_Printf(PRINT_ALL, "GL_SHADING_LANGUAGE_VERSION: %s\n", gl3config.version_string);
|
||||||
|
|
||||||
|
//gl3config.extensions_string = (const char*)glGetString(GL_EXTENSIONS);
|
||||||
|
//R_Printf(PRINT_ALL, "GL_EXTENSIONS: %s\n", gl3config.extensions_string);
|
||||||
|
{
|
||||||
|
GLint i, numExtensions;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "GL_EXTENSIONS:");
|
||||||
|
for(i = 0; i < numExtensions; i++)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, " %s", (const char*)glGetStringi(GL_EXTENSIONS, i));
|
||||||
|
}
|
||||||
|
R_Printf(PRINT_ALL, "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
if (gl_config.major_version < 3)
|
||||||
|
{
|
||||||
|
// if (gl_config.major_version == 3 && gl_config.minor_version < 2)
|
||||||
|
{
|
||||||
|
QGL_Shutdown();
|
||||||
|
R_Printf(PRINT_ALL, "Support for OpenGL 3.2 is not available\n");
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "\n\nProbing for OpenGL extensions:\n");
|
||||||
|
|
||||||
|
|
||||||
|
/* Anisotropic */
|
||||||
|
R_Printf(PRINT_ALL, " - Anisotropic Filtering: ");
|
||||||
|
|
||||||
|
if(gl3config.anisotropic)
|
||||||
|
{
|
||||||
|
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gl3config.max_anisotropy);
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "Max level: %ux\n", (int)gl3config.max_anisotropy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gl3config.max_anisotropy = 0.0;
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "Not supported\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(gl3config.debug_output)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, " - OpenGL Debug Output: Supported ");
|
||||||
|
if(gl3_debugcontext->value == 0.0f)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "(but disabled with gl3_debugcontext = 0)\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "and enabled with gl3_debugcontext = %i\n", (int)gl3_debugcontext->value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, " - OpenGL Debug Output: Not Supported\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
R_SetDefaultState();
|
||||||
|
|
||||||
|
R_InitImages();
|
||||||
|
Mod_Init();
|
||||||
|
R_InitParticleTexture();
|
||||||
|
Draw_InitLocal();
|
||||||
|
|
||||||
|
return true; // -1 is error, other values don't matter. FIXME: mabe make this return bool..
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
|
R_Printf(PRINT_ALL, "\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
GL3_Shutdown(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
ri.Cmd_RemoveCommand("modellist");
|
||||||
|
ri.Cmd_RemoveCommand("screenshot");
|
||||||
|
ri.Cmd_RemoveCommand("imagelist");
|
||||||
|
ri.Cmd_RemoveCommand("gl_strings");
|
||||||
|
#if 0 // TODO!
|
||||||
|
Mod_FreeAll();
|
||||||
|
|
||||||
|
R_ShutdownImages();
|
||||||
|
#endif // 0
|
||||||
|
|
||||||
|
/* shutdown OS specific OpenGL stuff like contexts, etc. */
|
||||||
|
GL3_ShutdownWindow(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Q2_DLL_EXPORTED refexport_t
|
||||||
|
GetRefAPI(refimport_t imp)
|
||||||
|
{
|
||||||
|
refexport_t re = {0};
|
||||||
|
|
||||||
|
ri = imp;
|
||||||
|
|
||||||
|
re.api_version = API_VERSION;
|
||||||
|
|
||||||
|
re.Init = GL3_Init;
|
||||||
|
re.Shutdown = GL3_Shutdown;
|
||||||
|
re.PrepareForWindow = GL3_PrepareForWindow;
|
||||||
|
re.InitContext = GL3_InitContext;
|
||||||
|
re.ShutdownWindow = GL3_ShutdownWindow;
|
||||||
|
/* TODO!
|
||||||
|
re.BeginRegistration = RI_BeginRegistration;
|
||||||
|
re.RegisterModel = RI_RegisterModel;
|
||||||
|
re.RegisterSkin = RI_RegisterSkin;
|
||||||
|
|
||||||
|
re.SetSky = RI_SetSky;
|
||||||
|
re.EndRegistration = RI_EndRegistration;
|
||||||
|
|
||||||
|
re.RenderFrame = RI_RenderFrame;
|
||||||
|
|
||||||
|
re.DrawFindPic = RDraw_FindPic;
|
||||||
|
|
||||||
|
re.DrawGetPicSize = RDraw_GetPicSize;
|
||||||
|
|
||||||
|
re.DrawPicScaled = RDraw_PicScaled;
|
||||||
|
re.DrawStretchPic = RDraw_StretchPic;
|
||||||
|
|
||||||
|
re.DrawCharScaled = RDraw_CharScaled;
|
||||||
|
re.DrawTileClear = RDraw_TileClear;
|
||||||
|
re.DrawFill = RDraw_Fill;
|
||||||
|
re.DrawFadeScreen = RDraw_FadeScreen;
|
||||||
|
|
||||||
|
re.DrawStretchRaw = RDraw_StretchRaw;
|
||||||
|
|
||||||
|
re.SetPalette = RI_SetPalette;
|
||||||
|
re.BeginFrame = RI_BeginFrame;
|
||||||
|
*/
|
||||||
|
re.EndFrame = GL3_EndFrame;
|
||||||
|
|
||||||
|
return re;
|
||||||
|
}
|
||||||
|
|
||||||
|
void R_Printf(int level, const char* msg, ...)
|
||||||
|
{
|
||||||
|
va_list argptr;
|
||||||
|
va_start(argptr, msg);
|
||||||
|
ri.Com_VPrintf(level, msg, argptr);
|
||||||
|
va_end(argptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* this is only here so the functions in shared source files
|
||||||
|
* (shared.c, rand.c, flash.c, mem.c/hunk.c) can link
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Sys_Error(char *error, ...)
|
||||||
|
{
|
||||||
|
va_list argptr;
|
||||||
|
char text[4096]; // MAXPRINTMSG == 4096
|
||||||
|
|
||||||
|
va_start(argptr, error);
|
||||||
|
vsprintf(text, error, argptr);
|
||||||
|
va_end(argptr);
|
||||||
|
|
||||||
|
ri.Sys_Error(ERR_FATAL, "%s", text);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Com_Printf(char *msg, ...)
|
||||||
|
{
|
||||||
|
va_list argptr;
|
||||||
|
va_start(argptr, msg);
|
||||||
|
ri.Com_VPrintf(PRINT_ALL, msg, argptr);
|
||||||
|
va_end(argptr);
|
||||||
|
}
|
278
src/client/refresh/gl3/gl3_sdl.c
Normal file
278
src/client/refresh/gl3/gl3_sdl.c
Normal file
|
@ -0,0 +1,278 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (C) 2016 Daniel Gibson
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*
|
||||||
|
* SDL-specific refresher things, for OpenGL3
|
||||||
|
* Also all glad (or whatever OpenGL loader I end up using) specific things
|
||||||
|
* (I'd like to keep the OpenGL loader easily exchangable if possible)
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "header/qgl.h"
|
||||||
|
#include "header/local.h"
|
||||||
|
|
||||||
|
#ifdef SDL2
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#else // SDL1.2
|
||||||
|
#include <SDL/SDL.h>
|
||||||
|
#endif //SDL2
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
static SDL_Window* window = NULL;
|
||||||
|
static SDL_GLContext context = NULL;
|
||||||
|
#else
|
||||||
|
static SDL_Surface* window = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qboolean have_stencil = false;
|
||||||
|
|
||||||
|
// called by GLimp_InitGraphics() before creating window,
|
||||||
|
// returns flags for SDL window creation, -1 on error
|
||||||
|
int GL3_PrepareForWindow(void)
|
||||||
|
{
|
||||||
|
unsigned int flags = 0;
|
||||||
|
int msaa_samples = 0;
|
||||||
|
|
||||||
|
if(SDL_GL_LoadLibrary(NULL) < 0) // Default OpenGL is fine.
|
||||||
|
{
|
||||||
|
// TODO: is there a better way?
|
||||||
|
ri.Sys_Error(ERR_FATAL, "Couldn't load libGL: %s!", SDL_GetError());
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
|
||||||
|
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
|
||||||
|
// SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); // TODO
|
||||||
|
int contextFlags = 0; // SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG TODO
|
||||||
|
if(gl3_debugcontext && gl3_debugcontext->value)
|
||||||
|
{
|
||||||
|
contextFlags |= SDL_GL_CONTEXT_DEBUG_FLAG;
|
||||||
|
}
|
||||||
|
if(contextFlags != 0)
|
||||||
|
{
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, contextFlags);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if !SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
/* Set vsync - For SDL1.2, this must be done before creating the window */
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, gl_swapinterval->value ? 1 : 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (gl_msaa_samples->value)
|
||||||
|
{
|
||||||
|
msaa_samples = gl_msaa_samples->value;
|
||||||
|
|
||||||
|
if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 1) < 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "MSAA is unsupported: %s\n", SDL_GetError());
|
||||||
|
ri.Cvar_SetValue ("gl_msaa_samples", 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||||
|
}
|
||||||
|
else if (SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, msaa_samples) < 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "MSAA %ix is unsupported: %s\n", msaa_samples, SDL_GetError());
|
||||||
|
ri.Cvar_SetValue("gl_msaa_samples", 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0);
|
||||||
|
SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Initiate the flags */
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
flags = SDL_WINDOW_OPENGL;
|
||||||
|
#else // SDL 1.2
|
||||||
|
flags = SDL_OPENGL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return flags;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length,
|
||||||
|
const GLchar *message, const void *userParam)
|
||||||
|
{
|
||||||
|
const char* sourceStr = "Source: Unknown";
|
||||||
|
const char* typeStr = "Type: Unknown";
|
||||||
|
const char* severityStr = "Severity: Unknown";
|
||||||
|
switch(source)
|
||||||
|
{
|
||||||
|
#define SRCCASE(X) case GL_DEBUG_SOURCE_ ## X ## _ARB: sourceStr = "Source: " #X; break;
|
||||||
|
SRCCASE(API);
|
||||||
|
SRCCASE(WINDOW_SYSTEM);
|
||||||
|
SRCCASE(SHADER_COMPILER);
|
||||||
|
SRCCASE(THIRD_PARTY);
|
||||||
|
SRCCASE(APPLICATION);
|
||||||
|
SRCCASE(OTHER);
|
||||||
|
#undef SRCCASE
|
||||||
|
}
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
#define TYPECASE(X) case GL_DEBUG_TYPE_ ## X ## _ARB: typeStr = "Type: " #X; break;
|
||||||
|
TYPECASE(ERROR);
|
||||||
|
TYPECASE(DEPRECATED_BEHAVIOR);
|
||||||
|
TYPECASE(UNDEFINED_BEHAVIOR);
|
||||||
|
TYPECASE(PORTABILITY);
|
||||||
|
TYPECASE(PERFORMANCE);
|
||||||
|
TYPECASE(OTHER);
|
||||||
|
#undef TYPECASE
|
||||||
|
}
|
||||||
|
switch(severity)
|
||||||
|
{
|
||||||
|
case GL_DEBUG_SEVERITY_HIGH_ARB: severityStr = "Severity: High"; break;
|
||||||
|
case GL_DEBUG_SEVERITY_MEDIUM_ARB: severityStr = "Severity: Medium"; break;
|
||||||
|
case GL_DEBUG_SEVERITY_LOW_ARB: severityStr = "Severity: Low"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use PRINT_ALL - this is only called with gl3_debugcontext != 0 anyway.
|
||||||
|
R_Printf(PRINT_ALL, "GLDBG %s %s %s: %s\n", sourceStr, typeStr, severityStr, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
int GL3_InitContext(void* win)
|
||||||
|
{
|
||||||
|
int msaa_samples = 0, stencil_bits = 0;
|
||||||
|
|
||||||
|
if(win == NULL)
|
||||||
|
{
|
||||||
|
ri.Sys_Error(ERR_FATAL, "R_InitContext() must not be called with NULL argument!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = (SDL_Window*)win;
|
||||||
|
context = SDL_GL_CreateContext(window);
|
||||||
|
if(context == NULL)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "R_InitContext(): Creating OpenGL Context failed: %s\n", SDL_GetError());
|
||||||
|
window = NULL;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (gl_msaa_samples->value)
|
||||||
|
{
|
||||||
|
if (SDL_GL_GetAttribute(SDL_GL_MULTISAMPLESAMPLES, &msaa_samples) == 0)
|
||||||
|
{
|
||||||
|
ri.Cvar_SetValue("gl_msaa_samples", msaa_samples);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
/* For SDL2, this must be done after creating the window */
|
||||||
|
/* Set vsync - TODO: -1 could be set for "late swap tearing" */
|
||||||
|
SDL_GL_SetSwapInterval(gl_swapinterval->value ? 1 : 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initialize the stencil buffer */
|
||||||
|
if (SDL_GL_GetAttribute(SDL_GL_STENCIL_SIZE, &stencil_bits) == 0)
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "Got %d bits of stencil.\n", stencil_bits);
|
||||||
|
|
||||||
|
if (stencil_bits >= 1)
|
||||||
|
{
|
||||||
|
have_stencil = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!gladLoadGLLoader(SDL_GL_GetProcAddress))
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "R_InitContext(): loading OpenGL function pointers failed!\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
R_Printf(PRINT_ALL, "Successfully loaded OpenGL function pointers using glad!\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
gl3config.anisotropic = GLAD_GL_EXT_texture_filter_anisotropic != 0;
|
||||||
|
gl3config.debug_output = GLAD_GL_ARB_debug_output != 0;
|
||||||
|
gl3config.major_version = GLVersion.major;
|
||||||
|
gl3config.minor_version = GLVersion.minor;
|
||||||
|
|
||||||
|
if(gl3_debugcontext && gl3_debugcontext->value && gl3config.debug_output)
|
||||||
|
{
|
||||||
|
glDebugMessageCallbackARB(DebugCallback, NULL);
|
||||||
|
// call GL3_DebugCallback() synchronously, i.e. directly when and where the error happens
|
||||||
|
// (so we can get the cause in a backtrace)
|
||||||
|
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB); // TODO: only do this if gl3_debugcontext->value >= 2 ?
|
||||||
|
|
||||||
|
// TODO: the following line could control verboseness (in that case we'd get all the low prio messages)
|
||||||
|
// glDebugMessageControlARB(GL_DONT_CARE, GL_DONT_CARE, GL_DEBUG_SEVERITY_LOW_ARB, 0, NULL, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Swaps the buffers to show the new frame
|
||||||
|
*/
|
||||||
|
void GL3_EndFrame(void)
|
||||||
|
{
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
SDL_GL_SwapWindow(window);
|
||||||
|
#else
|
||||||
|
SDL_GL_SwapBuffers();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shuts the SDL render backend down
|
||||||
|
*/
|
||||||
|
void GL3_ShutdownWindow(qboolean contextOnly)
|
||||||
|
{
|
||||||
|
/* Clear the backbuffer and make it
|
||||||
|
current. This may help some broken
|
||||||
|
video drivers like the AMD Catalyst
|
||||||
|
to avoid artifacts in unused screen
|
||||||
|
areas. */
|
||||||
|
if (window)
|
||||||
|
{
|
||||||
|
glClearColor(0.0, 0.0, 0.0, 0.0);
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||||
|
GL3_EndFrame();
|
||||||
|
|
||||||
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
if(context)
|
||||||
|
{
|
||||||
|
SDL_GL_DeleteContext(context);
|
||||||
|
context = NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
window = NULL;
|
||||||
|
|
||||||
|
if(!contextOnly)
|
||||||
|
{
|
||||||
|
ri.Vid_ShutdownWindow();
|
||||||
|
}
|
||||||
|
}
|
285
src/client/refresh/gl3/glad/include/KHR/khrplatform.h
Normal file
285
src/client/refresh/gl3/glad/include/KHR/khrplatform.h
Normal file
|
@ -0,0 +1,285 @@
|
||||||
|
#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__)
|
||||||
|
# include <sys/cdefs.h>
|
||||||
|
# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
|
||||||
|
#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_ */
|
2010
src/client/refresh/gl3/glad/include/glad/glad.h
Normal file
2010
src/client/refresh/gl3/glad/include/glad/glad.h
Normal file
File diff suppressed because it is too large
Load diff
890
src/client/refresh/gl3/glad/src/glad.c
Normal file
890
src/client/refresh/gl3/glad/src/glad.c
Normal file
|
@ -0,0 +1,890 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
OpenGL loader generated by glad 0.1.12a0 on Wed Dec 21 00:44:13 2016.
|
||||||
|
|
||||||
|
Language/Generator: C/C++
|
||||||
|
Specification: gl
|
||||||
|
APIs: gl=3.2
|
||||||
|
Profile: core
|
||||||
|
Extensions:
|
||||||
|
GL_ARB_debug_output,
|
||||||
|
GL_EXT_texture_filter_anisotropic
|
||||||
|
Loader: False
|
||||||
|
Local files: False
|
||||||
|
Omit khrplatform: False
|
||||||
|
|
||||||
|
Commandline:
|
||||||
|
--profile="core" --api="gl=3.2" --generator="c" --spec="gl" --no-loader --extensions="GL_ARB_debug_output,GL_EXT_texture_filter_anisotropic"
|
||||||
|
Online:
|
||||||
|
http://glad.dav1d.de/#profile=core&language=c&specification=gl&api=gl%3D3.2&extensions=GL_ARB_debug_output&extensions=GL_EXT_texture_filter_anisotropic
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <glad/glad.h>
|
||||||
|
|
||||||
|
struct gladGLversionStruct GLVersion;
|
||||||
|
|
||||||
|
#if defined(GL_ES_VERSION_3_0) || defined(GL_VERSION_3_0)
|
||||||
|
#define _GLAD_IS_SOME_NEW_VERSION 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static int max_loaded_major;
|
||||||
|
static int max_loaded_minor;
|
||||||
|
|
||||||
|
static const char *exts = NULL;
|
||||||
|
static int num_exts_i = 0;
|
||||||
|
static const char **exts_i = NULL;
|
||||||
|
|
||||||
|
static int get_exts(void) {
|
||||||
|
#ifdef _GLAD_IS_SOME_NEW_VERSION
|
||||||
|
if(max_loaded_major < 3) {
|
||||||
|
#endif
|
||||||
|
exts = (const char *)glGetString(GL_EXTENSIONS);
|
||||||
|
#ifdef _GLAD_IS_SOME_NEW_VERSION
|
||||||
|
} else {
|
||||||
|
int index;
|
||||||
|
|
||||||
|
num_exts_i = 0;
|
||||||
|
glGetIntegerv(GL_NUM_EXTENSIONS, &num_exts_i);
|
||||||
|
if (num_exts_i > 0) {
|
||||||
|
exts_i = (const char **)realloc((void *)exts_i, num_exts_i * sizeof *exts_i);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (exts_i == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(index = 0; index < num_exts_i; index++) {
|
||||||
|
exts_i[index] = (const char*)glGetStringi(GL_EXTENSIONS, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void free_exts(void) {
|
||||||
|
if (exts_i != NULL) {
|
||||||
|
free((char **)exts_i);
|
||||||
|
exts_i = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int has_ext(const char *ext) {
|
||||||
|
#ifdef _GLAD_IS_SOME_NEW_VERSION
|
||||||
|
if(max_loaded_major < 3) {
|
||||||
|
#endif
|
||||||
|
const char *extensions;
|
||||||
|
const char *loc;
|
||||||
|
const char *terminator;
|
||||||
|
extensions = exts;
|
||||||
|
if(extensions == NULL || ext == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
loc = strstr(extensions, ext);
|
||||||
|
if(loc == NULL) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
terminator = loc + strlen(ext);
|
||||||
|
if((loc == extensions || *(loc - 1) == ' ') &&
|
||||||
|
(*terminator == ' ' || *terminator == '\0')) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
extensions = terminator;
|
||||||
|
}
|
||||||
|
#ifdef _GLAD_IS_SOME_NEW_VERSION
|
||||||
|
} else {
|
||||||
|
int index;
|
||||||
|
|
||||||
|
for(index = 0; index < num_exts_i; index++) {
|
||||||
|
const char *e = exts_i[index];
|
||||||
|
|
||||||
|
if(strcmp(e, ext) == 0) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int GLAD_GL_VERSION_1_0;
|
||||||
|
int GLAD_GL_VERSION_1_1;
|
||||||
|
int GLAD_GL_VERSION_1_2;
|
||||||
|
int GLAD_GL_VERSION_1_3;
|
||||||
|
int GLAD_GL_VERSION_1_4;
|
||||||
|
int GLAD_GL_VERSION_1_5;
|
||||||
|
int GLAD_GL_VERSION_2_0;
|
||||||
|
int GLAD_GL_VERSION_2_1;
|
||||||
|
int GLAD_GL_VERSION_3_0;
|
||||||
|
int GLAD_GL_VERSION_3_1;
|
||||||
|
int GLAD_GL_VERSION_3_2;
|
||||||
|
PFNGLDELETEVERTEXARRAYSPROC glad_glDeleteVertexArrays;
|
||||||
|
PFNGLBEGINTRANSFORMFEEDBACKPROC glad_glBeginTransformFeedback;
|
||||||
|
PFNGLFLUSHPROC glad_glFlush;
|
||||||
|
PFNGLCOPYTEXIMAGE1DPROC glad_glCopyTexImage1D;
|
||||||
|
PFNGLCLEARCOLORPROC glad_glClearColor;
|
||||||
|
PFNGLVERTEXATTRIBI3UIPROC glad_glVertexAttribI3ui;
|
||||||
|
PFNGLGETUNIFORMBLOCKINDEXPROC glad_glGetUniformBlockIndex;
|
||||||
|
PFNGLVERTEXATTRIB4NIVPROC glad_glVertexAttrib4Niv;
|
||||||
|
PFNGLCLEARBUFFERIVPROC glad_glClearBufferiv;
|
||||||
|
PFNGLSTENCILMASKSEPARATEPROC glad_glStencilMaskSeparate;
|
||||||
|
PFNGLGETVERTEXATTRIBPOINTERVPROC glad_glGetVertexAttribPointerv;
|
||||||
|
PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glad_glGetFramebufferAttachmentParameteriv;
|
||||||
|
PFNGLBINDFRAGDATALOCATIONPROC glad_glBindFragDataLocation;
|
||||||
|
PFNGLLINKPROGRAMPROC glad_glLinkProgram;
|
||||||
|
PFNGLBINDTEXTUREPROC glad_glBindTexture;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glad_glGetActiveUniformBlockName;
|
||||||
|
PFNGLVERTEXATTRIBI2UIVPROC glad_glVertexAttribI2uiv;
|
||||||
|
PFNGLFENCESYNCPROC glad_glFenceSync;
|
||||||
|
PFNGLUNIFORM3UIPROC glad_glUniform3ui;
|
||||||
|
PFNGLUNIFORM2UIVPROC glad_glUniform2uiv;
|
||||||
|
PFNGLGETSTRINGPROC glad_glGetString;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glad_glCompressedTexSubImage3D;
|
||||||
|
PFNGLDETACHSHADERPROC glad_glDetachShader;
|
||||||
|
PFNGLVERTEXATTRIBI4UIVPROC glad_glVertexAttribI4uiv;
|
||||||
|
PFNGLGENBUFFERSPROC glad_glGenBuffers;
|
||||||
|
PFNGLENDQUERYPROC glad_glEndQuery;
|
||||||
|
PFNGLPOINTPARAMETERFVPROC glad_glPointParameterfv;
|
||||||
|
PFNGLLINEWIDTHPROC glad_glLineWidth;
|
||||||
|
PFNGLUNIFORM2FVPROC glad_glUniform2fv;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDPROC glad_glDrawElementsInstanced;
|
||||||
|
PFNGLGETINTEGERI_VPROC glad_glGetIntegeri_v;
|
||||||
|
PFNGLBINDATTRIBLOCATIONPROC glad_glBindAttribLocation;
|
||||||
|
PFNGLCOMPILESHADERPROC glad_glCompileShader;
|
||||||
|
PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glad_glGetTransformFeedbackVarying;
|
||||||
|
PFNGLDELETETEXTURESPROC glad_glDeleteTextures;
|
||||||
|
PFNGLSTENCILOPSEPARATEPROC glad_glStencilOpSeparate;
|
||||||
|
PFNGLUNIFORMMATRIX3FVPROC glad_glUniformMatrix3fv;
|
||||||
|
PFNGLPOLYGONMODEPROC glad_glPolygonMode;
|
||||||
|
PFNGLBINDBUFFERRANGEPROC glad_glBindBufferRange;
|
||||||
|
PFNGLVERTEXATTRIB4FPROC glad_glVertexAttrib4f;
|
||||||
|
PFNGLGENRENDERBUFFERSPROC glad_glGenRenderbuffers;
|
||||||
|
PFNGLVERTEXATTRIB4DPROC glad_glVertexAttrib4d;
|
||||||
|
PFNGLVERTEXATTRIB1FPROC glad_glVertexAttrib1f;
|
||||||
|
PFNGLGETBUFFERPARAMETERI64VPROC glad_glGetBufferParameteri64v;
|
||||||
|
PFNGLISSYNCPROC glad_glIsSync;
|
||||||
|
PFNGLCLAMPCOLORPROC glad_glClampColor;
|
||||||
|
PFNGLUNIFORM4IVPROC glad_glUniform4iv;
|
||||||
|
PFNGLGETTEXPARAMETERIVPROC glad_glGetTexParameteriv;
|
||||||
|
PFNGLCLEARSTENCILPROC glad_glClearStencil;
|
||||||
|
PFNGLFRAMEBUFFERTEXTUREPROC glad_glFramebufferTexture;
|
||||||
|
PFNGLUNIFORMMATRIX2X3FVPROC glad_glUniformMatrix2x3fv;
|
||||||
|
PFNGLVERTEXATTRIB4SPROC glad_glVertexAttrib4s;
|
||||||
|
PFNGLDRAWELEMENTSBASEVERTEXPROC glad_glDrawElementsBaseVertex;
|
||||||
|
PFNGLGETVERTEXATTRIBIUIVPROC glad_glGetVertexAttribIuiv;
|
||||||
|
PFNGLENABLEIPROC glad_glEnablei;
|
||||||
|
PFNGLSAMPLECOVERAGEPROC glad_glSampleCoverage;
|
||||||
|
PFNGLVERTEXATTRIB4NUSVPROC glad_glVertexAttrib4Nusv;
|
||||||
|
PFNGLGENTEXTURESPROC glad_glGenTextures;
|
||||||
|
PFNGLDEPTHFUNCPROC glad_glDepthFunc;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glad_glCompressedTexSubImage2D;
|
||||||
|
PFNGLGETRENDERBUFFERPARAMETERIVPROC glad_glGetRenderbufferParameteriv;
|
||||||
|
PFNGLUNIFORM1FPROC glad_glUniform1f;
|
||||||
|
PFNGLGETVERTEXATTRIBFVPROC glad_glGetVertexAttribfv;
|
||||||
|
PFNGLVERTEXATTRIBI4BVPROC glad_glVertexAttribI4bv;
|
||||||
|
PFNGLVERTEXATTRIB4NBVPROC glad_glVertexAttrib4Nbv;
|
||||||
|
PFNGLGETTEXPARAMETERFVPROC glad_glGetTexParameterfv;
|
||||||
|
PFNGLGETCOMPRESSEDTEXIMAGEPROC glad_glGetCompressedTexImage;
|
||||||
|
PFNGLISVERTEXARRAYPROC glad_glIsVertexArray;
|
||||||
|
PFNGLCREATESHADERPROC glad_glCreateShader;
|
||||||
|
PFNGLISBUFFERPROC glad_glIsBuffer;
|
||||||
|
PFNGLUNIFORM1IPROC glad_glUniform1i;
|
||||||
|
PFNGLVERTEXATTRIB3SPROC glad_glVertexAttrib3s;
|
||||||
|
PFNGLGETACTIVEATTRIBPROC glad_glGetActiveAttrib;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE2DPROC glad_glCopyTexSubImage2D;
|
||||||
|
PFNGLVERTEXATTRIB3DVPROC glad_glVertexAttrib3dv;
|
||||||
|
PFNGLTEXSUBIMAGE2DPROC glad_glTexSubImage2D;
|
||||||
|
PFNGLDISABLEPROC glad_glDisable;
|
||||||
|
PFNGLUNIFORM2IPROC glad_glUniform2i;
|
||||||
|
PFNGLBLENDFUNCSEPARATEPROC glad_glBlendFuncSeparate;
|
||||||
|
PFNGLLOGICOPPROC glad_glLogicOp;
|
||||||
|
PFNGLVERTEXATTRIBI4SVPROC glad_glVertexAttribI4sv;
|
||||||
|
PFNGLGETPROGRAMIVPROC glad_glGetProgramiv;
|
||||||
|
PFNGLCOLORMASKPROC glad_glColorMask;
|
||||||
|
PFNGLHINTPROC glad_glHint;
|
||||||
|
PFNGLVERTEXATTRIB1SPROC glad_glVertexAttrib1s;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURELAYERPROC glad_glFramebufferTextureLayer;
|
||||||
|
PFNGLTEXPARAMETERIIVPROC glad_glTexParameterIiv;
|
||||||
|
PFNGLBLENDEQUATIONPROC glad_glBlendEquation;
|
||||||
|
PFNGLGETUNIFORMLOCATIONPROC glad_glGetUniformLocation;
|
||||||
|
PFNGLSAMPLEMASKIPROC glad_glSampleMaski;
|
||||||
|
PFNGLBINDFRAMEBUFFERPROC glad_glBindFramebuffer;
|
||||||
|
PFNGLENDTRANSFORMFEEDBACKPROC glad_glEndTransformFeedback;
|
||||||
|
PFNGLCULLFACEPROC glad_glCullFace;
|
||||||
|
PFNGLUNIFORMMATRIX3X2FVPROC glad_glUniformMatrix3x2fv;
|
||||||
|
PFNGLVERTEXATTRIB4USVPROC glad_glVertexAttrib4usv;
|
||||||
|
PFNGLUNIFORM4FVPROC glad_glUniform4fv;
|
||||||
|
PFNGLGETTEXPARAMETERIUIVPROC glad_glGetTexParameterIuiv;
|
||||||
|
PFNGLDELETEFRAMEBUFFERSPROC glad_glDeleteFramebuffers;
|
||||||
|
PFNGLUNIFORM1UIVPROC glad_glUniform1uiv;
|
||||||
|
PFNGLPOINTSIZEPROC glad_glPointSize;
|
||||||
|
PFNGLGETSTRINGIPROC glad_glGetStringi;
|
||||||
|
PFNGLVERTEXATTRIB2DVPROC glad_glVertexAttrib2dv;
|
||||||
|
PFNGLVERTEXATTRIBI1IVPROC glad_glVertexAttribI1iv;
|
||||||
|
PFNGLDELETEPROGRAMPROC glad_glDeleteProgram;
|
||||||
|
PFNGLVERTEXATTRIB4NUIVPROC glad_glVertexAttrib4Nuiv;
|
||||||
|
PFNGLGENQUERIESPROC glad_glGenQueries;
|
||||||
|
PFNGLWAITSYNCPROC glad_glWaitSync;
|
||||||
|
PFNGLATTACHSHADERPROC glad_glAttachShader;
|
||||||
|
PFNGLBLITFRAMEBUFFERPROC glad_glBlitFramebuffer;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEPROC glad_glRenderbufferStorage;
|
||||||
|
PFNGLUNIFORMMATRIX4X3FVPROC glad_glUniformMatrix4x3fv;
|
||||||
|
PFNGLUNIFORM3IPROC glad_glUniform3i;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE1DPROC glad_glCompressedTexImage1D;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE1DPROC glad_glCopyTexSubImage1D;
|
||||||
|
PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glad_glDrawRangeElementsBaseVertex;
|
||||||
|
PFNGLCHECKFRAMEBUFFERSTATUSPROC glad_glCheckFramebufferStatus;
|
||||||
|
PFNGLTEXSUBIMAGE3DPROC glad_glTexSubImage3D;
|
||||||
|
PFNGLGETINTEGER64I_VPROC glad_glGetInteger64i_v;
|
||||||
|
PFNGLPROVOKINGVERTEXPROC glad_glProvokingVertex;
|
||||||
|
PFNGLGETMULTISAMPLEFVPROC glad_glGetMultisamplefv;
|
||||||
|
PFNGLCOPYTEXIMAGE2DPROC glad_glCopyTexImage2D;
|
||||||
|
PFNGLUNIFORM3FPROC glad_glUniform3f;
|
||||||
|
PFNGLVERTEXATTRIB4UBVPROC glad_glVertexAttrib4ubv;
|
||||||
|
PFNGLGETBUFFERPARAMETERIVPROC glad_glGetBufferParameteriv;
|
||||||
|
PFNGLUNIFORMMATRIX4X2FVPROC glad_glUniformMatrix4x2fv;
|
||||||
|
PFNGLENDCONDITIONALRENDERPROC glad_glEndConditionalRender;
|
||||||
|
PFNGLDRAWELEMENTSPROC glad_glDrawElements;
|
||||||
|
PFNGLCOLORMASKIPROC glad_glColorMaski;
|
||||||
|
PFNGLISENABLEDIPROC glad_glIsEnabledi;
|
||||||
|
PFNGLVERTEXATTRIB1DVPROC glad_glVertexAttrib1dv;
|
||||||
|
PFNGLDRAWRANGEELEMENTSPROC glad_glDrawRangeElements;
|
||||||
|
PFNGLGETQUERYOBJECTUIVPROC glad_glGetQueryObjectuiv;
|
||||||
|
PFNGLGENVERTEXARRAYSPROC glad_glGenVertexArrays;
|
||||||
|
PFNGLBINDBUFFERBASEPROC glad_glBindBufferBase;
|
||||||
|
PFNGLBUFFERSUBDATAPROC glad_glBufferSubData;
|
||||||
|
PFNGLUNIFORM1IVPROC glad_glUniform1iv;
|
||||||
|
PFNGLGETQUERYOBJECTIVPROC glad_glGetQueryObjectiv;
|
||||||
|
PFNGLUNIFORM4UIVPROC glad_glUniform4uiv;
|
||||||
|
PFNGLREADBUFFERPROC glad_glReadBuffer;
|
||||||
|
PFNGLCOPYBUFFERSUBDATAPROC glad_glCopyBufferSubData;
|
||||||
|
PFNGLBINDVERTEXARRAYPROC glad_glBindVertexArray;
|
||||||
|
PFNGLCLIENTWAITSYNCPROC glad_glClientWaitSync;
|
||||||
|
PFNGLBEGINCONDITIONALRENDERPROC glad_glBeginConditionalRender;
|
||||||
|
PFNGLVERTEXATTRIB3SVPROC glad_glVertexAttrib3sv;
|
||||||
|
PFNGLVERTEXATTRIBI2UIPROC glad_glVertexAttribI2ui;
|
||||||
|
PFNGLGENERATEMIPMAPPROC glad_glGenerateMipmap;
|
||||||
|
PFNGLMULTIDRAWARRAYSPROC glad_glMultiDrawArrays;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE1DPROC glad_glFramebufferTexture1D;
|
||||||
|
PFNGLGETSHADERIVPROC glad_glGetShaderiv;
|
||||||
|
PFNGLGETACTIVEUNIFORMBLOCKIVPROC glad_glGetActiveUniformBlockiv;
|
||||||
|
PFNGLUNIFORMMATRIX3X4FVPROC glad_glUniformMatrix3x4fv;
|
||||||
|
PFNGLVERTEXATTRIB3FPROC glad_glVertexAttrib3f;
|
||||||
|
PFNGLVERTEXATTRIB4UIVPROC glad_glVertexAttrib4uiv;
|
||||||
|
PFNGLPOINTPARAMETERIPROC glad_glPointParameteri;
|
||||||
|
PFNGLBLENDCOLORPROC glad_glBlendColor;
|
||||||
|
PFNGLENABLEVERTEXATTRIBARRAYPROC glad_glEnableVertexAttribArray;
|
||||||
|
PFNGLUNMAPBUFFERPROC glad_glUnmapBuffer;
|
||||||
|
PFNGLDEPTHMASKPROC glad_glDepthMask;
|
||||||
|
PFNGLPOINTPARAMETERFPROC glad_glPointParameterf;
|
||||||
|
PFNGLDISABLEIPROC glad_glDisablei;
|
||||||
|
PFNGLGETDOUBLEVPROC glad_glGetDoublev;
|
||||||
|
PFNGLVERTEXATTRIBI4IVPROC glad_glVertexAttribI4iv;
|
||||||
|
PFNGLVERTEXATTRIB1SVPROC glad_glVertexAttrib1sv;
|
||||||
|
PFNGLSHADERSOURCEPROC glad_glShaderSource;
|
||||||
|
PFNGLBINDRENDERBUFFERPROC glad_glBindRenderbuffer;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE2DPROC glad_glCompressedTexImage2D;
|
||||||
|
PFNGLVERTEXATTRIBI3UIVPROC glad_glVertexAttribI3uiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IVPROC glad_glVertexAttribI2iv;
|
||||||
|
PFNGLDRAWARRAYSPROC glad_glDrawArrays;
|
||||||
|
PFNGLUNIFORM1UIPROC glad_glUniform1ui;
|
||||||
|
PFNGLISPROGRAMPROC glad_glIsProgram;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERIVPROC glad_glGetTexLevelParameteriv;
|
||||||
|
PFNGLGETFRAGDATALOCATIONPROC glad_glGetFragDataLocation;
|
||||||
|
PFNGLGETSYNCIVPROC glad_glGetSynciv;
|
||||||
|
PFNGLGETUNIFORMIVPROC glad_glGetUniformiv;
|
||||||
|
PFNGLVERTEXATTRIBI2IPROC glad_glVertexAttribI2i;
|
||||||
|
PFNGLUNIFORM4IPROC glad_glUniform4i;
|
||||||
|
PFNGLVERTEXATTRIB3DPROC glad_glVertexAttrib3d;
|
||||||
|
PFNGLCLEARPROC glad_glClear;
|
||||||
|
PFNGLVERTEXATTRIB4FVPROC glad_glVertexAttrib4fv;
|
||||||
|
PFNGLGETACTIVEUNIFORMNAMEPROC glad_glGetActiveUniformName;
|
||||||
|
PFNGLUNIFORM2FPROC glad_glUniform2f;
|
||||||
|
PFNGLTEXIMAGE2DMULTISAMPLEPROC glad_glTexImage2DMultisample;
|
||||||
|
PFNGLACTIVETEXTUREPROC glad_glActiveTexture;
|
||||||
|
PFNGLBEGINQUERYPROC glad_glBeginQuery;
|
||||||
|
PFNGLUNIFORM2IVPROC glad_glUniform2iv;
|
||||||
|
PFNGLBINDBUFFERPROC glad_glBindBuffer;
|
||||||
|
PFNGLISENABLEDPROC glad_glIsEnabled;
|
||||||
|
PFNGLSTENCILOPPROC glad_glStencilOp;
|
||||||
|
PFNGLREADPIXELSPROC glad_glReadPixels;
|
||||||
|
PFNGLCLEARDEPTHPROC glad_glClearDepth;
|
||||||
|
PFNGLVERTEXATTRIBI3IVPROC glad_glVertexAttribI3iv;
|
||||||
|
PFNGLUNIFORM4FPROC glad_glUniform4f;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE2DPROC glad_glFramebufferTexture2D;
|
||||||
|
PFNGLMAPBUFFERPROC glad_glMapBuffer;
|
||||||
|
PFNGLVERTEXATTRIB1DPROC glad_glVertexAttrib1d;
|
||||||
|
PFNGLVERTEXATTRIB4NUBPROC glad_glVertexAttrib4Nub;
|
||||||
|
PFNGLUNIFORM3FVPROC glad_glUniform3fv;
|
||||||
|
PFNGLGETUNIFORMFVPROC glad_glGetUniformfv;
|
||||||
|
PFNGLBUFFERDATAPROC glad_glBufferData;
|
||||||
|
PFNGLGETTEXPARAMETERIIVPROC glad_glGetTexParameterIiv;
|
||||||
|
PFNGLCOMPRESSEDTEXIMAGE3DPROC glad_glCompressedTexImage3D;
|
||||||
|
PFNGLTEXIMAGE1DPROC glad_glTexImage1D;
|
||||||
|
PFNGLDELETESYNCPROC glad_glDeleteSync;
|
||||||
|
PFNGLCOPYTEXSUBIMAGE3DPROC glad_glCopyTexSubImage3D;
|
||||||
|
PFNGLGETERRORPROC glad_glGetError;
|
||||||
|
PFNGLDELETERENDERBUFFERSPROC glad_glDeleteRenderbuffers;
|
||||||
|
PFNGLGETVERTEXATTRIBIVPROC glad_glGetVertexAttribiv;
|
||||||
|
PFNGLTEXPARAMETERIVPROC glad_glTexParameteriv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSPROC glad_glMultiDrawElements;
|
||||||
|
PFNGLVERTEXATTRIB3FVPROC glad_glVertexAttrib3fv;
|
||||||
|
PFNGLGETFLOATVPROC glad_glGetFloatv;
|
||||||
|
PFNGLTEXSUBIMAGE1DPROC glad_glTexSubImage1D;
|
||||||
|
PFNGLUNIFORM3IVPROC glad_glUniform3iv;
|
||||||
|
PFNGLGETTEXIMAGEPROC glad_glGetTexImage;
|
||||||
|
PFNGLVERTEXATTRIB2FVPROC glad_glVertexAttrib2fv;
|
||||||
|
PFNGLUSEPROGRAMPROC glad_glUseProgram;
|
||||||
|
PFNGLVERTEXATTRIB4IVPROC glad_glVertexAttrib4iv;
|
||||||
|
PFNGLGETTEXLEVELPARAMETERFVPROC glad_glGetTexLevelParameterfv;
|
||||||
|
PFNGLVERTEXATTRIBI1IPROC glad_glVertexAttribI1i;
|
||||||
|
PFNGLGENFRAMEBUFFERSPROC glad_glGenFramebuffers;
|
||||||
|
PFNGLFRAMEBUFFERRENDERBUFFERPROC glad_glFramebufferRenderbuffer;
|
||||||
|
PFNGLDRAWBUFFERSPROC glad_glDrawBuffers;
|
||||||
|
PFNGLCLEARBUFFERFVPROC glad_glClearBufferfv;
|
||||||
|
PFNGLSTENCILFUNCPROC glad_glStencilFunc;
|
||||||
|
PFNGLGETINTEGERVPROC glad_glGetIntegerv;
|
||||||
|
PFNGLGETATTACHEDSHADERSPROC glad_glGetAttachedShaders;
|
||||||
|
PFNGLUNIFORMBLOCKBINDINGPROC glad_glUniformBlockBinding;
|
||||||
|
PFNGLISRENDERBUFFERPROC glad_glIsRenderbuffer;
|
||||||
|
PFNGLGETBUFFERPOINTERVPROC glad_glGetBufferPointerv;
|
||||||
|
PFNGLGETVERTEXATTRIBIIVPROC glad_glGetVertexAttribIiv;
|
||||||
|
PFNGLDRAWBUFFERPROC glad_glDrawBuffer;
|
||||||
|
PFNGLFRAMEBUFFERTEXTURE3DPROC glad_glFramebufferTexture3D;
|
||||||
|
PFNGLUNIFORM1FVPROC glad_glUniform1fv;
|
||||||
|
PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glad_glRenderbufferStorageMultisample;
|
||||||
|
PFNGLMAPBUFFERRANGEPROC glad_glMapBufferRange;
|
||||||
|
PFNGLISQUERYPROC glad_glIsQuery;
|
||||||
|
PFNGLVERTEXATTRIB4NUBVPROC glad_glVertexAttrib4Nubv;
|
||||||
|
PFNGLUNIFORMMATRIX2FVPROC glad_glUniformMatrix2fv;
|
||||||
|
PFNGLDISABLEVERTEXATTRIBARRAYPROC glad_glDisableVertexAttribArray;
|
||||||
|
PFNGLVERTEXATTRIB4SVPROC glad_glVertexAttrib4sv;
|
||||||
|
PFNGLGETQUERYIVPROC glad_glGetQueryiv;
|
||||||
|
PFNGLTEXIMAGE2DPROC glad_glTexImage2D;
|
||||||
|
PFNGLGETPROGRAMINFOLOGPROC glad_glGetProgramInfoLog;
|
||||||
|
PFNGLSTENCILMASKPROC glad_glStencilMask;
|
||||||
|
PFNGLUNIFORM4UIPROC glad_glUniform4ui;
|
||||||
|
PFNGLUNIFORMMATRIX2X4FVPROC glad_glUniformMatrix2x4fv;
|
||||||
|
PFNGLGETSHADERINFOLOGPROC glad_glGetShaderInfoLog;
|
||||||
|
PFNGLISTEXTUREPROC glad_glIsTexture;
|
||||||
|
PFNGLGETUNIFORMINDICESPROC glad_glGetUniformIndices;
|
||||||
|
PFNGLISSHADERPROC glad_glIsShader;
|
||||||
|
PFNGLGETSHADERSOURCEPROC glad_glGetShaderSource;
|
||||||
|
PFNGLVERTEXATTRIBI4UBVPROC glad_glVertexAttribI4ubv;
|
||||||
|
PFNGLVERTEXATTRIB4BVPROC glad_glVertexAttrib4bv;
|
||||||
|
PFNGLGETINTEGER64VPROC glad_glGetInteger64v;
|
||||||
|
PFNGLVERTEXATTRIBPOINTERPROC glad_glVertexAttribPointer;
|
||||||
|
PFNGLTEXPARAMETERFVPROC glad_glTexParameterfv;
|
||||||
|
PFNGLGETBUFFERSUBDATAPROC glad_glGetBufferSubData;
|
||||||
|
PFNGLVERTEXATTRIB1FVPROC glad_glVertexAttrib1fv;
|
||||||
|
PFNGLTEXPARAMETERIUIVPROC glad_glTexParameterIuiv;
|
||||||
|
PFNGLENABLEPROC glad_glEnable;
|
||||||
|
PFNGLGETACTIVEUNIFORMSIVPROC glad_glGetActiveUniformsiv;
|
||||||
|
PFNGLDRAWARRAYSINSTANCEDPROC glad_glDrawArraysInstanced;
|
||||||
|
PFNGLVERTEXATTRIBI4IPROC glad_glVertexAttribI4i;
|
||||||
|
PFNGLSTENCILFUNCSEPARATEPROC glad_glStencilFuncSeparate;
|
||||||
|
PFNGLDELETEQUERIESPROC glad_glDeleteQueries;
|
||||||
|
PFNGLPOINTPARAMETERIVPROC glad_glPointParameteriv;
|
||||||
|
PFNGLBLENDEQUATIONSEPARATEPROC glad_glBlendEquationSeparate;
|
||||||
|
PFNGLVERTEXATTRIBI1UIPROC glad_glVertexAttribI1ui;
|
||||||
|
PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glad_glCompressedTexSubImage1D;
|
||||||
|
PFNGLFINISHPROC glad_glFinish;
|
||||||
|
PFNGLGETATTRIBLOCATIONPROC glad_glGetAttribLocation;
|
||||||
|
PFNGLVERTEXATTRIB4DVPROC glad_glVertexAttrib4dv;
|
||||||
|
PFNGLVERTEXATTRIB2SVPROC glad_glVertexAttrib2sv;
|
||||||
|
PFNGLDELETESHADERPROC glad_glDeleteShader;
|
||||||
|
PFNGLBLENDFUNCPROC glad_glBlendFunc;
|
||||||
|
PFNGLCREATEPROGRAMPROC glad_glCreateProgram;
|
||||||
|
PFNGLTEXIMAGE3DPROC glad_glTexImage3D;
|
||||||
|
PFNGLVERTEXATTRIB4NSVPROC glad_glVertexAttrib4Nsv;
|
||||||
|
PFNGLISFRAMEBUFFERPROC glad_glIsFramebuffer;
|
||||||
|
PFNGLVERTEXATTRIBI4UIPROC glad_glVertexAttribI4ui;
|
||||||
|
PFNGLFLUSHMAPPEDBUFFERRANGEPROC glad_glFlushMappedBufferRange;
|
||||||
|
PFNGLVIEWPORTPROC glad_glViewport;
|
||||||
|
PFNGLVERTEXATTRIBI1UIVPROC glad_glVertexAttribI1uiv;
|
||||||
|
PFNGLVERTEXATTRIB2DPROC glad_glVertexAttrib2d;
|
||||||
|
PFNGLTRANSFORMFEEDBACKVARYINGSPROC glad_glTransformFeedbackVaryings;
|
||||||
|
PFNGLVERTEXATTRIB2FPROC glad_glVertexAttrib2f;
|
||||||
|
PFNGLGETVERTEXATTRIBDVPROC glad_glGetVertexAttribdv;
|
||||||
|
PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glad_glMultiDrawElementsBaseVertex;
|
||||||
|
PFNGLPRIMITIVERESTARTINDEXPROC glad_glPrimitiveRestartIndex;
|
||||||
|
PFNGLUNIFORM2UIPROC glad_glUniform2ui;
|
||||||
|
PFNGLPOLYGONOFFSETPROC glad_glPolygonOffset;
|
||||||
|
PFNGLGETUNIFORMUIVPROC glad_glGetUniformuiv;
|
||||||
|
PFNGLVERTEXATTRIBI3IPROC glad_glVertexAttribI3i;
|
||||||
|
PFNGLVERTEXATTRIB2SPROC glad_glVertexAttrib2s;
|
||||||
|
PFNGLTEXIMAGE3DMULTISAMPLEPROC glad_glTexImage3DMultisample;
|
||||||
|
PFNGLUNIFORMMATRIX4FVPROC glad_glUniformMatrix4fv;
|
||||||
|
PFNGLDEPTHRANGEPROC glad_glDepthRange;
|
||||||
|
PFNGLGETACTIVEUNIFORMPROC glad_glGetActiveUniform;
|
||||||
|
PFNGLVERTEXATTRIBI4USVPROC glad_glVertexAttribI4usv;
|
||||||
|
PFNGLTEXPARAMETERFPROC glad_glTexParameterf;
|
||||||
|
PFNGLCLEARBUFFERFIPROC glad_glClearBufferfi;
|
||||||
|
PFNGLTEXPARAMETERIPROC glad_glTexParameteri;
|
||||||
|
PFNGLFRONTFACEPROC glad_glFrontFace;
|
||||||
|
PFNGLDELETEBUFFERSPROC glad_glDeleteBuffers;
|
||||||
|
PFNGLSCISSORPROC glad_glScissor;
|
||||||
|
PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glad_glDrawElementsInstancedBaseVertex;
|
||||||
|
PFNGLGETBOOLEANVPROC glad_glGetBooleanv;
|
||||||
|
PFNGLTEXBUFFERPROC glad_glTexBuffer;
|
||||||
|
PFNGLPIXELSTOREIPROC glad_glPixelStorei;
|
||||||
|
PFNGLVALIDATEPROGRAMPROC glad_glValidateProgram;
|
||||||
|
PFNGLPIXELSTOREFPROC glad_glPixelStoref;
|
||||||
|
PFNGLCLEARBUFFERUIVPROC glad_glClearBufferuiv;
|
||||||
|
PFNGLUNIFORM3UIVPROC glad_glUniform3uiv;
|
||||||
|
PFNGLGETBOOLEANI_VPROC glad_glGetBooleani_v;
|
||||||
|
PFNGLVERTEXATTRIBIPOINTERPROC glad_glVertexAttribIPointer;
|
||||||
|
int GLAD_GL_ARB_debug_output;
|
||||||
|
int GLAD_GL_EXT_texture_filter_anisotropic;
|
||||||
|
PFNGLDEBUGMESSAGECONTROLARBPROC glad_glDebugMessageControlARB;
|
||||||
|
PFNGLDEBUGMESSAGEINSERTARBPROC glad_glDebugMessageInsertARB;
|
||||||
|
PFNGLDEBUGMESSAGECALLBACKARBPROC glad_glDebugMessageCallbackARB;
|
||||||
|
PFNGLGETDEBUGMESSAGELOGARBPROC glad_glGetDebugMessageLogARB;
|
||||||
|
static void load_GL_VERSION_1_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_0) return;
|
||||||
|
glad_glCullFace = (PFNGLCULLFACEPROC)load("glCullFace");
|
||||||
|
glad_glFrontFace = (PFNGLFRONTFACEPROC)load("glFrontFace");
|
||||||
|
glad_glHint = (PFNGLHINTPROC)load("glHint");
|
||||||
|
glad_glLineWidth = (PFNGLLINEWIDTHPROC)load("glLineWidth");
|
||||||
|
glad_glPointSize = (PFNGLPOINTSIZEPROC)load("glPointSize");
|
||||||
|
glad_glPolygonMode = (PFNGLPOLYGONMODEPROC)load("glPolygonMode");
|
||||||
|
glad_glScissor = (PFNGLSCISSORPROC)load("glScissor");
|
||||||
|
glad_glTexParameterf = (PFNGLTEXPARAMETERFPROC)load("glTexParameterf");
|
||||||
|
glad_glTexParameterfv = (PFNGLTEXPARAMETERFVPROC)load("glTexParameterfv");
|
||||||
|
glad_glTexParameteri = (PFNGLTEXPARAMETERIPROC)load("glTexParameteri");
|
||||||
|
glad_glTexParameteriv = (PFNGLTEXPARAMETERIVPROC)load("glTexParameteriv");
|
||||||
|
glad_glTexImage1D = (PFNGLTEXIMAGE1DPROC)load("glTexImage1D");
|
||||||
|
glad_glTexImage2D = (PFNGLTEXIMAGE2DPROC)load("glTexImage2D");
|
||||||
|
glad_glDrawBuffer = (PFNGLDRAWBUFFERPROC)load("glDrawBuffer");
|
||||||
|
glad_glClear = (PFNGLCLEARPROC)load("glClear");
|
||||||
|
glad_glClearColor = (PFNGLCLEARCOLORPROC)load("glClearColor");
|
||||||
|
glad_glClearStencil = (PFNGLCLEARSTENCILPROC)load("glClearStencil");
|
||||||
|
glad_glClearDepth = (PFNGLCLEARDEPTHPROC)load("glClearDepth");
|
||||||
|
glad_glStencilMask = (PFNGLSTENCILMASKPROC)load("glStencilMask");
|
||||||
|
glad_glColorMask = (PFNGLCOLORMASKPROC)load("glColorMask");
|
||||||
|
glad_glDepthMask = (PFNGLDEPTHMASKPROC)load("glDepthMask");
|
||||||
|
glad_glDisable = (PFNGLDISABLEPROC)load("glDisable");
|
||||||
|
glad_glEnable = (PFNGLENABLEPROC)load("glEnable");
|
||||||
|
glad_glFinish = (PFNGLFINISHPROC)load("glFinish");
|
||||||
|
glad_glFlush = (PFNGLFLUSHPROC)load("glFlush");
|
||||||
|
glad_glBlendFunc = (PFNGLBLENDFUNCPROC)load("glBlendFunc");
|
||||||
|
glad_glLogicOp = (PFNGLLOGICOPPROC)load("glLogicOp");
|
||||||
|
glad_glStencilFunc = (PFNGLSTENCILFUNCPROC)load("glStencilFunc");
|
||||||
|
glad_glStencilOp = (PFNGLSTENCILOPPROC)load("glStencilOp");
|
||||||
|
glad_glDepthFunc = (PFNGLDEPTHFUNCPROC)load("glDepthFunc");
|
||||||
|
glad_glPixelStoref = (PFNGLPIXELSTOREFPROC)load("glPixelStoref");
|
||||||
|
glad_glPixelStorei = (PFNGLPIXELSTOREIPROC)load("glPixelStorei");
|
||||||
|
glad_glReadBuffer = (PFNGLREADBUFFERPROC)load("glReadBuffer");
|
||||||
|
glad_glReadPixels = (PFNGLREADPIXELSPROC)load("glReadPixels");
|
||||||
|
glad_glGetBooleanv = (PFNGLGETBOOLEANVPROC)load("glGetBooleanv");
|
||||||
|
glad_glGetDoublev = (PFNGLGETDOUBLEVPROC)load("glGetDoublev");
|
||||||
|
glad_glGetError = (PFNGLGETERRORPROC)load("glGetError");
|
||||||
|
glad_glGetFloatv = (PFNGLGETFLOATVPROC)load("glGetFloatv");
|
||||||
|
glad_glGetIntegerv = (PFNGLGETINTEGERVPROC)load("glGetIntegerv");
|
||||||
|
glad_glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
glad_glGetTexImage = (PFNGLGETTEXIMAGEPROC)load("glGetTexImage");
|
||||||
|
glad_glGetTexParameterfv = (PFNGLGETTEXPARAMETERFVPROC)load("glGetTexParameterfv");
|
||||||
|
glad_glGetTexParameteriv = (PFNGLGETTEXPARAMETERIVPROC)load("glGetTexParameteriv");
|
||||||
|
glad_glGetTexLevelParameterfv = (PFNGLGETTEXLEVELPARAMETERFVPROC)load("glGetTexLevelParameterfv");
|
||||||
|
glad_glGetTexLevelParameteriv = (PFNGLGETTEXLEVELPARAMETERIVPROC)load("glGetTexLevelParameteriv");
|
||||||
|
glad_glIsEnabled = (PFNGLISENABLEDPROC)load("glIsEnabled");
|
||||||
|
glad_glDepthRange = (PFNGLDEPTHRANGEPROC)load("glDepthRange");
|
||||||
|
glad_glViewport = (PFNGLVIEWPORTPROC)load("glViewport");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_1) return;
|
||||||
|
glad_glDrawArrays = (PFNGLDRAWARRAYSPROC)load("glDrawArrays");
|
||||||
|
glad_glDrawElements = (PFNGLDRAWELEMENTSPROC)load("glDrawElements");
|
||||||
|
glad_glPolygonOffset = (PFNGLPOLYGONOFFSETPROC)load("glPolygonOffset");
|
||||||
|
glad_glCopyTexImage1D = (PFNGLCOPYTEXIMAGE1DPROC)load("glCopyTexImage1D");
|
||||||
|
glad_glCopyTexImage2D = (PFNGLCOPYTEXIMAGE2DPROC)load("glCopyTexImage2D");
|
||||||
|
glad_glCopyTexSubImage1D = (PFNGLCOPYTEXSUBIMAGE1DPROC)load("glCopyTexSubImage1D");
|
||||||
|
glad_glCopyTexSubImage2D = (PFNGLCOPYTEXSUBIMAGE2DPROC)load("glCopyTexSubImage2D");
|
||||||
|
glad_glTexSubImage1D = (PFNGLTEXSUBIMAGE1DPROC)load("glTexSubImage1D");
|
||||||
|
glad_glTexSubImage2D = (PFNGLTEXSUBIMAGE2DPROC)load("glTexSubImage2D");
|
||||||
|
glad_glBindTexture = (PFNGLBINDTEXTUREPROC)load("glBindTexture");
|
||||||
|
glad_glDeleteTextures = (PFNGLDELETETEXTURESPROC)load("glDeleteTextures");
|
||||||
|
glad_glGenTextures = (PFNGLGENTEXTURESPROC)load("glGenTextures");
|
||||||
|
glad_glIsTexture = (PFNGLISTEXTUREPROC)load("glIsTexture");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_2) return;
|
||||||
|
glad_glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC)load("glDrawRangeElements");
|
||||||
|
glad_glTexImage3D = (PFNGLTEXIMAGE3DPROC)load("glTexImage3D");
|
||||||
|
glad_glTexSubImage3D = (PFNGLTEXSUBIMAGE3DPROC)load("glTexSubImage3D");
|
||||||
|
glad_glCopyTexSubImage3D = (PFNGLCOPYTEXSUBIMAGE3DPROC)load("glCopyTexSubImage3D");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_3(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_3) return;
|
||||||
|
glad_glActiveTexture = (PFNGLACTIVETEXTUREPROC)load("glActiveTexture");
|
||||||
|
glad_glSampleCoverage = (PFNGLSAMPLECOVERAGEPROC)load("glSampleCoverage");
|
||||||
|
glad_glCompressedTexImage3D = (PFNGLCOMPRESSEDTEXIMAGE3DPROC)load("glCompressedTexImage3D");
|
||||||
|
glad_glCompressedTexImage2D = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)load("glCompressedTexImage2D");
|
||||||
|
glad_glCompressedTexImage1D = (PFNGLCOMPRESSEDTEXIMAGE1DPROC)load("glCompressedTexImage1D");
|
||||||
|
glad_glCompressedTexSubImage3D = (PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC)load("glCompressedTexSubImage3D");
|
||||||
|
glad_glCompressedTexSubImage2D = (PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC)load("glCompressedTexSubImage2D");
|
||||||
|
glad_glCompressedTexSubImage1D = (PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC)load("glCompressedTexSubImage1D");
|
||||||
|
glad_glGetCompressedTexImage = (PFNGLGETCOMPRESSEDTEXIMAGEPROC)load("glGetCompressedTexImage");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_4(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_4) return;
|
||||||
|
glad_glBlendFuncSeparate = (PFNGLBLENDFUNCSEPARATEPROC)load("glBlendFuncSeparate");
|
||||||
|
glad_glMultiDrawArrays = (PFNGLMULTIDRAWARRAYSPROC)load("glMultiDrawArrays");
|
||||||
|
glad_glMultiDrawElements = (PFNGLMULTIDRAWELEMENTSPROC)load("glMultiDrawElements");
|
||||||
|
glad_glPointParameterf = (PFNGLPOINTPARAMETERFPROC)load("glPointParameterf");
|
||||||
|
glad_glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC)load("glPointParameterfv");
|
||||||
|
glad_glPointParameteri = (PFNGLPOINTPARAMETERIPROC)load("glPointParameteri");
|
||||||
|
glad_glPointParameteriv = (PFNGLPOINTPARAMETERIVPROC)load("glPointParameteriv");
|
||||||
|
glad_glBlendColor = (PFNGLBLENDCOLORPROC)load("glBlendColor");
|
||||||
|
glad_glBlendEquation = (PFNGLBLENDEQUATIONPROC)load("glBlendEquation");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_1_5(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_1_5) return;
|
||||||
|
glad_glGenQueries = (PFNGLGENQUERIESPROC)load("glGenQueries");
|
||||||
|
glad_glDeleteQueries = (PFNGLDELETEQUERIESPROC)load("glDeleteQueries");
|
||||||
|
glad_glIsQuery = (PFNGLISQUERYPROC)load("glIsQuery");
|
||||||
|
glad_glBeginQuery = (PFNGLBEGINQUERYPROC)load("glBeginQuery");
|
||||||
|
glad_glEndQuery = (PFNGLENDQUERYPROC)load("glEndQuery");
|
||||||
|
glad_glGetQueryiv = (PFNGLGETQUERYIVPROC)load("glGetQueryiv");
|
||||||
|
glad_glGetQueryObjectiv = (PFNGLGETQUERYOBJECTIVPROC)load("glGetQueryObjectiv");
|
||||||
|
glad_glGetQueryObjectuiv = (PFNGLGETQUERYOBJECTUIVPROC)load("glGetQueryObjectuiv");
|
||||||
|
glad_glBindBuffer = (PFNGLBINDBUFFERPROC)load("glBindBuffer");
|
||||||
|
glad_glDeleteBuffers = (PFNGLDELETEBUFFERSPROC)load("glDeleteBuffers");
|
||||||
|
glad_glGenBuffers = (PFNGLGENBUFFERSPROC)load("glGenBuffers");
|
||||||
|
glad_glIsBuffer = (PFNGLISBUFFERPROC)load("glIsBuffer");
|
||||||
|
glad_glBufferData = (PFNGLBUFFERDATAPROC)load("glBufferData");
|
||||||
|
glad_glBufferSubData = (PFNGLBUFFERSUBDATAPROC)load("glBufferSubData");
|
||||||
|
glad_glGetBufferSubData = (PFNGLGETBUFFERSUBDATAPROC)load("glGetBufferSubData");
|
||||||
|
glad_glMapBuffer = (PFNGLMAPBUFFERPROC)load("glMapBuffer");
|
||||||
|
glad_glUnmapBuffer = (PFNGLUNMAPBUFFERPROC)load("glUnmapBuffer");
|
||||||
|
glad_glGetBufferParameteriv = (PFNGLGETBUFFERPARAMETERIVPROC)load("glGetBufferParameteriv");
|
||||||
|
glad_glGetBufferPointerv = (PFNGLGETBUFFERPOINTERVPROC)load("glGetBufferPointerv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_0) return;
|
||||||
|
glad_glBlendEquationSeparate = (PFNGLBLENDEQUATIONSEPARATEPROC)load("glBlendEquationSeparate");
|
||||||
|
glad_glDrawBuffers = (PFNGLDRAWBUFFERSPROC)load("glDrawBuffers");
|
||||||
|
glad_glStencilOpSeparate = (PFNGLSTENCILOPSEPARATEPROC)load("glStencilOpSeparate");
|
||||||
|
glad_glStencilFuncSeparate = (PFNGLSTENCILFUNCSEPARATEPROC)load("glStencilFuncSeparate");
|
||||||
|
glad_glStencilMaskSeparate = (PFNGLSTENCILMASKSEPARATEPROC)load("glStencilMaskSeparate");
|
||||||
|
glad_glAttachShader = (PFNGLATTACHSHADERPROC)load("glAttachShader");
|
||||||
|
glad_glBindAttribLocation = (PFNGLBINDATTRIBLOCATIONPROC)load("glBindAttribLocation");
|
||||||
|
glad_glCompileShader = (PFNGLCOMPILESHADERPROC)load("glCompileShader");
|
||||||
|
glad_glCreateProgram = (PFNGLCREATEPROGRAMPROC)load("glCreateProgram");
|
||||||
|
glad_glCreateShader = (PFNGLCREATESHADERPROC)load("glCreateShader");
|
||||||
|
glad_glDeleteProgram = (PFNGLDELETEPROGRAMPROC)load("glDeleteProgram");
|
||||||
|
glad_glDeleteShader = (PFNGLDELETESHADERPROC)load("glDeleteShader");
|
||||||
|
glad_glDetachShader = (PFNGLDETACHSHADERPROC)load("glDetachShader");
|
||||||
|
glad_glDisableVertexAttribArray = (PFNGLDISABLEVERTEXATTRIBARRAYPROC)load("glDisableVertexAttribArray");
|
||||||
|
glad_glEnableVertexAttribArray = (PFNGLENABLEVERTEXATTRIBARRAYPROC)load("glEnableVertexAttribArray");
|
||||||
|
glad_glGetActiveAttrib = (PFNGLGETACTIVEATTRIBPROC)load("glGetActiveAttrib");
|
||||||
|
glad_glGetActiveUniform = (PFNGLGETACTIVEUNIFORMPROC)load("glGetActiveUniform");
|
||||||
|
glad_glGetAttachedShaders = (PFNGLGETATTACHEDSHADERSPROC)load("glGetAttachedShaders");
|
||||||
|
glad_glGetAttribLocation = (PFNGLGETATTRIBLOCATIONPROC)load("glGetAttribLocation");
|
||||||
|
glad_glGetProgramiv = (PFNGLGETPROGRAMIVPROC)load("glGetProgramiv");
|
||||||
|
glad_glGetProgramInfoLog = (PFNGLGETPROGRAMINFOLOGPROC)load("glGetProgramInfoLog");
|
||||||
|
glad_glGetShaderiv = (PFNGLGETSHADERIVPROC)load("glGetShaderiv");
|
||||||
|
glad_glGetShaderInfoLog = (PFNGLGETSHADERINFOLOGPROC)load("glGetShaderInfoLog");
|
||||||
|
glad_glGetShaderSource = (PFNGLGETSHADERSOURCEPROC)load("glGetShaderSource");
|
||||||
|
glad_glGetUniformLocation = (PFNGLGETUNIFORMLOCATIONPROC)load("glGetUniformLocation");
|
||||||
|
glad_glGetUniformfv = (PFNGLGETUNIFORMFVPROC)load("glGetUniformfv");
|
||||||
|
glad_glGetUniformiv = (PFNGLGETUNIFORMIVPROC)load("glGetUniformiv");
|
||||||
|
glad_glGetVertexAttribdv = (PFNGLGETVERTEXATTRIBDVPROC)load("glGetVertexAttribdv");
|
||||||
|
glad_glGetVertexAttribfv = (PFNGLGETVERTEXATTRIBFVPROC)load("glGetVertexAttribfv");
|
||||||
|
glad_glGetVertexAttribiv = (PFNGLGETVERTEXATTRIBIVPROC)load("glGetVertexAttribiv");
|
||||||
|
glad_glGetVertexAttribPointerv = (PFNGLGETVERTEXATTRIBPOINTERVPROC)load("glGetVertexAttribPointerv");
|
||||||
|
glad_glIsProgram = (PFNGLISPROGRAMPROC)load("glIsProgram");
|
||||||
|
glad_glIsShader = (PFNGLISSHADERPROC)load("glIsShader");
|
||||||
|
glad_glLinkProgram = (PFNGLLINKPROGRAMPROC)load("glLinkProgram");
|
||||||
|
glad_glShaderSource = (PFNGLSHADERSOURCEPROC)load("glShaderSource");
|
||||||
|
glad_glUseProgram = (PFNGLUSEPROGRAMPROC)load("glUseProgram");
|
||||||
|
glad_glUniform1f = (PFNGLUNIFORM1FPROC)load("glUniform1f");
|
||||||
|
glad_glUniform2f = (PFNGLUNIFORM2FPROC)load("glUniform2f");
|
||||||
|
glad_glUniform3f = (PFNGLUNIFORM3FPROC)load("glUniform3f");
|
||||||
|
glad_glUniform4f = (PFNGLUNIFORM4FPROC)load("glUniform4f");
|
||||||
|
glad_glUniform1i = (PFNGLUNIFORM1IPROC)load("glUniform1i");
|
||||||
|
glad_glUniform2i = (PFNGLUNIFORM2IPROC)load("glUniform2i");
|
||||||
|
glad_glUniform3i = (PFNGLUNIFORM3IPROC)load("glUniform3i");
|
||||||
|
glad_glUniform4i = (PFNGLUNIFORM4IPROC)load("glUniform4i");
|
||||||
|
glad_glUniform1fv = (PFNGLUNIFORM1FVPROC)load("glUniform1fv");
|
||||||
|
glad_glUniform2fv = (PFNGLUNIFORM2FVPROC)load("glUniform2fv");
|
||||||
|
glad_glUniform3fv = (PFNGLUNIFORM3FVPROC)load("glUniform3fv");
|
||||||
|
glad_glUniform4fv = (PFNGLUNIFORM4FVPROC)load("glUniform4fv");
|
||||||
|
glad_glUniform1iv = (PFNGLUNIFORM1IVPROC)load("glUniform1iv");
|
||||||
|
glad_glUniform2iv = (PFNGLUNIFORM2IVPROC)load("glUniform2iv");
|
||||||
|
glad_glUniform3iv = (PFNGLUNIFORM3IVPROC)load("glUniform3iv");
|
||||||
|
glad_glUniform4iv = (PFNGLUNIFORM4IVPROC)load("glUniform4iv");
|
||||||
|
glad_glUniformMatrix2fv = (PFNGLUNIFORMMATRIX2FVPROC)load("glUniformMatrix2fv");
|
||||||
|
glad_glUniformMatrix3fv = (PFNGLUNIFORMMATRIX3FVPROC)load("glUniformMatrix3fv");
|
||||||
|
glad_glUniformMatrix4fv = (PFNGLUNIFORMMATRIX4FVPROC)load("glUniformMatrix4fv");
|
||||||
|
glad_glValidateProgram = (PFNGLVALIDATEPROGRAMPROC)load("glValidateProgram");
|
||||||
|
glad_glVertexAttrib1d = (PFNGLVERTEXATTRIB1DPROC)load("glVertexAttrib1d");
|
||||||
|
glad_glVertexAttrib1dv = (PFNGLVERTEXATTRIB1DVPROC)load("glVertexAttrib1dv");
|
||||||
|
glad_glVertexAttrib1f = (PFNGLVERTEXATTRIB1FPROC)load("glVertexAttrib1f");
|
||||||
|
glad_glVertexAttrib1fv = (PFNGLVERTEXATTRIB1FVPROC)load("glVertexAttrib1fv");
|
||||||
|
glad_glVertexAttrib1s = (PFNGLVERTEXATTRIB1SPROC)load("glVertexAttrib1s");
|
||||||
|
glad_glVertexAttrib1sv = (PFNGLVERTEXATTRIB1SVPROC)load("glVertexAttrib1sv");
|
||||||
|
glad_glVertexAttrib2d = (PFNGLVERTEXATTRIB2DPROC)load("glVertexAttrib2d");
|
||||||
|
glad_glVertexAttrib2dv = (PFNGLVERTEXATTRIB2DVPROC)load("glVertexAttrib2dv");
|
||||||
|
glad_glVertexAttrib2f = (PFNGLVERTEXATTRIB2FPROC)load("glVertexAttrib2f");
|
||||||
|
glad_glVertexAttrib2fv = (PFNGLVERTEXATTRIB2FVPROC)load("glVertexAttrib2fv");
|
||||||
|
glad_glVertexAttrib2s = (PFNGLVERTEXATTRIB2SPROC)load("glVertexAttrib2s");
|
||||||
|
glad_glVertexAttrib2sv = (PFNGLVERTEXATTRIB2SVPROC)load("glVertexAttrib2sv");
|
||||||
|
glad_glVertexAttrib3d = (PFNGLVERTEXATTRIB3DPROC)load("glVertexAttrib3d");
|
||||||
|
glad_glVertexAttrib3dv = (PFNGLVERTEXATTRIB3DVPROC)load("glVertexAttrib3dv");
|
||||||
|
glad_glVertexAttrib3f = (PFNGLVERTEXATTRIB3FPROC)load("glVertexAttrib3f");
|
||||||
|
glad_glVertexAttrib3fv = (PFNGLVERTEXATTRIB3FVPROC)load("glVertexAttrib3fv");
|
||||||
|
glad_glVertexAttrib3s = (PFNGLVERTEXATTRIB3SPROC)load("glVertexAttrib3s");
|
||||||
|
glad_glVertexAttrib3sv = (PFNGLVERTEXATTRIB3SVPROC)load("glVertexAttrib3sv");
|
||||||
|
glad_glVertexAttrib4Nbv = (PFNGLVERTEXATTRIB4NBVPROC)load("glVertexAttrib4Nbv");
|
||||||
|
glad_glVertexAttrib4Niv = (PFNGLVERTEXATTRIB4NIVPROC)load("glVertexAttrib4Niv");
|
||||||
|
glad_glVertexAttrib4Nsv = (PFNGLVERTEXATTRIB4NSVPROC)load("glVertexAttrib4Nsv");
|
||||||
|
glad_glVertexAttrib4Nub = (PFNGLVERTEXATTRIB4NUBPROC)load("glVertexAttrib4Nub");
|
||||||
|
glad_glVertexAttrib4Nubv = (PFNGLVERTEXATTRIB4NUBVPROC)load("glVertexAttrib4Nubv");
|
||||||
|
glad_glVertexAttrib4Nuiv = (PFNGLVERTEXATTRIB4NUIVPROC)load("glVertexAttrib4Nuiv");
|
||||||
|
glad_glVertexAttrib4Nusv = (PFNGLVERTEXATTRIB4NUSVPROC)load("glVertexAttrib4Nusv");
|
||||||
|
glad_glVertexAttrib4bv = (PFNGLVERTEXATTRIB4BVPROC)load("glVertexAttrib4bv");
|
||||||
|
glad_glVertexAttrib4d = (PFNGLVERTEXATTRIB4DPROC)load("glVertexAttrib4d");
|
||||||
|
glad_glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC)load("glVertexAttrib4dv");
|
||||||
|
glad_glVertexAttrib4f = (PFNGLVERTEXATTRIB4FPROC)load("glVertexAttrib4f");
|
||||||
|
glad_glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC)load("glVertexAttrib4fv");
|
||||||
|
glad_glVertexAttrib4iv = (PFNGLVERTEXATTRIB4IVPROC)load("glVertexAttrib4iv");
|
||||||
|
glad_glVertexAttrib4s = (PFNGLVERTEXATTRIB4SPROC)load("glVertexAttrib4s");
|
||||||
|
glad_glVertexAttrib4sv = (PFNGLVERTEXATTRIB4SVPROC)load("glVertexAttrib4sv");
|
||||||
|
glad_glVertexAttrib4ubv = (PFNGLVERTEXATTRIB4UBVPROC)load("glVertexAttrib4ubv");
|
||||||
|
glad_glVertexAttrib4uiv = (PFNGLVERTEXATTRIB4UIVPROC)load("glVertexAttrib4uiv");
|
||||||
|
glad_glVertexAttrib4usv = (PFNGLVERTEXATTRIB4USVPROC)load("glVertexAttrib4usv");
|
||||||
|
glad_glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC)load("glVertexAttribPointer");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_2_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_2_1) return;
|
||||||
|
glad_glUniformMatrix2x3fv = (PFNGLUNIFORMMATRIX2X3FVPROC)load("glUniformMatrix2x3fv");
|
||||||
|
glad_glUniformMatrix3x2fv = (PFNGLUNIFORMMATRIX3X2FVPROC)load("glUniformMatrix3x2fv");
|
||||||
|
glad_glUniformMatrix2x4fv = (PFNGLUNIFORMMATRIX2X4FVPROC)load("glUniformMatrix2x4fv");
|
||||||
|
glad_glUniformMatrix4x2fv = (PFNGLUNIFORMMATRIX4X2FVPROC)load("glUniformMatrix4x2fv");
|
||||||
|
glad_glUniformMatrix3x4fv = (PFNGLUNIFORMMATRIX3X4FVPROC)load("glUniformMatrix3x4fv");
|
||||||
|
glad_glUniformMatrix4x3fv = (PFNGLUNIFORMMATRIX4X3FVPROC)load("glUniformMatrix4x3fv");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_0(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_0) return;
|
||||||
|
glad_glColorMaski = (PFNGLCOLORMASKIPROC)load("glColorMaski");
|
||||||
|
glad_glGetBooleani_v = (PFNGLGETBOOLEANI_VPROC)load("glGetBooleani_v");
|
||||||
|
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
|
||||||
|
glad_glEnablei = (PFNGLENABLEIPROC)load("glEnablei");
|
||||||
|
glad_glDisablei = (PFNGLDISABLEIPROC)load("glDisablei");
|
||||||
|
glad_glIsEnabledi = (PFNGLISENABLEDIPROC)load("glIsEnabledi");
|
||||||
|
glad_glBeginTransformFeedback = (PFNGLBEGINTRANSFORMFEEDBACKPROC)load("glBeginTransformFeedback");
|
||||||
|
glad_glEndTransformFeedback = (PFNGLENDTRANSFORMFEEDBACKPROC)load("glEndTransformFeedback");
|
||||||
|
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
|
||||||
|
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
|
||||||
|
glad_glTransformFeedbackVaryings = (PFNGLTRANSFORMFEEDBACKVARYINGSPROC)load("glTransformFeedbackVaryings");
|
||||||
|
glad_glGetTransformFeedbackVarying = (PFNGLGETTRANSFORMFEEDBACKVARYINGPROC)load("glGetTransformFeedbackVarying");
|
||||||
|
glad_glClampColor = (PFNGLCLAMPCOLORPROC)load("glClampColor");
|
||||||
|
glad_glBeginConditionalRender = (PFNGLBEGINCONDITIONALRENDERPROC)load("glBeginConditionalRender");
|
||||||
|
glad_glEndConditionalRender = (PFNGLENDCONDITIONALRENDERPROC)load("glEndConditionalRender");
|
||||||
|
glad_glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC)load("glVertexAttribIPointer");
|
||||||
|
glad_glGetVertexAttribIiv = (PFNGLGETVERTEXATTRIBIIVPROC)load("glGetVertexAttribIiv");
|
||||||
|
glad_glGetVertexAttribIuiv = (PFNGLGETVERTEXATTRIBIUIVPROC)load("glGetVertexAttribIuiv");
|
||||||
|
glad_glVertexAttribI1i = (PFNGLVERTEXATTRIBI1IPROC)load("glVertexAttribI1i");
|
||||||
|
glad_glVertexAttribI2i = (PFNGLVERTEXATTRIBI2IPROC)load("glVertexAttribI2i");
|
||||||
|
glad_glVertexAttribI3i = (PFNGLVERTEXATTRIBI3IPROC)load("glVertexAttribI3i");
|
||||||
|
glad_glVertexAttribI4i = (PFNGLVERTEXATTRIBI4IPROC)load("glVertexAttribI4i");
|
||||||
|
glad_glVertexAttribI1ui = (PFNGLVERTEXATTRIBI1UIPROC)load("glVertexAttribI1ui");
|
||||||
|
glad_glVertexAttribI2ui = (PFNGLVERTEXATTRIBI2UIPROC)load("glVertexAttribI2ui");
|
||||||
|
glad_glVertexAttribI3ui = (PFNGLVERTEXATTRIBI3UIPROC)load("glVertexAttribI3ui");
|
||||||
|
glad_glVertexAttribI4ui = (PFNGLVERTEXATTRIBI4UIPROC)load("glVertexAttribI4ui");
|
||||||
|
glad_glVertexAttribI1iv = (PFNGLVERTEXATTRIBI1IVPROC)load("glVertexAttribI1iv");
|
||||||
|
glad_glVertexAttribI2iv = (PFNGLVERTEXATTRIBI2IVPROC)load("glVertexAttribI2iv");
|
||||||
|
glad_glVertexAttribI3iv = (PFNGLVERTEXATTRIBI3IVPROC)load("glVertexAttribI3iv");
|
||||||
|
glad_glVertexAttribI4iv = (PFNGLVERTEXATTRIBI4IVPROC)load("glVertexAttribI4iv");
|
||||||
|
glad_glVertexAttribI1uiv = (PFNGLVERTEXATTRIBI1UIVPROC)load("glVertexAttribI1uiv");
|
||||||
|
glad_glVertexAttribI2uiv = (PFNGLVERTEXATTRIBI2UIVPROC)load("glVertexAttribI2uiv");
|
||||||
|
glad_glVertexAttribI3uiv = (PFNGLVERTEXATTRIBI3UIVPROC)load("glVertexAttribI3uiv");
|
||||||
|
glad_glVertexAttribI4uiv = (PFNGLVERTEXATTRIBI4UIVPROC)load("glVertexAttribI4uiv");
|
||||||
|
glad_glVertexAttribI4bv = (PFNGLVERTEXATTRIBI4BVPROC)load("glVertexAttribI4bv");
|
||||||
|
glad_glVertexAttribI4sv = (PFNGLVERTEXATTRIBI4SVPROC)load("glVertexAttribI4sv");
|
||||||
|
glad_glVertexAttribI4ubv = (PFNGLVERTEXATTRIBI4UBVPROC)load("glVertexAttribI4ubv");
|
||||||
|
glad_glVertexAttribI4usv = (PFNGLVERTEXATTRIBI4USVPROC)load("glVertexAttribI4usv");
|
||||||
|
glad_glGetUniformuiv = (PFNGLGETUNIFORMUIVPROC)load("glGetUniformuiv");
|
||||||
|
glad_glBindFragDataLocation = (PFNGLBINDFRAGDATALOCATIONPROC)load("glBindFragDataLocation");
|
||||||
|
glad_glGetFragDataLocation = (PFNGLGETFRAGDATALOCATIONPROC)load("glGetFragDataLocation");
|
||||||
|
glad_glUniform1ui = (PFNGLUNIFORM1UIPROC)load("glUniform1ui");
|
||||||
|
glad_glUniform2ui = (PFNGLUNIFORM2UIPROC)load("glUniform2ui");
|
||||||
|
glad_glUniform3ui = (PFNGLUNIFORM3UIPROC)load("glUniform3ui");
|
||||||
|
glad_glUniform4ui = (PFNGLUNIFORM4UIPROC)load("glUniform4ui");
|
||||||
|
glad_glUniform1uiv = (PFNGLUNIFORM1UIVPROC)load("glUniform1uiv");
|
||||||
|
glad_glUniform2uiv = (PFNGLUNIFORM2UIVPROC)load("glUniform2uiv");
|
||||||
|
glad_glUniform3uiv = (PFNGLUNIFORM3UIVPROC)load("glUniform3uiv");
|
||||||
|
glad_glUniform4uiv = (PFNGLUNIFORM4UIVPROC)load("glUniform4uiv");
|
||||||
|
glad_glTexParameterIiv = (PFNGLTEXPARAMETERIIVPROC)load("glTexParameterIiv");
|
||||||
|
glad_glTexParameterIuiv = (PFNGLTEXPARAMETERIUIVPROC)load("glTexParameterIuiv");
|
||||||
|
glad_glGetTexParameterIiv = (PFNGLGETTEXPARAMETERIIVPROC)load("glGetTexParameterIiv");
|
||||||
|
glad_glGetTexParameterIuiv = (PFNGLGETTEXPARAMETERIUIVPROC)load("glGetTexParameterIuiv");
|
||||||
|
glad_glClearBufferiv = (PFNGLCLEARBUFFERIVPROC)load("glClearBufferiv");
|
||||||
|
glad_glClearBufferuiv = (PFNGLCLEARBUFFERUIVPROC)load("glClearBufferuiv");
|
||||||
|
glad_glClearBufferfv = (PFNGLCLEARBUFFERFVPROC)load("glClearBufferfv");
|
||||||
|
glad_glClearBufferfi = (PFNGLCLEARBUFFERFIPROC)load("glClearBufferfi");
|
||||||
|
glad_glGetStringi = (PFNGLGETSTRINGIPROC)load("glGetStringi");
|
||||||
|
glad_glIsRenderbuffer = (PFNGLISRENDERBUFFERPROC)load("glIsRenderbuffer");
|
||||||
|
glad_glBindRenderbuffer = (PFNGLBINDRENDERBUFFERPROC)load("glBindRenderbuffer");
|
||||||
|
glad_glDeleteRenderbuffers = (PFNGLDELETERENDERBUFFERSPROC)load("glDeleteRenderbuffers");
|
||||||
|
glad_glGenRenderbuffers = (PFNGLGENRENDERBUFFERSPROC)load("glGenRenderbuffers");
|
||||||
|
glad_glRenderbufferStorage = (PFNGLRENDERBUFFERSTORAGEPROC)load("glRenderbufferStorage");
|
||||||
|
glad_glGetRenderbufferParameteriv = (PFNGLGETRENDERBUFFERPARAMETERIVPROC)load("glGetRenderbufferParameteriv");
|
||||||
|
glad_glIsFramebuffer = (PFNGLISFRAMEBUFFERPROC)load("glIsFramebuffer");
|
||||||
|
glad_glBindFramebuffer = (PFNGLBINDFRAMEBUFFERPROC)load("glBindFramebuffer");
|
||||||
|
glad_glDeleteFramebuffers = (PFNGLDELETEFRAMEBUFFERSPROC)load("glDeleteFramebuffers");
|
||||||
|
glad_glGenFramebuffers = (PFNGLGENFRAMEBUFFERSPROC)load("glGenFramebuffers");
|
||||||
|
glad_glCheckFramebufferStatus = (PFNGLCHECKFRAMEBUFFERSTATUSPROC)load("glCheckFramebufferStatus");
|
||||||
|
glad_glFramebufferTexture1D = (PFNGLFRAMEBUFFERTEXTURE1DPROC)load("glFramebufferTexture1D");
|
||||||
|
glad_glFramebufferTexture2D = (PFNGLFRAMEBUFFERTEXTURE2DPROC)load("glFramebufferTexture2D");
|
||||||
|
glad_glFramebufferTexture3D = (PFNGLFRAMEBUFFERTEXTURE3DPROC)load("glFramebufferTexture3D");
|
||||||
|
glad_glFramebufferRenderbuffer = (PFNGLFRAMEBUFFERRENDERBUFFERPROC)load("glFramebufferRenderbuffer");
|
||||||
|
glad_glGetFramebufferAttachmentParameteriv = (PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC)load("glGetFramebufferAttachmentParameteriv");
|
||||||
|
glad_glGenerateMipmap = (PFNGLGENERATEMIPMAPPROC)load("glGenerateMipmap");
|
||||||
|
glad_glBlitFramebuffer = (PFNGLBLITFRAMEBUFFERPROC)load("glBlitFramebuffer");
|
||||||
|
glad_glRenderbufferStorageMultisample = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC)load("glRenderbufferStorageMultisample");
|
||||||
|
glad_glFramebufferTextureLayer = (PFNGLFRAMEBUFFERTEXTURELAYERPROC)load("glFramebufferTextureLayer");
|
||||||
|
glad_glMapBufferRange = (PFNGLMAPBUFFERRANGEPROC)load("glMapBufferRange");
|
||||||
|
glad_glFlushMappedBufferRange = (PFNGLFLUSHMAPPEDBUFFERRANGEPROC)load("glFlushMappedBufferRange");
|
||||||
|
glad_glBindVertexArray = (PFNGLBINDVERTEXARRAYPROC)load("glBindVertexArray");
|
||||||
|
glad_glDeleteVertexArrays = (PFNGLDELETEVERTEXARRAYSPROC)load("glDeleteVertexArrays");
|
||||||
|
glad_glGenVertexArrays = (PFNGLGENVERTEXARRAYSPROC)load("glGenVertexArrays");
|
||||||
|
glad_glIsVertexArray = (PFNGLISVERTEXARRAYPROC)load("glIsVertexArray");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_1(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_1) return;
|
||||||
|
glad_glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC)load("glDrawArraysInstanced");
|
||||||
|
glad_glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC)load("glDrawElementsInstanced");
|
||||||
|
glad_glTexBuffer = (PFNGLTEXBUFFERPROC)load("glTexBuffer");
|
||||||
|
glad_glPrimitiveRestartIndex = (PFNGLPRIMITIVERESTARTINDEXPROC)load("glPrimitiveRestartIndex");
|
||||||
|
glad_glCopyBufferSubData = (PFNGLCOPYBUFFERSUBDATAPROC)load("glCopyBufferSubData");
|
||||||
|
glad_glGetUniformIndices = (PFNGLGETUNIFORMINDICESPROC)load("glGetUniformIndices");
|
||||||
|
glad_glGetActiveUniformsiv = (PFNGLGETACTIVEUNIFORMSIVPROC)load("glGetActiveUniformsiv");
|
||||||
|
glad_glGetActiveUniformName = (PFNGLGETACTIVEUNIFORMNAMEPROC)load("glGetActiveUniformName");
|
||||||
|
glad_glGetUniformBlockIndex = (PFNGLGETUNIFORMBLOCKINDEXPROC)load("glGetUniformBlockIndex");
|
||||||
|
glad_glGetActiveUniformBlockiv = (PFNGLGETACTIVEUNIFORMBLOCKIVPROC)load("glGetActiveUniformBlockiv");
|
||||||
|
glad_glGetActiveUniformBlockName = (PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC)load("glGetActiveUniformBlockName");
|
||||||
|
glad_glUniformBlockBinding = (PFNGLUNIFORMBLOCKBINDINGPROC)load("glUniformBlockBinding");
|
||||||
|
glad_glBindBufferRange = (PFNGLBINDBUFFERRANGEPROC)load("glBindBufferRange");
|
||||||
|
glad_glBindBufferBase = (PFNGLBINDBUFFERBASEPROC)load("glBindBufferBase");
|
||||||
|
glad_glGetIntegeri_v = (PFNGLGETINTEGERI_VPROC)load("glGetIntegeri_v");
|
||||||
|
}
|
||||||
|
static void load_GL_VERSION_3_2(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_VERSION_3_2) return;
|
||||||
|
glad_glDrawElementsBaseVertex = (PFNGLDRAWELEMENTSBASEVERTEXPROC)load("glDrawElementsBaseVertex");
|
||||||
|
glad_glDrawRangeElementsBaseVertex = (PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC)load("glDrawRangeElementsBaseVertex");
|
||||||
|
glad_glDrawElementsInstancedBaseVertex = (PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC)load("glDrawElementsInstancedBaseVertex");
|
||||||
|
glad_glMultiDrawElementsBaseVertex = (PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC)load("glMultiDrawElementsBaseVertex");
|
||||||
|
glad_glProvokingVertex = (PFNGLPROVOKINGVERTEXPROC)load("glProvokingVertex");
|
||||||
|
glad_glFenceSync = (PFNGLFENCESYNCPROC)load("glFenceSync");
|
||||||
|
glad_glIsSync = (PFNGLISSYNCPROC)load("glIsSync");
|
||||||
|
glad_glDeleteSync = (PFNGLDELETESYNCPROC)load("glDeleteSync");
|
||||||
|
glad_glClientWaitSync = (PFNGLCLIENTWAITSYNCPROC)load("glClientWaitSync");
|
||||||
|
glad_glWaitSync = (PFNGLWAITSYNCPROC)load("glWaitSync");
|
||||||
|
glad_glGetInteger64v = (PFNGLGETINTEGER64VPROC)load("glGetInteger64v");
|
||||||
|
glad_glGetSynciv = (PFNGLGETSYNCIVPROC)load("glGetSynciv");
|
||||||
|
glad_glGetInteger64i_v = (PFNGLGETINTEGER64I_VPROC)load("glGetInteger64i_v");
|
||||||
|
glad_glGetBufferParameteri64v = (PFNGLGETBUFFERPARAMETERI64VPROC)load("glGetBufferParameteri64v");
|
||||||
|
glad_glFramebufferTexture = (PFNGLFRAMEBUFFERTEXTUREPROC)load("glFramebufferTexture");
|
||||||
|
glad_glTexImage2DMultisample = (PFNGLTEXIMAGE2DMULTISAMPLEPROC)load("glTexImage2DMultisample");
|
||||||
|
glad_glTexImage3DMultisample = (PFNGLTEXIMAGE3DMULTISAMPLEPROC)load("glTexImage3DMultisample");
|
||||||
|
glad_glGetMultisamplefv = (PFNGLGETMULTISAMPLEFVPROC)load("glGetMultisamplefv");
|
||||||
|
glad_glSampleMaski = (PFNGLSAMPLEMASKIPROC)load("glSampleMaski");
|
||||||
|
}
|
||||||
|
static void load_GL_ARB_debug_output(GLADloadproc load) {
|
||||||
|
if(!GLAD_GL_ARB_debug_output) return;
|
||||||
|
glad_glDebugMessageControlARB = (PFNGLDEBUGMESSAGECONTROLARBPROC)load("glDebugMessageControlARB");
|
||||||
|
glad_glDebugMessageInsertARB = (PFNGLDEBUGMESSAGEINSERTARBPROC)load("glDebugMessageInsertARB");
|
||||||
|
glad_glDebugMessageCallbackARB = (PFNGLDEBUGMESSAGECALLBACKARBPROC)load("glDebugMessageCallbackARB");
|
||||||
|
glad_glGetDebugMessageLogARB = (PFNGLGETDEBUGMESSAGELOGARBPROC)load("glGetDebugMessageLogARB");
|
||||||
|
}
|
||||||
|
static int find_extensionsGL(void) {
|
||||||
|
if (!get_exts()) return 0;
|
||||||
|
GLAD_GL_ARB_debug_output = has_ext("GL_ARB_debug_output");
|
||||||
|
GLAD_GL_EXT_texture_filter_anisotropic = has_ext("GL_EXT_texture_filter_anisotropic");
|
||||||
|
free_exts();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void find_coreGL(void) {
|
||||||
|
|
||||||
|
/* Thank you @elmindreda
|
||||||
|
* https://github.com/elmindreda/greg/blob/master/templates/greg.c.in#L176
|
||||||
|
* https://github.com/glfw/glfw/blob/master/src/context.c#L36
|
||||||
|
*/
|
||||||
|
int i, major, minor;
|
||||||
|
|
||||||
|
const char* version;
|
||||||
|
const char* prefixes[] = {
|
||||||
|
"OpenGL ES-CM ",
|
||||||
|
"OpenGL ES-CL ",
|
||||||
|
"OpenGL ES ",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
version = (const char*) glGetString(GL_VERSION);
|
||||||
|
if (!version) return;
|
||||||
|
|
||||||
|
for (i = 0; prefixes[i]; i++) {
|
||||||
|
const size_t length = strlen(prefixes[i]);
|
||||||
|
if (strncmp(version, prefixes[i], length) == 0) {
|
||||||
|
version += length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* PR #18 */
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
sscanf_s(version, "%d.%d", &major, &minor);
|
||||||
|
#else
|
||||||
|
sscanf(version, "%d.%d", &major, &minor);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GLVersion.major = major; GLVersion.minor = minor;
|
||||||
|
max_loaded_major = major; max_loaded_minor = minor;
|
||||||
|
GLAD_GL_VERSION_1_0 = (major == 1 && minor >= 0) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_1 = (major == 1 && minor >= 1) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_2 = (major == 1 && minor >= 2) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_3 = (major == 1 && minor >= 3) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_4 = (major == 1 && minor >= 4) || major > 1;
|
||||||
|
GLAD_GL_VERSION_1_5 = (major == 1 && minor >= 5) || major > 1;
|
||||||
|
GLAD_GL_VERSION_2_0 = (major == 2 && minor >= 0) || major > 2;
|
||||||
|
GLAD_GL_VERSION_2_1 = (major == 2 && minor >= 1) || major > 2;
|
||||||
|
GLAD_GL_VERSION_3_0 = (major == 3 && minor >= 0) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_1 = (major == 3 && minor >= 1) || major > 3;
|
||||||
|
GLAD_GL_VERSION_3_2 = (major == 3 && minor >= 2) || major > 3;
|
||||||
|
if (GLVersion.major > 3 || (GLVersion.major >= 3 && GLVersion.minor >= 2)) {
|
||||||
|
max_loaded_major = 3;
|
||||||
|
max_loaded_minor = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int gladLoadGLLoader(GLADloadproc load) {
|
||||||
|
GLVersion.major = 0; GLVersion.minor = 0;
|
||||||
|
glGetString = (PFNGLGETSTRINGPROC)load("glGetString");
|
||||||
|
if(glGetString == NULL) return 0;
|
||||||
|
if(glGetString(GL_VERSION) == NULL) return 0;
|
||||||
|
find_coreGL();
|
||||||
|
load_GL_VERSION_1_0(load);
|
||||||
|
load_GL_VERSION_1_1(load);
|
||||||
|
load_GL_VERSION_1_2(load);
|
||||||
|
load_GL_VERSION_1_3(load);
|
||||||
|
load_GL_VERSION_1_4(load);
|
||||||
|
load_GL_VERSION_1_5(load);
|
||||||
|
load_GL_VERSION_2_0(load);
|
||||||
|
load_GL_VERSION_2_1(load);
|
||||||
|
load_GL_VERSION_3_0(load);
|
||||||
|
load_GL_VERSION_3_1(load);
|
||||||
|
load_GL_VERSION_3_2(load);
|
||||||
|
|
||||||
|
if (!find_extensionsGL()) return 0;
|
||||||
|
load_GL_ARB_debug_output(load);
|
||||||
|
return GLVersion.major != 0 || GLVersion.minor != 0;
|
||||||
|
}
|
||||||
|
|
101
src/client/refresh/gl3/header/local.h
Normal file
101
src/client/refresh/gl3/header/local.h
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1997-2001 Id Software, Inc.
|
||||||
|
* Copyright (C) 2016 Daniel Gibson
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
*
|
||||||
|
* See the GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
|
* 02111-1307, USA.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*
|
||||||
|
* Local header for the OpenGL3 refresher.
|
||||||
|
*
|
||||||
|
* =======================================================================
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef SRC_CLIENT_REFRESH_GL3_HEADER_LOCAL_H_
|
||||||
|
#define SRC_CLIENT_REFRESH_GL3_HEADER_LOCAL_H_
|
||||||
|
|
||||||
|
#include "../../../header/ref.h"
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
const char *renderer_string;
|
||||||
|
const char *vendor_string;
|
||||||
|
const char *version_string;
|
||||||
|
//const char *extensions_string; deprecated in GL3
|
||||||
|
|
||||||
|
int major_version;
|
||||||
|
int minor_version;
|
||||||
|
|
||||||
|
// ----
|
||||||
|
|
||||||
|
qboolean anisotropic; // is GL_EXT_texture_filter_anisotropic supported?
|
||||||
|
qboolean debug_output; // is GL_ARB_debug_output supported?
|
||||||
|
|
||||||
|
// ----
|
||||||
|
|
||||||
|
float max_anisotropy;
|
||||||
|
} gl3config_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
// TODO: what of this do we need?
|
||||||
|
float inverse_intensity;
|
||||||
|
qboolean fullscreen;
|
||||||
|
|
||||||
|
int prev_mode;
|
||||||
|
|
||||||
|
unsigned char *d_16to8table;
|
||||||
|
|
||||||
|
int lightmap_textures;
|
||||||
|
|
||||||
|
int currenttextures[2];
|
||||||
|
int currenttmu;
|
||||||
|
//GLenum currenttarget;
|
||||||
|
|
||||||
|
//float camera_separation;
|
||||||
|
//enum stereo_modes stereo_mode;
|
||||||
|
|
||||||
|
//qboolean hwgamma;
|
||||||
|
} gl3state_t;
|
||||||
|
|
||||||
|
extern gl3config_t gl3config;
|
||||||
|
extern gl3state_t gl3state;
|
||||||
|
|
||||||
|
extern int GL3_PrepareForWindow(void);
|
||||||
|
extern int GL3_InitContext(void* win);
|
||||||
|
extern void GL3_EndFrame(void);
|
||||||
|
extern void GL3_ShutdownWindow(qboolean contextOnly);
|
||||||
|
|
||||||
|
extern int GL3_Draw_GetPalette(void);
|
||||||
|
|
||||||
|
extern void R_Printf(int level, const char* msg, ...) __attribute__((format (printf, 2, 3)));
|
||||||
|
|
||||||
|
extern void LoadPCX(char *filename, byte **pic, byte **palette, int *width, int *height);
|
||||||
|
|
||||||
|
extern cvar_t *gl_msaa_samples;
|
||||||
|
extern cvar_t *gl_swapinterval;
|
||||||
|
extern cvar_t *gl_retexturing;
|
||||||
|
extern cvar_t *vid_fullscreen;
|
||||||
|
extern cvar_t *gl_mode;
|
||||||
|
extern cvar_t *gl_customwidth;
|
||||||
|
extern cvar_t *gl_customheight;
|
||||||
|
extern cvar_t *vid_gamma;
|
||||||
|
|
||||||
|
extern cvar_t *gl3_debugcontext;
|
||||||
|
|
||||||
|
#endif /* SRC_CLIENT_REFRESH_GL3_HEADER_LOCAL_H_ */
|
17
src/client/refresh/gl3/header/qgl.h
Normal file
17
src/client/refresh/gl3/header/qgl.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
|
||||||
|
#ifndef SRC_CLIENT_REFRESH_GL3_HEADER_QGL_H_
|
||||||
|
#define SRC_CLIENT_REFRESH_GL3_HEADER_QGL_H_
|
||||||
|
|
||||||
|
// this is just a hack to get proper auto-completion in IDEs:
|
||||||
|
// using system headers for their parsers/indexers but glad for real build
|
||||||
|
// (in glad glFoo is just a #define to glad_glFoo or sth, which screws up autocompletion)
|
||||||
|
// (you may have to configure your IDE to #define IN_IDE_PARSER, but not for building!)
|
||||||
|
#ifdef IN_IDE_PARSER
|
||||||
|
#define GL_GLEXT_PROTOTYPES 1
|
||||||
|
#include <GL/glext.h>
|
||||||
|
#include <GL/gl.h>
|
||||||
|
#else
|
||||||
|
#include <glad/glad.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* SRC_CLIENT_REFRESH_GL3_HEADER_QGL_H_ */
|
Loading…
Reference in a new issue