Updated OpenGL definitions in qgl.h

Using GL 1.4 declarations in code, although 'point parameters' will
use legacy extensions if they're the only ones found.
Moved stuff out of local.h; better to have definitions in one place.
Extracted from <glext.h>.
This commit is contained in:
Jaime Moreira 2024-04-23 12:23:00 -04:00
parent 3dde0d5859
commit 79bb13d3a7
7 changed files with 65 additions and 95 deletions

View file

@ -1468,17 +1468,29 @@ RI_Init(void)
/* Point parameters */
R_Printf(PRINT_ALL, " - Point parameters: ");
if (strstr(gl_config.extensions_string, "GL_ARB_point_parameters"))
if ( strstr(gl_config.extensions_string, "GL_ARB_point_parameters") ||
strstr(gl_config.extensions_string, "GL_EXT_point_parameters") ) // should exist for all OGL 1.4 hw...
{
qglPointParameterfARB = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterfARB" );
qglPointParameterfvARB = (void (APIENTRY *)(GLenum, const GLfloat *))RI_GetProcAddress ( "glPointParameterfvARB" );
qglPointParameterf = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterf" );
qglPointParameterfv = (void (APIENTRY *)(GLenum, const GLfloat *))RI_GetProcAddress ( "glPointParameterfv" );
if (!qglPointParameterf || !qglPointParameterfv)
{
qglPointParameterf = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterfARB" );
qglPointParameterfv = (void (APIENTRY *)(GLenum, const GLfloat *))RI_GetProcAddress ( "glPointParameterfvARB" );
}
if (!qglPointParameterf || !qglPointParameterfv)
{
qglPointParameterf = (void (APIENTRY *)(GLenum, GLfloat))RI_GetProcAddress ( "glPointParameterfEXT" );
qglPointParameterfv = (void (APIENTRY *)(GLenum, const GLfloat *))RI_GetProcAddress ( "glPointParameterfvEXT" );
}
}
gl_config.pointparameters = false;
if (gl1_pointparameters->value)
{
if (qglPointParameterfARB && qglPointParameterfvARB)
if (qglPointParameterf && qglPointParameterfv)
{
gl_config.pointparameters = true;
R_Printf(PRINT_ALL, "Okay\n");

View file

@ -208,9 +208,9 @@ R_SetDefaultState(void)
attenuations[1] = gl1_particle_att_b->value;
attenuations[2] = gl1_particle_att_c->value;
qglPointParameterfARB(GL_POINT_SIZE_MIN_EXT, gl1_particle_min_size->value);
qglPointParameterfARB(GL_POINT_SIZE_MAX_EXT, gl1_particle_max_size->value);
qglPointParameterfvARB(GL_DISTANCE_ATTENUATION_EXT, attenuations);
qglPointParameterf(GL_POINT_SIZE_MIN, gl1_particle_min_size->value);
qglPointParameterf(GL_POINT_SIZE_MAX, gl1_particle_max_size->value);
qglPointParameterfv(GL_POINT_DISTANCE_ATTENUATION, attenuations);
/* GL_POINT_SMOOTH is not implemented by some OpenGL
drivers, especially the crappy Mesa3D backends like

View file

@ -33,12 +33,6 @@
#include <SDL2/SDL.h>
#endif
#if defined(__APPLE__)
#include <OpenGL/gl.h>
#else
#include <GL/gl.h>
#endif
static SDL_Window* window = NULL;
static SDL_GLContext context = NULL;
qboolean IsHighDPIaware = false;

View file

@ -294,8 +294,8 @@ R_BlendLightmaps(const model_t *currentmodel)
// Apply overbright bits to the static lightmaps
if (gl1_overbrightbits->value)
{
R_TexEnv(GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value);
R_TexEnv(GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, gl1_overbrightbits->value);
}
R_DrawGLPolyChain(surf->polys, 0, 0);
@ -353,8 +353,8 @@ R_BlendLightmaps(const model_t *currentmodel)
// Apply overbright bits to the dynamic lightmaps
if (gl1_overbrightbits->value)
{
R_TexEnv(GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value);
R_TexEnv(GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, gl1_overbrightbits->value);
}
R_DrawGLPolyChain(drawsurf->polys,
@ -397,8 +397,8 @@ R_BlendLightmaps(const model_t *currentmodel)
// Apply overbright bits to the remainder lightmaps
if (gl1_overbrightbits->value)
{
R_TexEnv(GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, gl1_overbrightbits->value);
R_TexEnv(GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, gl1_overbrightbits->value);
}
R_DrawGLPolyChain(surf->polys,
@ -439,8 +439,8 @@ R_RenderBrushPoly(entity_t *currententity, msurface_t *fa)
They oversaturate otherwise. */
if (gl1_overbrightbits->value)
{
R_TexEnv(GL_COMBINE_EXT);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1);
R_TexEnv(GL_COMBINE);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE, 1);
}
else
{

View file

@ -39,24 +39,6 @@
#define GL_COLOR_INDEX8_EXT GL_COLOR_INDEX
#endif
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#endif
#ifndef GL_VERSION_1_3
#define GL_TEXTURE0 0x84C0
#define GL_TEXTURE1 0x84C1
#endif
#ifndef GL_MULTISAMPLE
#define GL_MULTISAMPLE 0x809D
#endif
#ifndef GL_MULTISAMPLE_FILTER_HINT_NV
#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
#endif
#define TEXNUM_LIGHTMAPS 1024
#define TEXNUM_SCRAPS 1152
#define TEXNUM_IMAGES 1153

View file

@ -44,54 +44,37 @@
#define APIENTRY
#endif
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
// Extracted from <glext.h>
#ifndef GL_VERSION_1_4
#define GL_POINT_SIZE_MIN 0x8126
#define GL_POINT_SIZE_MAX 0x8127
#define GL_POINT_DISTANCE_ATTENUATION 0x8129
#endif
#define GL_POINT_SIZE_MIN_EXT 0x8126
#define GL_POINT_SIZE_MAX_EXT 0x8127
#define GL_DISTANCE_ATTENUATION_EXT 0x8129
#ifndef GL_VERSION_1_3
#define GL_MULTISAMPLE 0x809D
#define GL_COMBINE 0x8570
#define GL_COMBINE_RGB 0x8571
#define GL_COMBINE_ALPHA 0x8572
#define GL_SOURCE0_RGB 0x8580
#define GL_SOURCE1_RGB 0x8581
#define GL_SOURCE0_ALPHA 0x8588
#define GL_SOURCE1_ALPHA 0x8589
#define GL_RGB_SCALE 0x8573
#define GL_PREVIOUS 0x8578
#endif
#ifndef GL_EXT_texture_env_combine
#define GL_COMBINE_EXT 0x8570
#define GL_COMBINE_RGB_EXT 0x8571
#define GL_COMBINE_ALPHA_EXT 0x8572
#define GL_RGB_SCALE_EXT 0x8573
#define GL_ADD_SIGNED_EXT 0x8574
#define GL_INTERPOLATE_EXT 0x8575
#define GL_CONSTANT_EXT 0x8576
#define GL_PRIMARY_COLOR_EXT 0x8577
#define GL_PREVIOUS_EXT 0x8578
#define GL_SOURCE0_RGB_EXT 0x8580
#define GL_SOURCE1_RGB_EXT 0x8581
#define GL_SOURCE2_RGB_EXT 0x8582
#define GL_SOURCE3_RGB_EXT 0x8583
#define GL_SOURCE4_RGB_EXT 0x8584
#define GL_SOURCE5_RGB_EXT 0x8585
#define GL_SOURCE6_RGB_EXT 0x8586
#define GL_SOURCE7_RGB_EXT 0x8587
#define GL_SOURCE0_ALPHA_EXT 0x8588
#define GL_SOURCE1_ALPHA_EXT 0x8589
#define GL_SOURCE2_ALPHA_EXT 0x858A
#define GL_SOURCE3_ALPHA_EXT 0x858B
#define GL_SOURCE4_ALPHA_EXT 0x858C
#define GL_SOURCE5_ALPHA_EXT 0x858D
#define GL_SOURCE6_ALPHA_EXT 0x858E
#define GL_SOURCE7_ALPHA_EXT 0x858F
#define GL_OPERAND0_RGB_EXT 0x8590
#define GL_OPERAND1_RGB_EXT 0x8591
#define GL_OPERAND2_RGB_EXT 0x8592
#define GL_OPERAND3_RGB_EXT 0x8593
#define GL_OPERAND4_RGB_EXT 0x8594
#define GL_OPERAND5_RGB_EXT 0x8595
#define GL_OPERAND6_RGB_EXT 0x8596
#define GL_OPERAND7_RGB_EXT 0x8597
#define GL_OPERAND0_ALPHA_EXT 0x8598
#define GL_OPERAND1_ALPHA_EXT 0x8599
#define GL_OPERAND2_ALPHA_EXT 0x859A
#define GL_OPERAND3_ALPHA_EXT 0x859B
#define GL_OPERAND4_ALPHA_EXT 0x859C
#define GL_OPERAND5_ALPHA_EXT 0x859D
#define GL_OPERAND6_ALPHA_EXT 0x859E
#define GL_OPERAND7_ALPHA_EXT 0x859F
#ifndef GL_EXT_shared_texture_palette
#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
#endif
#ifndef GL_EXT_texture_filter_anisotropic
#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
#endif
#ifndef GL_NV_multisample_filter_hint
#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
#endif
// =======================================================================
@ -99,7 +82,7 @@
/*
* This is responsible for setting up our QGL extension pointers
*/
qboolean QGL_Init ( void );
void QGL_Init ( void );
/*
* Unloads the specified DLL then nulls out all the proc pointers.
@ -107,8 +90,8 @@ qboolean QGL_Init ( void );
void QGL_Shutdown ( void );
/* GL extensions */
extern void ( APIENTRY *qglPointParameterfARB ) ( GLenum param, GLfloat value );
extern void ( APIENTRY *qglPointParameterfvARB ) ( GLenum param,
extern void ( APIENTRY *qglPointParameterf ) ( GLenum param, GLfloat value );
extern void ( APIENTRY *qglPointParameterfv ) ( GLenum param,
const GLfloat *value );
extern void ( APIENTRY *qglColorTableEXT ) ( GLenum, GLenum, GLsizei, GLenum,
GLenum, const GLvoid * );

View file

@ -38,8 +38,8 @@
/*
* GL extensions
*/
void (APIENTRY *qglPointParameterfARB)(GLenum param, GLfloat value);
void (APIENTRY *qglPointParameterfvARB)(GLenum param, const GLfloat *value);
void (APIENTRY *qglPointParameterf)(GLenum param, GLfloat value);
void (APIENTRY *qglPointParameterfv)(GLenum param, const GLfloat *value);
void (APIENTRY *qglColorTableEXT)(GLenum, GLenum, GLsizei, GLenum, GLenum,
const GLvoid *);
@ -47,9 +47,9 @@ void (APIENTRY *qglColorTableEXT)(GLenum, GLenum, GLsizei, GLenum, GLenum,
void QGL_EXT_Reset ( void )
{
qglPointParameterfARB = NULL;
qglPointParameterfvARB = NULL;
qglColorTableEXT = NULL;
qglPointParameterf = NULL;
qglPointParameterfv = NULL;
qglColorTableEXT = NULL;
}
/* ========================================================================= */
@ -63,11 +63,10 @@ QGL_Shutdown ( void )
/* ========================================================================= */
qboolean
void
QGL_Init (void)
{
// Reset GL extension pointers
QGL_EXT_Reset();
return true;
}