diff --git a/source/build/include/build.h b/source/build/include/build.h index 8d2a16ed8..3a60775c7 100644 --- a/source/build/include/build.h +++ b/source/build/include/build.h @@ -21,7 +21,6 @@ #include "collections.h" #include "compat.h" -#include "glad/glad.h" #include "glbuild.h" #include "palette.h" #include "pragmas.h" diff --git a/source/build/include/polymost.h b/source/build/include/polymost.h index a9ce4973e..cd20643f5 100644 --- a/source/build/include/polymost.h +++ b/source/build/include/polymost.h @@ -3,7 +3,6 @@ #include "baselayer.h" // glinfo -#include "glad/glad.h" #include "hightile.h" #include "mdsprite.h" @@ -25,7 +24,6 @@ extern float gvrcorrection; struct glfiltermodes { const char *name; - int32_t min,mag; }; #define NUMGLFILTERMODES 6 extern struct glfiltermodes glfiltermodes[NUMGLFILTERMODES]; diff --git a/source/build/src/animvpx.cpp b/source/build/src/animvpx.cpp index b924d6e74..7c72bb178 100644 --- a/source/build/src/animvpx.cpp +++ b/source/build/src/animvpx.cpp @@ -7,7 +7,6 @@ #include "compat.h" #include "baselayer.h" #include "build.h" -#include "glad/glad.h" #include "cache1d.h" #include "matrix.h" #include "../../glbackend/glbackend.h" diff --git a/source/build/src/engine.cpp b/source/build/src/engine.cpp index 8912da875..1fd020a37 100644 --- a/source/build/src/engine.cpp +++ b/source/build/src/engine.cpp @@ -25,7 +25,6 @@ #include "softsurface.h" #ifdef USE_OPENGL -# include "glad/glad.h" # include "glsurface.h" # include "hightile.h" # include "mdsprite.h" diff --git a/source/build/src/glsurface.cpp b/source/build/src/glsurface.cpp index a4249f390..d392eb8f2 100644 --- a/source/build/src/glsurface.cpp +++ b/source/build/src/glsurface.cpp @@ -6,7 +6,6 @@ */ #include "glsurface.h" -#include "glad/glad.h" #include "baselayer.h" #include "build.h" diff --git a/source/build/src/mdsprite.cpp b/source/build/src/mdsprite.cpp index 2759dcb08..1335cbae7 100644 --- a/source/build/src/mdsprite.cpp +++ b/source/build/src/mdsprite.cpp @@ -4,7 +4,6 @@ #include "compat.h" #include "build.h" -#include "glad/glad.h" #include "pragmas.h" #include "baselayer.h" #include "engine_priv.h" @@ -833,9 +832,7 @@ FHardwareTexture *mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t *texidx = GLInterface.NewTexture(); } - int32_t const texfmt = GL_BGRA; - - uploadtexture(*texidx, (doalloc&1), siz, texfmt, pic, tsiz, + uploadtexture(*texidx, (doalloc&1), siz, 1, pic, tsiz, DAMETH_HI | DAMETH_MASK | TO_DAMETH_NODOWNSIZE(sk->flags) | TO_DAMETH_NOTEXCOMPRESS(sk->flags) | @@ -1890,7 +1887,7 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) int32_t i, surfi; float f, g, k0, k1, k2=0, k3=0, mat[16]; // inits: compiler-happy GLfloat pc[4]; - int32_t texunits = GL_TEXTURE0; + // int32_t texunits = GL_TEXTURE0; const int32_t owner = tspr->owner; const spriteext_t *const sext = &spriteext[((unsigned)owner < MAXSPRITES+MAXUNIQHUDID) ? owner : MAXSPRITES+MAXUNIQHUDID-1]; @@ -2130,7 +2127,6 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) if (!(tspr->extra&TSPR_EXTRA_MDHACK)) { //POGOTODO: if we add support for palette indexing on model skins, the texture for the palswap could be setup here - texunits += 4; tex = r_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi) : nullptr; @@ -2205,13 +2201,13 @@ static int32_t polymost_md3draw(md3model_t *m, tspriteptr_t tspr) quicksort(m->indexes, m->maxdepths, 0, s->numtris - 1); } - md3draw_handle_triangles(s, indexhandle, texunits, m->usesalpha ? m : NULL); + md3draw_handle_triangles(s, indexhandle, 1, m->usesalpha ? m : NULL); } else { indexhandle = m->vindexes; - md3draw_handle_triangles(s, indexhandle, texunits, NULL); + md3draw_handle_triangles(s, indexhandle, 1, NULL); } GLInterface.UseDetailMapping(false); diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 10d907aa4..ee86e3451 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -78,12 +78,12 @@ static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0; struct glfiltermodes glfiltermodes[NUMGLFILTERMODES] = { - {"GL_NEAREST",GL_NEAREST,GL_NEAREST}, - {"GL_LINEAR",GL_LINEAR,GL_LINEAR}, - {"GL_NEAREST_MIPMAP_NEAREST",GL_NEAREST_MIPMAP_NEAREST,GL_NEAREST}, - {"GL_LINEAR_MIPMAP_NEAREST",GL_LINEAR_MIPMAP_NEAREST,GL_LINEAR}, - {"GL_NEAREST_MIPMAP_LINEAR",GL_NEAREST_MIPMAP_LINEAR,GL_NEAREST}, - {"GL_LINEAR_MIPMAP_LINEAR",GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR} + {"NEAREST"}, + {"LINEAR"}, + {"NEAREST_MIPMAP_NEAREST"}, + {"LINEAR_MIPMAP_NEAREST"}, + {"NEAREST_MIPMAP_LINEAR"}, + {"LINEAR_MIPMAP_LINEAR"} }; int32_t glanisotropy = 0; // 0 = maximum supported by card @@ -233,8 +233,6 @@ void gltexapplyprops(void) GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy); - - gltexfiltermode = clamp(gltexfiltermode, 0, NUMGLFILTERMODES-1); r_useindexedcolortextures = !gltexfiltermode; } @@ -751,17 +749,17 @@ void uploadpalswap(int32_t palookupnum) { G etTextureHandle(&palswapTextureID); } - g lBindTexture(GL_TEXTURE_2D, palswapTextureID); + g lBindTexture(GL _TEXTURE_2D, palswapTextureID); if (allocateTexture) { - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - g lTexImage2D(GL_TEXTURE_2D, 0, GL_RED, PALSWAP_TEXTURE_SIZE, PALSWAP_TEXTURE_SIZE, 0, GL_RED, GL_UNSIGNED_BYTE, NULL); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_BASE_LEVEL, 0); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_MAX_LEVEL, 0); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_MAG_FILTER, GL _NEAREST); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_MIN_FILTER, GL _NEAREST); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_MAX_ANISOTROPY_EXT, 1); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_WRAP_S, GL _CLAMP_TO_EDGE); + g lTexParameteri(GL _TEXTURE_2D, GL _TEXTURE_WRAP_T, GL _CLAMP_TO_EDGE); + g lTexImage2D(GL _TEXTURE_2D, 0, GL _RED, PALSWAP_TEXTURE_SIZE, PALSWAP_TEXTURE_SIZE, 0, GL _RED, GL _UNSIGNED_BYTE, NULL); } int32_t column = palookupnum%(PALSWAP_TEXTURE_SIZE/256); @@ -772,7 +770,7 @@ void uploadpalswap(int32_t palookupnum) OSD_Printf("Polymost: palswaps are too large for palswap tilesheet!\n"); return; } - g lTexSubImage2D(GL_TEXTURE_2D, 0, 256*column, rowOffset, 256, numshades+1, GL_RED, GL_UNSIGNED_BYTE, palookup[palookupnum]); + g lTexSubImage2D(GL _TEXTURE_2D, 0, 256*column, rowOffset, 256, numshades+1, GL _RED, GL _UNSIGNED_BYTE, palookup[palookupnum]); #endif } @@ -1003,7 +1001,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das doalloc = true; } } - uploadtexture(pth->glpic, doalloc, siz, GL_BGRA, pic, tsiz, + uploadtexture(pth->glpic, doalloc, siz, 1, pic, tsiz, dameth | DAMETH_ARTIMMUNITY | (dapic >= MAXUSERTILES ? (DAMETH_NOTEXCOMPRESS|DAMETH_NODOWNSIZE) : 0) | /* never process these short-lived tiles */ (hasfullbright ? DAMETH_HASFULLBRIGHT : 0) | @@ -1263,8 +1261,6 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp fixtransparency(pic,tsiz,siz,dameth); - int32_t const texfmt = GL_BGRA; - if (!doalloc) { vec2_t pthSiz2 = pth->siz; @@ -1276,7 +1272,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp doalloc = true; } } - uploadtexture(pth->glpic, doalloc,siz,texfmt,pic,tsiz, + uploadtexture(pth->glpic, doalloc,siz,0,pic,tsiz, dameth | DAMETH_HI | DAMETH_NOFIX | TO_DAMETH_NODOWNSIZE(hicr->flags) | TO_DAMETH_NOTEXCOMPRESS(hicr->flags) | @@ -1610,12 +1606,10 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 } #ifdef USE_GLEXT - int32_t texunits = GL_TEXTURE0; if (videoGetRenderMode() == REND_POLYMOST) { polymost_updatePalette(); - texunits += 4; } // detail texture diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp index ddef3f14b..dd5c9870d 100644 --- a/source/build/src/sdlayer.cpp +++ b/source/build/src/sdlayer.cpp @@ -5,6 +5,7 @@ #include #include #include +# include "glad/glad.h" #include "a.h" #include "build.h" @@ -24,7 +25,6 @@ #include "../../glbackend/glbackend.h" #ifdef USE_OPENGL -# include "glad/glad.h" # include "glbuild.h" # include "glsurface.h" #endif diff --git a/source/build/src/voxmodel.cpp b/source/build/src/voxmodel.cpp index 5463c266a..bc9fc4e8d 100644 --- a/source/build/src/voxmodel.cpp +++ b/source/build/src/voxmodel.cpp @@ -4,7 +4,6 @@ #include "compat.h" #include "build.h" -#include "glad/glad.h" #include "pragmas.h" #include "baselayer.h" #include "engine_priv.h"