- removed OpenGL headers from non-backend files.

This commit is contained in:
Christoph Oelckers 2019-10-05 13:57:26 +02:00
parent 3c193bb243
commit f99492d6d5
9 changed files with 23 additions and 40 deletions

View file

@ -21,7 +21,6 @@
#include "collections.h" #include "collections.h"
#include "compat.h" #include "compat.h"
#include "glad/glad.h"
#include "glbuild.h" #include "glbuild.h"
#include "palette.h" #include "palette.h"
#include "pragmas.h" #include "pragmas.h"

View file

@ -3,7 +3,6 @@
#include "baselayer.h" // glinfo #include "baselayer.h" // glinfo
#include "glad/glad.h"
#include "hightile.h" #include "hightile.h"
#include "mdsprite.h" #include "mdsprite.h"
@ -25,7 +24,6 @@ extern float gvrcorrection;
struct glfiltermodes { struct glfiltermodes {
const char *name; const char *name;
int32_t min,mag;
}; };
#define NUMGLFILTERMODES 6 #define NUMGLFILTERMODES 6
extern struct glfiltermodes glfiltermodes[NUMGLFILTERMODES]; extern struct glfiltermodes glfiltermodes[NUMGLFILTERMODES];

View file

@ -7,7 +7,6 @@
#include "compat.h" #include "compat.h"
#include "baselayer.h" #include "baselayer.h"
#include "build.h" #include "build.h"
#include "glad/glad.h"
#include "cache1d.h" #include "cache1d.h"
#include "matrix.h" #include "matrix.h"
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"

View file

@ -25,7 +25,6 @@
#include "softsurface.h" #include "softsurface.h"
#ifdef USE_OPENGL #ifdef USE_OPENGL
# include "glad/glad.h"
# include "glsurface.h" # include "glsurface.h"
# include "hightile.h" # include "hightile.h"
# include "mdsprite.h" # include "mdsprite.h"

View file

@ -6,7 +6,6 @@
*/ */
#include "glsurface.h" #include "glsurface.h"
#include "glad/glad.h"
#include "baselayer.h" #include "baselayer.h"
#include "build.h" #include "build.h"

View file

