mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +00:00
Introduce USE_GLEXT macro and use it to conditionally compile out all GL ARB function calls when compiling for GL ES platforms.
This replaces the previous hack where we kept the dynamic pointers null and simply never tried calling any of them by a conspiracy of default runtime settings and disabled menu options. Code affected: VBO support for models, VPX GLSL decoding, texture compression (texture cache), and multitexturing (glow/detail maps). This commit also replaces EDUKE32_GLES conditionals with USE_GLEXT where appropriate. I didn't touch polymer.c because it depends too heavily on extensions for conditionally compiling them to make sense. git-svn-id: https://svn.eduke32.com/eduke32@5526 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
ff80e020ad
commit
e00115c043
11 changed files with 128 additions and 39 deletions
|
@ -1313,14 +1313,16 @@ extern int32_t gltexmaxsize;
|
|||
void gltexapplyprops (void);
|
||||
void texcache_invalidate(void);
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
# ifdef USE_GLEXT
|
||||
extern int32_t r_detailmapping;
|
||||
extern int32_t r_glowmapping;
|
||||
#endif
|
||||
# endif
|
||||
|
||||
extern int32_t r_vertexarrays;
|
||||
# ifdef USE_GLEXT
|
||||
extern int32_t r_vbos;
|
||||
extern int32_t r_vbocount;
|
||||
# endif
|
||||
extern int32_t r_animsmoothing;
|
||||
extern int32_t r_parallaxskyclamping;
|
||||
extern int32_t r_parallaxskypanning;
|
||||
|
|
|
@ -7,10 +7,8 @@
|
|||
#if !defined GEKKO && !defined EDUKE32_GLES
|
||||
# define DYNAMIC_GL
|
||||
# define DYNAMIC_GLU
|
||||
#endif
|
||||
|
||||
#if !defined GEKKO
|
||||
# define DYNAMIC_GLEXT
|
||||
# define USE_GLEXT
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -701,15 +701,12 @@ int32_t loadglextensions(void)
|
|||
bwglCreateContextAttribsARB = (bwglCreateContextAttribsARBProcPtr) GETPROCEXTSOFT("wglCreateContextAttribsARB");
|
||||
#endif
|
||||
|
||||
#if defined EDUKE32_GLES
|
||||
// XXX: Replace with a proper GL ES solution,
|
||||
// along with the following "unkludgeable" functions that are used in POLYMER=0 builds:
|
||||
// the following ARB functions are used in POLYMER=0 builds:
|
||||
// glActiveTextureARB,
|
||||
// glDeleteBuffersARB, glGenBuffersARB, glBindBufferARB,
|
||||
// glMapBufferARB, glUnmapBufferARB, glBufferDataARB,
|
||||
// glClientActiveTextureARB,
|
||||
// glGetCompressedTexImageARB, glCompressedTexImage2DARB
|
||||
bglActiveTextureARB = (bglActiveTextureARBProcPtr) glActiveTexture;
|
||||
#endif
|
||||
|
||||
return err;
|
||||
#else
|
||||
|
|
|
@ -84,9 +84,11 @@ static int32_t maxmodelverts = 0, allocmodelverts = 0;
|
|||
static int32_t maxmodeltris = 0, allocmodeltris = 0;
|
||||
static vec3f_t *vertlist = NULL; //temp array to store interpolated vertices for drawing
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
static int32_t allocvbos = 0, curvbo = 0;
|
||||
static GLuint *vertvbos = NULL;
|
||||
static GLuint *indexvbos = NULL;
|
||||
#endif
|
||||
|
||||
#ifdef POLYMER
|
||||
static int32_t *tribuf = NULL;
|
||||
|
@ -99,6 +101,7 @@ int32_t globalnoeffect=0;
|
|||
|
||||
extern int32_t timerticspersec;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
void md_freevbos()
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -122,6 +125,7 @@ void md_freevbos()
|
|||
allocvbos = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void freeallmodels()
|
||||
{
|
||||
|
@ -148,7 +152,9 @@ void freeallmodels()
|
|||
allocmodeltris = maxmodeltris = 0;
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
md_freevbos();
|
||||
#endif
|
||||
#ifdef POLYMER
|
||||
DO_FREE_AND_NULL(tribuf);
|
||||
#endif
|
||||
|
@ -938,7 +944,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
|
|||
|
||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,glfiltermodes[filter].mag);
|
||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,glfiltermodes[filter].min);
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
if (glinfo.maxanisotropy > 1.0)
|
||||
bglTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAX_ANISOTROPY_EXT,glanisotropy);
|
||||
#endif
|
||||
|
@ -1153,6 +1159,7 @@ prep_return:
|
|||
m->nframe = 0;
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
// VBO generation and allocation
|
||||
static void mdloadvbos(md3model_t *m)
|
||||
{
|
||||
|
@ -1170,6 +1177,7 @@ static void mdloadvbos(md3model_t *m)
|
|||
}
|
||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
//--------------------------------------- MD2 LIBRARY BEGINS ---------------------------------------
|
||||
static md2model_t *md2load(int32_t fil, const char *filnam)
|
||||
|
@ -2016,6 +2024,7 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle,
|
|||
{
|
||||
int32_t k = s->tris[tri].i[j];
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (texunits > GL_TEXTURE0_ARB)
|
||||
{
|
||||
int32_t l = GL_TEXTURE0_ARB;
|
||||
|
@ -2023,12 +2032,17 @@ static void md3draw_handle_triangles(const md3surf_t *s, uint16_t *indexhandle,
|
|||
bglMultiTexCoord2fARB(l++, s->uv[k].u, s->uv[k].v);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
bglTexCoord2f(s->uv[k].u, s->uv[k].v);
|
||||
|
||||
bglVertex3fv((float *) &vertlist[k]);
|
||||
}
|
||||
}
|
||||
bglEnd();
|
||||
|
||||
#ifndef USE_GLEXT
|
||||
UNREFERENCED_PARAMETER(texunits);
|
||||
#endif
|
||||
}
|
||||
|
||||
static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
||||
|
@ -2047,8 +2061,10 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
const uint8_t lpal = ((unsigned)owner < MAXSPRITES) ? sprite[tspr->owner].pal : tspr->pal;
|
||||
const int32_t sizyrep = tilesiz[tspr->picnum].y*tspr->yrepeat;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vbos && (m->vbos == NULL))
|
||||
mdloadvbos(m);
|
||||
#endif
|
||||
|
||||
// if ((tspr->cstat&48) == 32) return 0;
|
||||
|
||||
|
@ -2223,8 +2239,10 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
for (surfi=0; surfi<m->head.numsurfs; surfi++)
|
||||
{
|
||||
//PLAG : sorting stuff
|
||||
#ifdef USE_GLEXT
|
||||
void *vbotemp;
|
||||
vec3f_t *vertexhandle = NULL;
|
||||
#endif
|
||||
uint16_t *indexhandle;
|
||||
vec3f_t fp;
|
||||
|
||||
|
@ -2233,6 +2251,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
v0 = &s->xyzn[m->cframe*s->numverts];
|
||||
v1 = &s->xyzn[m->nframe*s->numverts];
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vertexarrays && r_vbos)
|
||||
{
|
||||
if (++curvbo >= r_vbocount)
|
||||
|
@ -2242,6 +2261,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
vbotemp = bglMapBufferARB(GL_ARRAY_BUFFER_ARB, GL_WRITE_ONLY_ARB);
|
||||
vertexhandle = (vec3f_t *)vbotemp;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (sext->pitch || sext->roll)
|
||||
{
|
||||
|
@ -2268,8 +2288,10 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
fp.x = (fp1.x - a0.y)*m0.y + (fp2.x - a0.y)*m1.y;
|
||||
fp.y = (fp1.y - a0.z)*m0.z + (fp2.y - a0.z)*m1.z;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vertexarrays && r_vbos)
|
||||
vertexhandle[i] = fp;
|
||||
#endif
|
||||
|
||||
vertlist[i] = fp;
|
||||
}
|
||||
|
@ -2282,18 +2304,22 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
fp.y = v0[i].z*m0.z + v1[i].z*m1.z;
|
||||
fp.x = v0[i].y*m0.y + v1[i].y*m1.y;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vertexarrays && r_vbos)
|
||||
vertexhandle[i] = fp;
|
||||
#endif
|
||||
|
||||
vertlist[i] = fp;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vertexarrays && r_vbos)
|
||||
{
|
||||
bglUnmapBufferARB(GL_ARRAY_BUFFER_ARB);
|
||||
bglBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
bglMatrixMode(GL_MODELVIEW); //Let OpenGL (and perhaps hardware :) handle the matrix rotation
|
||||
mat[3] = mat[7] = mat[11] = 0.f; mat[15] = 1.f; bglLoadMatrixf(mat);
|
||||
|
@ -2312,7 +2338,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
|
||||
if (!(tspr->extra&TSPR_EXTRA_MDHACK))
|
||||
{
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
i = r_detailmapping ? mdloadskin((md2model_t *) m, tile2model[Ptile2tile(tspr->picnum, lpal)].skinnum, DETAILPAL, surfi) : 0;
|
||||
|
||||
if (i)
|
||||
|
@ -2343,7 +2369,6 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
bglTranslatef(xpanning, ypanning, 1.0f);
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (r_vertexarrays && r_vbos)
|
||||
{
|
||||
|
@ -2352,6 +2377,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
indexhandle = (uint16_t *) vbotemp;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
indexhandle = m->vindexes;
|
||||
|
||||
//PLAG: delayed polygon-level sorted rendering
|
||||
|
@ -2400,6 +2426,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
}
|
||||
else
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vertexarrays && r_vbos)
|
||||
{
|
||||
bglBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indexvbos[curvbo]);
|
||||
|
@ -2407,6 +2434,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
indexhandle = (uint16_t *) vbotemp;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
indexhandle = m->vindexes;
|
||||
|
||||
md3draw_handle_triangles(s, indexhandle, texunits, NULL);
|
||||
|
@ -2414,6 +2442,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
|
||||
if (r_vertexarrays)
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
int32_t l;
|
||||
|
||||
if (r_vbos)
|
||||
|
@ -2465,7 +2494,16 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
bglClientActiveTextureARB(texunits - 1);
|
||||
bglActiveTextureARB(--texunits);
|
||||
}
|
||||
#else
|
||||
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
bglTexCoordPointer(2, GL_FLOAT, 0, &(s->uv[0].u));
|
||||
|
||||
bglVertexPointer(3, GL_FLOAT, 0, &(vertlist[0].x));
|
||||
|
||||
bglDrawElements(GL_TRIANGLES, s->numtris * 3, GL_UNSIGNED_SHORT, m->vindexes);
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_GLEXT
|
||||
else // r_vertexarrays
|
||||
{
|
||||
while (texunits > GL_TEXTURE0_ARB)
|
||||
|
@ -2478,6 +2516,7 @@ static int32_t polymost_md3draw(md3model_t *m, const tspritetype *tspr)
|
|||
bglActiveTextureARB(--texunits);
|
||||
}
|
||||
} // r_vertexarrays
|
||||
#endif
|
||||
}
|
||||
//------------
|
||||
|
||||
|
@ -2535,11 +2574,13 @@ static void md3free(md3model_t *m)
|
|||
Bfree(m->vindexes);
|
||||
Bfree(m->maxdepths);
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (m->vbos)
|
||||
{
|
||||
bglDeleteBuffersARB(m->head.numsurfs, m->vbos);
|
||||
DO_FREE_AND_NULL(m->vbos);
|
||||
}
|
||||
#endif
|
||||
|
||||
Bfree(m);
|
||||
}
|
||||
|
@ -2603,6 +2644,7 @@ mdmodel_t *mdload(const char *filnam)
|
|||
return vm;
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
void md_allocvbos(void)
|
||||
{
|
||||
int32_t i;
|
||||
|
@ -2631,11 +2673,14 @@ void md_allocvbos(void)
|
|||
allocvbos = r_vbocount;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t polymost_mddraw(const tspritetype *tspr)
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
if (r_vbos && (r_vbocount > allocvbos))
|
||||
md_allocvbos();
|
||||
#endif
|
||||
|
||||
if (maxmodelverts > allocmodelverts)
|
||||
{
|
||||
|
|
|
@ -97,8 +97,10 @@ int32_t glusetexcache = 0, glusememcache = 0;
|
|||
int32_t glusetexcompr = 1;
|
||||
int32_t glusetexcache = 2, glusememcache = 1;
|
||||
int32_t r_polygonmode = 0; // 0:GL_FILL,1:GL_LINE,2:GL_POINT //FUK
|
||||
int32_t glmultisample = 0, glnvmultisamplehint = 0;
|
||||
static int32_t lastglpolygonmode = 0; //FUK
|
||||
#endif
|
||||
#ifdef USE_GLEXT
|
||||
int32_t glmultisample = 0, glnvmultisamplehint = 0;
|
||||
int32_t r_detailmapping = 1;
|
||||
int32_t r_glowmapping = 1;
|
||||
#endif
|
||||
|
@ -114,8 +116,10 @@ int32_t glrendmode = REND_POLYMOST;
|
|||
|
||||
int32_t r_fullbrights = 1;
|
||||
int32_t r_vertexarrays = 1;
|
||||
#ifdef USE_GLEXT
|
||||
int32_t r_vbos = 1;
|
||||
int32_t r_vbocount = 64;
|
||||
#endif
|
||||
int32_t r_animsmoothing = 1;
|
||||
int32_t r_downsize = 0;
|
||||
int32_t r_downsizevar = -1;
|
||||
|
@ -212,7 +216,7 @@ static void bind_2d_texture(GLuint texture, int filter)
|
|||
bglBindTexture(GL_TEXTURE_2D, texture);
|
||||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glfiltermodes[filter].mag);
|
||||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glfiltermodes[filter].min);
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
if (glinfo.maxanisotropy > 1.f)
|
||||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, glanisotropy);
|
||||
#endif
|
||||
|
@ -323,7 +327,9 @@ void polymost_glreset()
|
|||
bglDeleteTextures(1,&polymosttext);
|
||||
polymosttext=0;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
md_freevbos();
|
||||
#endif
|
||||
|
||||
Bmemset(texcache.list,0,sizeof(texcache.list));
|
||||
glox1 = -1;
|
||||
|
@ -350,7 +356,7 @@ void polymost_glinit()
|
|||
//bglHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
|
||||
//bglEnable(GL_LINE_SMOOTH);
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
if (glmultisample > 0 && glinfo.multisample)
|
||||
{
|
||||
if (glinfo.nvmultisamplehint)
|
||||
|
@ -372,13 +378,13 @@ void polymost_glinit()
|
|||
r_glowmapping = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (r_vbos && (!glinfo.vbos))
|
||||
{
|
||||
OSD_Printf("Your OpenGL implementation doesn't support Vertex Buffer Objects. Disabling...\n");
|
||||
r_vbos = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
bglEnableClientState(GL_VERTEX_ARRAY);
|
||||
bglEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
|
@ -763,7 +769,7 @@ static void polymost_setuptexture(const int32_t dameth, int filter)
|
|||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, glfiltermodes[filter].mag);
|
||||
bglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, glfiltermodes[filter].min);
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
if (glinfo.maxanisotropy > 1.f)
|
||||
{
|
||||
uint32_t i = (unsigned)Blrintf(glinfo.maxanisotropy);
|
||||
|
@ -1302,7 +1308,7 @@ int32_t gloadtile_hi(int32_t dapic,int32_t dapalnum, int32_t facen, hicreplctyp
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if !defined EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
void polymost_setupdetailtexture(const int32_t texunits, const int32_t tex)
|
||||
{
|
||||
bglActiveTextureARB(texunits);
|
||||
|
@ -1497,9 +1503,9 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32
|
|||
bglMatrixMode(GL_MODELVIEW);
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
int32_t texunits = GL_TEXTURE0_ARB;
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
// detail texture
|
||||
pthtyp *detailpth = NULL;
|
||||
|
||||
|
@ -1726,6 +1732,7 @@ do
|
|||
|
||||
float const r = 1.f/dp;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (texunits > GL_TEXTURE0_ARB)
|
||||
{
|
||||
j = GL_TEXTURE0_ARB;
|
||||
|
@ -1733,6 +1740,7 @@ do
|
|||
bglMultiTexCoord2fARB(j++, (up * r - du0 + uoffs) * invtsiz2.x, vp * r * invtsiz2.y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
bglTexCoord2f((up * r - du0 + uoffs) * invtsiz2.x, vp * r * invtsiz2.y);
|
||||
|
||||
bglVertex3f((o.x - ghalfx) * r * grhalfxdown10x,
|
||||
|
@ -1752,12 +1760,14 @@ do
|
|||
{
|
||||
float const r = 1.f / dd[i];
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
if (texunits > GL_TEXTURE0_ARB)
|
||||
{
|
||||
j = GL_TEXTURE0_ARB;
|
||||
while (j <= texunits) bglMultiTexCoord2fARB(j++, uu[i] * r * scale.x, vv[i] * r * scale.y);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
bglTexCoord2f(uu[i] * r * scale.x, vv[i] * r * scale.y);
|
||||
|
||||
bglVertex3f((px[i] - ghalfx) * r * grhalfxdown10x,
|
||||
|
@ -1767,20 +1777,25 @@ do
|
|||
bglEnd();
|
||||
}
|
||||
|
||||
do
|
||||
#ifdef USE_GLEXT
|
||||
while (texunits > GL_TEXTURE0_ARB)
|
||||
{
|
||||
bglActiveTextureARB(texunits);
|
||||
bglMatrixMode(GL_TEXTURE);
|
||||
bglLoadIdentity();
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
|
||||
if (texunits > GL_TEXTURE0_ARB)
|
||||
{
|
||||
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
|
||||
bglDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
bglTexEnvf(GL_TEXTURE_ENV, GL_RGB_SCALE_ARB, 1.0f);
|
||||
bglDisable(GL_TEXTURE_2D);
|
||||
|
||||
--texunits;
|
||||
}
|
||||
while (--texunits >= GL_TEXTURE0_ARB);
|
||||
|
||||
bglActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
#endif
|
||||
bglMatrixMode(GL_TEXTURE);
|
||||
bglLoadIdentity();
|
||||
bglMatrixMode(GL_MODELVIEW);
|
||||
|
||||
if (getrendermode() == REND_POLYMOST)
|
||||
{
|
||||
|
@ -4975,7 +4990,9 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
bglEnable(GL_TEXTURE_2D);
|
||||
|
||||
#if defined(POLYMER)
|
||||
# ifdef USE_GLEXT
|
||||
const int32_t olddetailmapping = r_detailmapping, oldglowmapping = r_glowmapping;
|
||||
# endif
|
||||
const int32_t oldnormalmapping = pr_normalmapping;
|
||||
#endif
|
||||
|
||||
|
@ -4994,8 +5011,10 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
{
|
||||
pr_normalmapping = 0;
|
||||
polymer_inb4rotatesprite(picnum, dapalnum, dashade, method);
|
||||
# ifdef USE_GLEXT
|
||||
r_detailmapping = 0;
|
||||
r_glowmapping = 0;
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -5118,8 +5137,10 @@ void polymost_dorotatesprite(int32_t sx, int32_t sy, int32_t z, int16_t a, int16
|
|||
#ifdef POLYMER
|
||||
if (getrendermode() == REND_POLYMER)
|
||||
{
|
||||
# ifdef USE_GLEXT
|
||||
r_detailmapping = olddetailmapping;
|
||||
r_glowmapping = oldglowmapping;
|
||||
# endif
|
||||
polymer_postrotatesprite();
|
||||
pr_normalmapping = oldnormalmapping;
|
||||
}
|
||||
|
@ -5707,9 +5728,11 @@ void polymost_initosdfuncs(void)
|
|||
{ "r_parallaxskyclamping","enable/disable parallaxed floor/ceiling sky texture clamping", (void *) &r_parallaxskyclamping, CVAR_BOOL, 0, 1 },
|
||||
{ "r_parallaxskypanning","enable/disable parallaxed floor/ceiling panning when drawing a parallaxing sky", (void *) &r_parallaxskypanning, CVAR_BOOL, 0, 1 },
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
{ "r_detailmapping","enable/disable detail mapping",(void *) &r_detailmapping, CVAR_BOOL, 0, 1 },
|
||||
{ "r_glowmapping","enable/disable glow mapping",(void *) &r_glowmapping, CVAR_BOOL, 0, 1 },
|
||||
#endif
|
||||
#ifndef EDUKE32_GLES
|
||||
{ "r_polygonmode","debugging feature",(void *) &r_polygonmode, CVAR_INT | CVAR_NOSAVE, 0, 3 },
|
||||
{ "r_texcache","enable/disable OpenGL compressed texture cache",(void *) &glusetexcache, CVAR_INT, 0, 2 },
|
||||
{ "r_memcache","enable/disable texture cache memory cache",(void *) &glusememcache, CVAR_BOOL, 0, 1 },
|
||||
|
@ -5737,8 +5760,10 @@ void polymost_initosdfuncs(void)
|
|||
},
|
||||
|
||||
{ "r_usetileshades", "enable/disable Polymost tile shade textures", (void *) &r_usetileshades, CVAR_INT | CVAR_INVALIDATEART, 0, 2 },
|
||||
#ifdef USE_GLEXT
|
||||
{ "r_vbocount","sets the number of Vertex Buffer Objects to use when drawing models",(void *) &r_vbocount, CVAR_INT, 1, 256 },
|
||||
{ "r_vbos"," enable/disable using Vertex Buffer Objects when drawing models",(void *) &r_vbos, CVAR_BOOL, 0, 1 },
|
||||
#endif
|
||||
{ "r_vertexarrays","enable/disable using vertex arrays when drawing models",(void *) &r_vertexarrays, CVAR_BOOL, 0, 1 },
|
||||
{ "r_projectionhack", "enable/disable projection hack", (void *) &glprojectionhacks, CVAR_INT, 0, 1 },
|
||||
|
||||
|
|
|
@ -1446,7 +1446,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
|||
if (c > 8)
|
||||
{
|
||||
int32_t i, j;
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
int32_t multisamplecheck = (glmultisample > 0);
|
||||
#else
|
||||
int32_t multisamplecheck = 0;
|
||||
|
@ -1468,7 +1468,7 @@ int32_t setvideomode(int32_t x, int32_t y, int32_t c, int32_t fs)
|
|||
{ SDL_GL_CONTEXT_MINOR_VERSION, 1 },
|
||||
#endif
|
||||
{ SDL_GL_DOUBLEBUFFER, 1 },
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
{ SDL_GL_MULTISAMPLEBUFFERS, glmultisample > 0 },
|
||||
{ SDL_GL_MULTISAMPLESAMPLES, glmultisample },
|
||||
#endif
|
||||
|
|
|
@ -620,7 +620,9 @@ void texcache_writetex(const char *fn, int32_t len, int32_t dameth, char effect,
|
|||
midbuf = (void *)Xrealloc(midbuf, miplen);
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
bglGetCompressedTexImageARB(GL_TEXTURE_2D, level, pic); WRITEX_FAIL_ON_ERROR();
|
||||
#endif
|
||||
|
||||
if (Bwrite(texcache.filehandle, &pict, sizeof(texcachepicture)) != sizeof(texcachepicture)) goto failure;
|
||||
if (dxtfilter(texcache.filehandle, &pict, pic, midbuf, packbuf, miplen)) goto failure;
|
||||
|
@ -736,12 +738,14 @@ static int32_t texcache_loadmips(const texcacheheader *head, GLenum *glerr, int3
|
|||
return TEXCACHERR_DEDXT;
|
||||
}
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
bglCompressedTexImage2DARB(GL_TEXTURE_2D,level,pict.format,pict.xdim,pict.ydim,pict.border,pict.size,pic);
|
||||
if ((*glerr=bglGetError()) != GL_NO_ERROR)
|
||||
{
|
||||
TEXCACHE_FREEBUFS();
|
||||
return TEXCACHERR_COMPTEX;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
bglGetTexLevelParameteriv(GL_TEXTURE_2D, level, GL_TEXTURE_INTERNAL_FORMAT, &format);
|
||||
|
|
|
@ -2822,7 +2822,9 @@ static int32_t SetupOpenGL(int32_t width, int32_t height, int32_t bitspp)
|
|||
#endif
|
||||
if (Bstrstr(glinfo.renderer,"Radeon X1"))
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
r_vbos = 0;
|
||||
#endif
|
||||
#ifdef POLYMER
|
||||
pr_ati_nodepthoffset = 1;
|
||||
initprintf("Enabling ATI R520 polygon offset workaround.\n");
|
||||
|
|
|
@ -380,6 +380,7 @@ read_ivf_frame:
|
|||
static GLuint texname = 0;
|
||||
static int32_t texuploaded;
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
// YUV->RGB conversion fragment shader adapted from
|
||||
// http://www.fourcc.org/fccyvrgb.php: "Want some sample code?"
|
||||
// direct link: http://www.fourcc.org/source/YUV420P-OpenGL-GLSLang.c
|
||||
|
@ -408,9 +409,11 @@ static char *fragprog_src =
|
|||
|
||||
" gl_FragColor = vec4(r,g,b,1.0);\n"
|
||||
"}\n";
|
||||
#endif
|
||||
|
||||
void animvpx_setup_glstate(void)
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
if (glinfo.glsl)
|
||||
{
|
||||
GLint gli;
|
||||
|
@ -444,6 +447,7 @@ void animvpx_setup_glstate(void)
|
|||
/* Finally, use the program. */
|
||||
bglUseProgramObjectARB(PHandle);
|
||||
}
|
||||
#endif
|
||||
|
||||
////////// GL STATE //////////
|
||||
|
||||
|
@ -466,7 +470,9 @@ void animvpx_setup_glstate(void)
|
|||
bglDisable(GL_CULL_FACE);
|
||||
bglEnable(GL_TEXTURE_2D);
|
||||
|
||||
#ifdef USE_GLEXT
|
||||
bglActiveTextureARB(GL_TEXTURE0_ARB);
|
||||
#endif
|
||||
bglGenTextures(1, &texname);
|
||||
bglBindTexture(GL_TEXTURE_2D, texname);
|
||||
|
||||
|
@ -484,8 +490,10 @@ void animvpx_setup_glstate(void)
|
|||
|
||||
void animvpx_restore_glstate(void)
|
||||
{
|
||||
#ifdef USE_GLEXT
|
||||
if (glinfo.glsl)
|
||||
bglUseProgramObjectARB(0);
|
||||
#endif
|
||||
|
||||
// bglPopAttrib();
|
||||
|
||||
|
|
|
@ -906,18 +906,18 @@ static MenuEntry_t ME_RENDERERSETUP_TEXQUALITY = MAKE_MENUENTRY("GL texture qual
|
|||
|
||||
static MenuOption_t MEO_RENDERERSETUP_PRECACHE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_OffOn, &ud.config.useprecache );
|
||||
static MenuEntry_t ME_RENDERERSETUP_PRECACHE = MAKE_MENUENTRY( "Pre-load map textures:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_PRECACHE, Option );
|
||||
# ifndef EDUKE32_GLES
|
||||
static char *MEOSN_RENDERERSETUP_TEXCACHE[] = { "Off", "On", "Compr.", };
|
||||
static MenuOptionSet_t MEOS_RENDERERSETUP_TEXCACHE = MAKE_MENUOPTIONSET( MEOSN_RENDERERSETUP_TEXCACHE, NULL, 0x2 );
|
||||
static MenuOption_t MEO_RENDERERSETUP_TEXCACHE = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_RENDERERSETUP_TEXCACHE, &glusetexcache );
|
||||
static MenuEntry_t ME_RENDERERSETUP_TEXCACHE = MAKE_MENUENTRY( "On-disk texture cache:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_TEXCACHE, Option );
|
||||
#ifndef EDUKE32_GLES
|
||||
# endif
|
||||
# ifdef USE_GLEXT
|
||||
static MenuOption_t MEO_RENDERERSETUP_DETAILTEX = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NoYes, &r_detailmapping );
|
||||
static MenuEntry_t ME_RENDERERSETUP_DETAILTEX = MAKE_MENUENTRY( "Detail textures:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_DETAILTEX, Option );
|
||||
|
||||
static MenuOption_t MEO_RENDERERSETUP_GLOWTEX = MAKE_MENUOPTION(&MF_Bluefont, &MEOS_NoYes, &r_glowmapping);
|
||||
static MenuEntry_t ME_RENDERERSETUP_GLOWTEX = MAKE_MENUENTRY("Glow textures:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_GLOWTEX, Option);
|
||||
|
||||
#endif
|
||||
# endif
|
||||
static MenuOption_t MEO_RENDERERSETUP_MODELS = MAKE_MENUOPTION( &MF_Bluefont, &MEOS_NoYes, &usemodels );
|
||||
static MenuEntry_t ME_RENDERERSETUP_MODELS = MAKE_MENUENTRY( "Use 3d models:", &MF_BluefontRed, &MEF_SmallOptions, &MEO_RENDERERSETUP_MODELS, Option );
|
||||
#endif
|
||||
|
@ -944,11 +944,13 @@ static MenuEntry_t *MEL_RENDERERSETUP_POLYMOST[] = {
|
|||
&ME_RENDERERSETUP_HIGHTILE,
|
||||
&ME_RENDERERSETUP_TEXQUALITY,
|
||||
&ME_RENDERERSETUP_PRECACHE,
|
||||
#ifndef EDUKE32_GLES
|
||||
# ifndef EDUKE32_GLES
|
||||
&ME_RENDERERSETUP_TEXCACHE,
|
||||
# endif
|
||||
# ifdef USE_GLEXT
|
||||
&ME_RENDERERSETUP_DETAILTEX,
|
||||
&ME_RENDERERSETUP_GLOWTEX,
|
||||
#endif
|
||||
# endif
|
||||
&ME_Space4,
|
||||
&ME_RENDERERSETUP_MODELS,
|
||||
};
|
||||
|
@ -958,9 +960,13 @@ static MenuEntry_t *MEL_RENDERERSETUP_POLYMER [] ={
|
|||
&ME_RENDERERSETUP_HIGHTILE,
|
||||
&ME_RENDERERSETUP_TEXQUALITY,
|
||||
&ME_RENDERERSETUP_PRECACHE,
|
||||
# ifndef EDUKE32_GLES
|
||||
&ME_RENDERERSETUP_TEXCACHE,
|
||||
# endif
|
||||
# ifdef USE_GLEXT
|
||||
&ME_RENDERERSETUP_DETAILTEX,
|
||||
&ME_RENDERERSETUP_GLOWTEX,
|
||||
# endif
|
||||
&ME_Space4,
|
||||
&ME_RENDERERSETUP_MODELS,
|
||||
&ME_Space4,
|
||||
|
@ -1694,11 +1700,13 @@ static void M_PreMenu(MenuID_t cm)
|
|||
case MENU_POLYMOST:
|
||||
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_TEXQUALITY, !usehightile);
|
||||
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_PRECACHE, !usehightile);
|
||||
#ifndef EDUKE32_GLES
|
||||
# ifndef EDUKE32_GLES
|
||||
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_TEXCACHE, !(glusetexcompr && usehightile));
|
||||
# endif
|
||||
# ifdef USE_GLEXT
|
||||
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_DETAILTEX, !usehightile);
|
||||
MenuEntry_DisableOnCondition(&ME_RENDERERSETUP_GLOWTEX, !usehightile);
|
||||
#endif
|
||||
# endif
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -512,7 +512,7 @@ void G_CacheMapData(void)
|
|||
polymost_precache(i,k,type);
|
||||
}
|
||||
|
||||
#ifndef EDUKE32_GLES
|
||||
#ifdef USE_GLEXT
|
||||
if (r_detailmapping && !KB_KeyPressed(sc_Space))
|
||||
polymost_precache(i,DETAILPAL,type);
|
||||
if (r_glowmapping && !KB_KeyPressed(sc_Space))
|
||||
|
|
Loading…
Reference in a new issue