@ -4,7 +4,6 @@
#include "compat.h" #include "compat.h"
#include "build.h" #include "build.h"
#include "glad/glad.h"
#include "pragmas.h" #include "pragmas.h"
#include "baselayer.h" #include "baselayer.h"
#include "engine_priv.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(); *texidx = GLInterface.NewTexture();
} }
int32_t const texfmt = GL_BGRA; uploadtexture(*texidx, (doalloc&1), siz, 1, pic, tsiz,
uploadtexture(*texidx, (doalloc&1), siz, texfmt, pic, tsiz,
DAMETH_HI | DAMETH_MASK | DAMETH_HI | DAMETH_MASK |
TO_DAMETH_NODOWNSIZE(sk->flags) | TO_DAMETH_NODOWNSIZE(sk->flags) |
TO_DAMETH_NOTEXCOMPRESS(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; int32_t i, surfi;
float f, g, k0, k1, k2=0, k3=0, mat[16]; // inits: compiler-happy float f, g, k0, k1, k2=0, k3=0, mat[16]; // inits: compiler-happy
GLfloat pc[4]; GLfloat pc[4];
int32_t texunits = GL_TEXTURE0; // int32_t texunits = GL_TEXTURE0;
const int32_t owner = tspr->owner; const int32_t owner = tspr->owner;
const spriteext_t *const sext = &spriteext[((unsigned)owner < MAXSPRITES+MAXUNIQHUDID) ? owner : MAXSPRITES+MAXUNIQHUDID-1]; 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)) 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 //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; 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); 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 else
{ {
indexhandle = m->vindexes; indexhandle = m->vindexes;
md3draw_handle_triangles(s, indexhandle, texunits, NULL); md3draw_handle_triangles(s, indexhandle, 1, NULL);
} }
GLInterface.UseDetailMapping(false); GLInterface.UseDetailMapping(false);

View file

@ -78,12 +78,12 @@ static int32_t drawpoly_srepeat = 0, drawpoly_trepeat = 0;
struct glfiltermodes glfiltermodes[NUMGLFILTERMODES] = struct glfiltermodes glfiltermodes[NUMGLFILTERMODES] =
{ {
{"GL_NEAREST",GL_NEAREST,GL_NEAREST}, {"NEAREST"},
{"GL_LINEAR",GL_LINEAR,GL_LINEAR}, {"LINEAR"},
{"GL_NEAREST_MIPMAP_NEAREST",GL_NEAREST_MIPMAP_NEAREST,GL_NEAREST}, {"NEAREST_MIPMAP_NEAREST"},
{"GL_LINEAR_MIPMAP_NEAREST",GL_LINEAR_MIPMAP_NEAREST,GL_LINEAR}, {"LINEAR_MIPMAP_NEAREST"},
{"GL_NEAREST_MIPMAP_LINEAR",GL_NEAREST_MIPMAP_LINEAR,GL_NEAREST}, {"NEAREST_MIPMAP_LINEAR"},
{"GL_LINEAR_MIPMAP_LINEAR",GL_LINEAR_MIPMAP_LINEAR,GL_LINEAR} {"LINEAR_MIPMAP_LINEAR"}
}; };
int32_t glanisotropy = 0; // 0 = maximum supported by card int32_t glanisotropy = 0; // 0 = maximum supported by card
@ -233,8 +233,6 @@ void gltexapplyprops(void)
GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy); GLInterface.mSamplers->SetTextureFilterMode(gltexfiltermode, glanisotropy);
gltexfiltermode = clamp(gltexfiltermode, 0, NUMGLFILTERMODES-1);
r_useindexedcolortextures = !gltexfiltermode; r_useindexedcolortextures = !gltexfiltermode;
} }
@ -751,17 +749,17 @@ void uploadpalswap(int32_t palookupnum)
{ {
G etTextureHandle(&palswapTextureID); G etTextureHandle(&palswapTextureID);
} }
g lBindTexture(GL_TEXTURE_2D, palswapTextureID); g lBindTexture(GL _TEXTURE_2D, palswapTextureID);
if (allocateTexture) if (allocateTexture)
{ {
g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); 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_MAX_LEVEL, 0);
g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 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_MIN_FILTER, GL _NEAREST);
g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 1); 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_S, GL _CLAMP_TO_EDGE);
g lTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, 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 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); 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"); OSD_Printf("Polymost: palswaps are too large for palswap tilesheet!\n");
return; 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 #endif
} }
@ -1003,7 +1001,7 @@ void gloadtile_art(int32_t dapic, int32_t dapal, int32_t tintpalnum, int32_t das
doalloc = true; doalloc = true;
} }
} }
uploadtexture(pth->glpic, doalloc, siz, GL_BGRA, pic, tsiz, uploadtexture(pth->glpic, doalloc, siz, 1, pic, tsiz,
dameth | DAMETH_ARTIMMUNITY | dameth | DAMETH_ARTIMMUNITY |
(dapic >= MAXUSERTILES ? (DAMETH_NOTEXCOMPRESS|DAMETH_NODOWNSIZE) : 0) | /* never process these short-lived tiles */ (dapic >= MAXUSERTILES ? (DAMETH_NOTEXCOMPRESS|DAMETH_NODOWNSIZE) : 0) | /* never process these short-lived tiles */
(hasfullbright ? DAMETH_HASFULLBRIGHT : 0) | (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); fixtransparency(pic,tsiz,siz,dameth);
int32_t const texfmt = GL_BGRA;
if (!doalloc) if (!doalloc)
{ {
vec2_t pthSiz2 = pth->siz; 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; doalloc = true;
} }
} }
uploadtexture(pth->glpic, doalloc,siz,texfmt,pic,tsiz, uploadtexture(pth->glpic, doalloc,siz,0,pic,tsiz,
dameth | DAMETH_HI | DAMETH_NOFIX | dameth | DAMETH_HI | DAMETH_NOFIX |
TO_DAMETH_NODOWNSIZE(hicr->flags) | TO_DAMETH_NODOWNSIZE(hicr->flags) |
TO_DAMETH_NOTEXCOMPRESS(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 #ifdef USE_GLEXT
int32_t texunits = GL_TEXTURE0;
if (videoGetRenderMode() == REND_POLYMOST) if (videoGetRenderMode() == REND_POLYMOST)
{ {
polymost_updatePalette(); polymost_updatePalette();
texunits += 4;
} }
// detail texture // detail texture

View file

@ -5,6 +5,7 @@
#include <CommCtrl.h> #include <CommCtrl.h>
#include <signal.h> #include <signal.h>
#include <string> #include <string>
# include "glad/glad.h"
#include "a.h" #include "a.h"
#include "build.h" #include "build.h"
@ -24,7 +25,6 @@
#include "../../glbackend/glbackend.h" #include "../../glbackend/glbackend.h"
#ifdef USE_OPENGL #ifdef USE_OPENGL
# include "glad/glad.h"
# include "glbuild.h" # include "glbuild.h"
# include "glsurface.h" # include "glsurface.h"
#endif #endif

View file

@ -4,7 +4,6 @@
#include "compat.h" #include "compat.h"
#include "build.h" #include "build.h"
#include "glad/glad.h"
#include "pragmas.h" #include "pragmas.h"
#include "baselayer.h" #include "baselayer.h"
#include "engine_priv.h" #include "engine_priv.h"