Woohoo. The QFGL_* function prefixes are gone again from the tree. It

might even work under Windows now, but don't get your hopes too high. :)
This commit is contained in:
Jeff Teunissen 2001-06-25 06:17:07 +00:00
parent 3f495b20ee
commit 3fbfa27fcd
24 changed files with 600 additions and 789 deletions

View File

@ -26,13 +26,17 @@
$Id$
*/
#ifndef __QF_GL_funcs_h
#define __QF_GL_funcs_h
#ifndef __QF_GL_funcs_h_
#define __QF_GL_funcs_h_
#include "QF/GL/types.h"
#include "QF/qtypes.h"
#define QFGL_NEED(ret, name, args) extern ret (* QFGL_##name) args
#define QFGL_NEED(ret, name, args) extern ret (* name) args
#include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED
#endif // __QF_GL_funcs_h
qboolean GLF_Init (void);
void *QFGL_ProcAddress (void *, const char *);
#endif // __QF_GL_funcs_h_

View File

@ -1,253 +0,0 @@
/*
qfgl_ext.h
QuakeForge OpenGL extension interface definitions
Copyright (C) 2000 Jeff Teunissen <deek@dusknet.dhs.org>
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:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __qfgl_ext_h_
#define __qfgl_ext_h_
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_WINDOWS_H
# include <windows.h>
#endif
#include "QF/qtypes.h"
#include "QF/GL/defines.h"
#include "QF/GL/types.h"
// Define GLAPIENTRY to a useful value
#ifndef GLAPIENTRY
# ifdef APIENTRY
# define GLAPIENTRY APIENTRY
# else
# define GLAPIENTRY
# endif
#endif
// OpenGL numbers for extensions we use or want to use
#ifndef GL_EXT_bgra
# define GL_EXT_bgra
# define GL_BGR_EXT 0x80E0
# define GL_BGRA_EXT 0x80E1
#endif
#ifndef GL_EXT_paletted_texture
# define GL_EXT_paletted_texture
# define GL_COLOR_INDEX1_EXT 0x80E2
# define GL_COLOR_INDEX2_EXT 0x80E3
# define GL_COLOR_INDEX4_EXT 0x80E4
# define GL_COLOR_INDEX8_EXT 0x80E5
# define GL_COLOR_INDEX12_EXT 0x80E6
# define GL_COLOR_INDEX16_EXT 0x80E7
# define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
#endif
#ifndef GL_EXT_texture_object
# define GL_EXT_texture_object
# define GL_TEXTURE_PRIORITY_EXT 0x8066
# define GL_TEXTURE_RESIDENT_EXT 0x8067
# define GL_TEXTURE_1D_BINDING_EXT 0x8068
# define GL_TEXTURE_2D_BINDING_EXT 0x8069
# define GL_TEXTURE_3D_BINDING_EXT 0x806A
#endif
#ifndef GL_EXT_point_parameters
# define GL_EXT_point_parameters
# define GL_POINT_SIZE_MIN_EXT 0x8126
# define GL_POINT_SIZE_MAX_EXT 0x8127
# define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
# define GL_DISTANCE_ATTENUATION_EXT 0x8129
#endif
#ifndef GL_EXT_shared_texture_palette
# define GL_EXT_shared_texture_palette
# define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
#endif
#ifndef GL_ARB_multitexture
# define GL_ARB_multitexture
# define GL_TEXTURE0_ARB 0x84C0
# define GL_TEXTURE1_ARB 0x84C1
# define GL_TEXTURE2_ARB 0x84C2
# define GL_TEXTURE3_ARB 0x84C3
# define GL_TEXTURE4_ARB 0x84C4
# define GL_TEXTURE5_ARB 0x84C5
# define GL_TEXTURE6_ARB 0x84C6
# define GL_TEXTURE7_ARB 0x84C7
# define GL_TEXTURE8_ARB 0x84C8
# define GL_TEXTURE9_ARB 0x84C9
# define GL_TEXTURE10_ARB 0x84CA
# define GL_TEXTURE11_ARB 0x84CB
# define GL_TEXTURE12_ARB 0x84CC
# define GL_TEXTURE13_ARB 0x84CD
# define GL_TEXTURE14_ARB 0x84CE
# define GL_TEXTURE15_ARB 0x84CF
# define GL_TEXTURE16_ARB 0x84D0
# define GL_TEXTURE17_ARB 0x84D1
# define GL_TEXTURE18_ARB 0x84D2
# define GL_TEXTURE19_ARB 0x84D3
# define GL_TEXTURE20_ARB 0x84D4
# define GL_TEXTURE21_ARB 0x84D5
# define GL_TEXTURE22_ARB 0x84D6
# define GL_TEXTURE23_ARB 0x84D7
# define GL_TEXTURE24_ARB 0x84D8
# define GL_TEXTURE25_ARB 0x84D9
# define GL_TEXTURE26_ARB 0x84DA
# define GL_TEXTURE27_ARB 0x84DB
# define GL_TEXTURE28_ARB 0x84DC
# define GL_TEXTURE29_ARB 0x84DD
# define GL_TEXTURE30_ARB 0x84DE
# define GL_TEXTURE31_ARB 0x84DF
# define GL_ACTIVE_TEXTURE_ARB 0x84E0
# define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
# define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
#endif
/* Standard OpenGL external function defs */
typedef void (GLAPIENTRY *QF_glBlendColor) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
typedef void (GLAPIENTRY *QF_glBlendEquation) (GLenum mode);
typedef void (GLAPIENTRY *QF_glDrawRangeElements) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices);
typedef void (GLAPIENTRY *QF_glColorTable) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (GLAPIENTRY *QF_glColorTableParameterfv) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (GLAPIENTRY *QF_glColorTableParameteriv) (GLenum target, GLenum pname, const GLint *params);
typedef void (GLAPIENTRY *QF_glCopyColorTable) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
typedef void (GLAPIENTRY *QF_glGetColorTable) (GLenum target, GLenum format, GLenum type, GLvoid *table);
typedef void (GLAPIENTRY *QF_glGetColorTableParameterfv) (GLenum target, GLenum pname, GLfloat *params);
typedef void (GLAPIENTRY *QF_glGetColorTableParameteriv) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glColorSubTable) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data);
typedef void (GLAPIENTRY *QF_glCopyColorSubTable) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
typedef void (GLAPIENTRY *QF_glConvolutionFilter1D) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image);
typedef void (GLAPIENTRY *QF_glConvolutionFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image);
typedef void (GLAPIENTRY *QF_glConvolutionParameterf) (GLenum target, GLenum pname, GLfloat params);
typedef void (GLAPIENTRY *QF_glConvolutionParameterfv) (GLenum target, GLenum pname, const GLfloat *params);
typedef void (GLAPIENTRY *QF_glConvolutionParameteri) (GLenum target, GLenum pname, GLint params);
typedef void (GLAPIENTRY *QF_glConvolutionParameteriv) (GLenum target, GLenum pname, const GLint *params);
typedef void (GLAPIENTRY *QF_glCopyConvolutionFilter1D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
typedef void (GLAPIENTRY *QF_glCopyConvolutionFilter2D) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
typedef void (GLAPIENTRY *QF_glGetConvolutionFilter) (GLenum target, GLenum format, GLenum type, GLvoid *image);
typedef void (GLAPIENTRY *QF_glGetConvolutionParameterfv) (GLenum target, GLenum pname, GLfloat *params);
typedef void (GLAPIENTRY *QF_glGetConvolutionParameteriv) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glGetSeparableFilter) (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span);
typedef void (GLAPIENTRY *QF_glSeparableFilter2D) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column);
typedef void (GLAPIENTRY *QF_glGetHistogram) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
typedef void (GLAPIENTRY *QF_glGetHistogramParameterfv) (GLenum target, GLenum pname, GLfloat *params);
typedef void (GLAPIENTRY *QF_glGetHistogramParameteriv) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glGetMinmax) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values);
typedef void (GLAPIENTRY *QF_glGetMinmaxParameterfv) (GLenum target, GLenum pname, GLfloat *params);
typedef void (GLAPIENTRY *QF_glGetMinmaxParameteriv) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glHistogram) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
typedef void (GLAPIENTRY *QF_glMinmax) (GLenum target, GLenum internalformat, GLboolean sink);
typedef void (GLAPIENTRY *QF_glResetHistogram) (GLenum target);
typedef void (GLAPIENTRY *QF_glResetMinmax) (GLenum target);
typedef void (GLAPIENTRY *QF_glTexImage3D) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (GLAPIENTRY *QF_glTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (GLAPIENTRY *QF_glCopyTexSubImage3D) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
// GL_ARB_multitexture
typedef void (GLAPIENTRY *QF_glActiveTextureARB) (GLenum texture);
typedef void (GLAPIENTRY *QF_glClientActiveTextureARB) (GLenum texture);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1dARB) (GLenum target, GLdouble s);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2dARB) (GLenum target, GLdouble s, GLdouble t);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4dARB) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1dvARB) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2dvARB) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3dvARB) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4dvARB) (GLenum target, const GLdouble *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1fARB) (GLenum target, GLfloat s);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2fARB) (GLenum target, GLfloat s, GLfloat t);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4fARB) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1fvARB) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2fvARB) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3fvARB) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4fvARB) (GLenum target, const GLfloat *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1iARB) (GLenum target, GLint s);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2iARB) (GLenum target, GLint s, GLint t);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3iARB) (GLenum target, GLint s, GLint t, GLint r);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4iARB) (GLenum target, GLint s, GLint t, GLint r, GLint q);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1ivARB) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2ivARB) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3ivARB) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4ivARB) (GLenum target, const GLint *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1sARB) (GLenum target, GLshort s);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2sARB) (GLenum target, GLshort s, GLshort t);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3sARB) (GLenum target, GLshort s, GLshort t, GLshort r);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4sARB) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
typedef void (GLAPIENTRY *QF_glMultiTexCoord1svARB) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord2svARB) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord3svARB) (GLenum target, const GLshort *v);
typedef void (GLAPIENTRY *QF_glMultiTexCoord4svARB) (GLenum target, const GLshort *v);
// GL_EXT_paletted_texture
typedef void (GLAPIENTRY *QF_glColorTableEXT) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const GLvoid *table);
typedef void (GLAPIENTRY *QF_glGetColorTableEXT) (GLenum target, GLenum format, GLenum type, GLvoid *data);
typedef void (GLAPIENTRY *QF_glGetColorTableParameterivEXT) (GLenum target, GLenum pname, GLint *params);
typedef void (GLAPIENTRY *QF_glGetColorTableParameterfvEXT) (GLenum target, GLenum pname, GLfloat *params);
// GL_EXT_point_parameters
typedef void (GLAPIENTRY *QF_glPointParameterfEXT) (GLenum pname, GLfloat param);
typedef void (GLAPIENTRY *QF_glPointParameterfvEXT) (GLenum pname, const GLfloat *params);
// GL_EXT_subtexture
typedef void (GLAPIENTRY *QF_glTexSubImage1DEXT) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels);
typedef void (GLAPIENTRY *QF_glTexSubImage2DEXT) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels);
// GL_EXT_texture_object
typedef GLboolean (GLAPIENTRY *QF_glAreTexturesResidentEXT) (GLsizei n, const GLuint *textures, GLboolean *residences);
typedef void (GLAPIENTRY *QF_glBindTextureEXT) (GLenum target, GLuint texture);
typedef void (GLAPIENTRY *QF_glDeleteTexturesEXT) (GLsizei n, const GLuint *textures);
typedef void (GLAPIENTRY *QF_glGenTexturesEXT) (GLsizei n, GLuint *textures);
typedef GLboolean (GLAPIENTRY *QF_glIsTextureEXT) (GLuint texture);
typedef void (GLAPIENTRY *QF_glPrioritizeTexturesEXT) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
// GL_EXT_vertex_array
typedef void (GLAPIENTRY *QF_glArrayElementEXT) (GLint i);
typedef void (GLAPIENTRY *QF_glColorPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
typedef void (GLAPIENTRY *QF_glDrawArraysEXT) (GLenum mode, GLint first, GLsizei count);
typedef void (GLAPIENTRY *QF_glEdgeFlagPointerEXT) (GLsizei stride, GLsizei count, const GLboolean *pointer);
typedef void (GLAPIENTRY *QF_glGetPointervEXT) (GLenum pname, GLvoid* *params);
typedef void (GLAPIENTRY *QF_glIndexPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
typedef void (GLAPIENTRY *QF_glNormalPointerEXT) (GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
typedef void (GLAPIENTRY *QF_glTexCoordPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
typedef void (GLAPIENTRY *QF_glVertexPointerEXT) (GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid *pointer);
// 3Dfx
typedef void (GLAPIENTRY *QF_gl3DfxSetPaletteEXT) (GLuint *pal);
// GLX 1.3
typedef void *(GLAPIENTRY *QF_glXGetProcAddressARB) (const GLubyte *procName);
// WGL (Windows GL)
typedef const GLubyte *(GLAPIENTRY *QF_wglGetExtensionsStringEXT) (void);
/* QuakeForge extension functions */
qboolean QFGL_ExtensionPresent (const char *);
void *QFGL_ExtensionAddress (const char *);
#endif // __qfgl_ext_h_

View File

@ -39,7 +39,7 @@
#include "QF/qtypes.h"
#include "QF/GL/types.h"
#include "QF/GL/qf_ext.h"
#include "QF/GL/extensions.h"
// Multitexturing
extern QF_glActiveTextureARB qglActiveTexture;

View File

@ -246,7 +246,7 @@ Draw_Init (void)
GLint texSize;
// Some cards have a texture size limit.
QFGL_glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &texSize);
Cvar_Set (gl_max_size, va("%d", texSize));
Cmd_AddCommand ("gl_texturemode", &GL_TextureMode_f, "Texture mipmap quality.");
@ -264,8 +264,8 @@ Draw_Init (void)
char_texture = GL_LoadTexture ("charset", 128, 128, draw_chars, false, true, 1); // 1999-12-27 Conwidth/height charset fix by TcT
cs_texture = GL_LoadTexture ("crosshair", 8, 8, cs_data, false, true, 1);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
// save a texture slot for translated picture
translate_texture = texture_extension_number++;
@ -307,18 +307,18 @@ Draw_Character8 (int x, int y, int num)
fcol = col * 0.0625;
size = 0.0625;
QFGL_glBindTexture (GL_TEXTURE_2D, char_texture);
glBindTexture (GL_TEXTURE_2D, char_texture);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (fcol, frow);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f (fcol + size, frow);
QFGL_glVertex2f (x + 8, y);
QFGL_glTexCoord2f (fcol + size, frow + size);
QFGL_glVertex2f (x + 8, y + 8);
QFGL_glTexCoord2f (fcol, frow + size);
QFGL_glVertex2f (x, y + 8);
QFGL_glEnd ();
glBegin (GL_QUADS);
glTexCoord2f (fcol, frow);
glVertex2f (x, y);
glTexCoord2f (fcol + size, frow);
glVertex2f (x + 8, y);
glTexCoord2f (fcol + size, frow + size);
glVertex2f (x + 8, y + 8);
glTexCoord2f (fcol, frow + size);
glVertex2f (x, y + 8);
glEnd ();
}
@ -366,20 +366,20 @@ Draw_Crosshair (int swap)
y = scr_vrect.y + scr_vrect.height / 2 - 3 + cl_crossy->int_val;
pColor = (unsigned char *) &d_8to24table[crosshaircolor->int_val];
QFGL_glColor4ubv (pColor);
QFGL_glBindTexture (GL_TEXTURE_2D, cs_texture);
glColor4ubv (pColor);
glBindTexture (GL_TEXTURE_2D, cs_texture);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 0);
QFGL_glVertex2f (x - 4, y - 4);
QFGL_glTexCoord2f (1, 0);
QFGL_glVertex2f (x + 12, y - 4);
QFGL_glTexCoord2f (1, 1);
QFGL_glVertex2f (x + 12, y + 12);
QFGL_glTexCoord2f (0, 1);
QFGL_glVertex2f (x - 4, y + 12);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x - 4, y - 4);
glTexCoord2f (1, 0);
glVertex2f (x + 12, y - 4);
glTexCoord2f (1, 1);
glVertex2f (x + 12, y + 12);
glTexCoord2f (0, 1);
glVertex2f (x - 4, y + 12);
glEnd ();
glColor3ubv (lighthalf_v);
break;
}
}
@ -392,17 +392,17 @@ Draw_Pic (int x, int y, qpic_t *pic)
gl = (glpic_t *) pic->data;
QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 0);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f (1, 0);
QFGL_glVertex2f (x + pic->width, y);
QFGL_glTexCoord2f (1, 1);
QFGL_glVertex2f (x + pic->width, y + pic->height);
QFGL_glTexCoord2f (0, 1);
QFGL_glVertex2f (x, y + pic->height);
QFGL_glEnd ();
glBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x + pic->width, y);
glTexCoord2f (1, 1);
glVertex2f (x + pic->width, y + pic->height);
glTexCoord2f (0, 1);
glVertex2f (x, y + pic->height);
glEnd ();
}
@ -421,19 +421,19 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
newtl = (float) srcy / (float) pic->height;
newth = newtl + (float) height / (float) pic->height;
QFGL_glColor3f (0.8, 0.8, 0.8);
QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (newsl, newtl);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f (newsh, newtl);
QFGL_glVertex2f (x + width, y);
QFGL_glTexCoord2f (newsh, newth);
QFGL_glVertex2f (x + width, y + height);
QFGL_glTexCoord2f (newsl, newth);
QFGL_glVertex2f (x, y + height);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glColor3f (0.8, 0.8, 0.8);
glBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS);
glTexCoord2f (newsl, newtl);
glVertex2f (x, y);
glTexCoord2f (newsh, newtl);
glVertex2f (x + width, y);
glTexCoord2f (newsh, newth);
glVertex2f (x + width, y + height);
glTexCoord2f (newsl, newth);
glVertex2f (x, y + height);
glEnd ();
glColor3ubv (lighthalf_v);
}
@ -450,7 +450,7 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
byte *src;
int p;
QFGL_glBindTexture (GL_TEXTURE_2D, translate_texture);
glBindTexture (GL_TEXTURE_2D, translate_texture);
c = pic->width * pic->height;
@ -466,24 +466,24 @@ Draw_TransPicTranslate (int x, int y, qpic_t *pic, byte * translation)
}
}
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA,
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 64, 64, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
QFGL_glColor3f (0.8, 0.8, 0.8);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 0);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f (1, 0);
QFGL_glVertex2f (x + pic->width, y);
QFGL_glTexCoord2f (1, 1);
QFGL_glVertex2f (x + pic->width, y + pic->height);
QFGL_glTexCoord2f (0, 1);
QFGL_glVertex2f (x, y + pic->height);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glColor3f (0.8, 0.8, 0.8);
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x + pic->width, y);
glTexCoord2f (1, 1);
glVertex2f (x + pic->width, y + pic->height);
glTexCoord2f (0, 1);
glVertex2f (x, y + pic->height);
glEnd ();
glColor3ubv (lighthalf_v);
}
@ -512,16 +512,16 @@ Draw_ConsoleBackground (int lines)
static float xfactor = .3f;
static float xstep = .005f;
QFGL_glPushMatrix ();
QFGL_glMatrixMode (GL_TEXTURE);
QFGL_glPushMatrix ();
QFGL_glLoadIdentity ();
glPushMatrix ();
glMatrixMode (GL_TEXTURE);
glPushMatrix ();
glLoadIdentity ();
xangle += gl_conspin->value;
xfactor += xstep;
if (xfactor > 8 || xfactor < .3f)
xstep = -xstep;
QFGL_glRotatef (xangle, 0, 0, 1);
QFGL_glScalef (xfactor, xfactor, xfactor);
glRotatef (xangle, 0, 0, 1);
glScalef (xfactor, xfactor, xfactor);
}
// slide console up/down or stretch it?
if (gl_constretch->int_val)
@ -537,35 +537,35 @@ Draw_ConsoleBackground (int lines)
alpha = (float) (gl_conalpha->value * lines) / y;
}
QFGL_glColor4f (0.8, 0.8, 0.8, alpha);
glColor4f (0.8, 0.8, 0.8, alpha);
// draw the console texture
QFGL_glBindTexture (GL_TEXTURE_2D, gl->texnum);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 0 + ofs);
QFGL_glVertex2f (0, 0);
QFGL_glTexCoord2f (1, 0 + ofs);
QFGL_glVertex2f (vid.conwidth, 0);
QFGL_glTexCoord2f (1, 1);
QFGL_glVertex2f (vid.conwidth, lines);
QFGL_glTexCoord2f (0, 1);
QFGL_glVertex2f (0, lines);
QFGL_glEnd ();
glBindTexture (GL_TEXTURE_2D, gl->texnum);
glBegin (GL_QUADS);
glTexCoord2f (0, 0 + ofs);
glVertex2f (0, 0);
glTexCoord2f (1, 0 + ofs);
glVertex2f (vid.conwidth, 0);
glTexCoord2f (1, 1);
glVertex2f (vid.conwidth, lines);
glTexCoord2f (0, 1);
glVertex2f (0, lines);
glEnd ();
// turn off alpha blending
if (alpha < 1.0) {
QFGL_glColor3f (0.8, 0.8, 0.8);
glColor3f (0.8, 0.8, 0.8);
}
if (gl_conspin->value) {
QFGL_glPopMatrix ();
QFGL_glMatrixMode (GL_MODELVIEW);
QFGL_glPopMatrix ();
glPopMatrix ();
glMatrixMode (GL_MODELVIEW);
glPopMatrix ();
}
Draw_AltString8 (vid.conwidth - strlen (cl_verstring->string) * 8 - 11,
lines - 14, cl_verstring->string);
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
}
@ -578,19 +578,19 @@ Draw_ConsoleBackground (int lines)
void
Draw_TileClear (int x, int y, int w, int h)
{
QFGL_glColor3f (0.8, 0.8, 0.8);
QFGL_glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (x / 64.0, y / 64.0);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f ((x + w) / 64.0, y / 64.0);
QFGL_glVertex2f (x + w, y);
QFGL_glTexCoord2f ((x + w) / 64.0, (y + h) / 64.0);
QFGL_glVertex2f (x + w, y + h);
QFGL_glTexCoord2f (x / 64.0, (y + h) / 64.0);
QFGL_glVertex2f (x, y + h);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glColor3f (0.8, 0.8, 0.8);
glBindTexture (GL_TEXTURE_2D, *(int *) draw_backtile->data);
glBegin (GL_QUADS);
glTexCoord2f (x / 64.0, y / 64.0);
glVertex2f (x, y);
glTexCoord2f ((x + w) / 64.0, y / 64.0);
glVertex2f (x + w, y);
glTexCoord2f ((x + w) / 64.0, (y + h) / 64.0);
glVertex2f (x + w, y + h);
glTexCoord2f (x / 64.0, (y + h) / 64.0);
glVertex2f (x, y + h);
glEnd ();
glColor3ubv (lighthalf_v);
}
@ -602,20 +602,20 @@ Draw_TileClear (int x, int y, int w, int h)
void
Draw_Fill (int x, int y, int w, int h, int c)
{
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0,
glDisable (GL_TEXTURE_2D);
glColor3f (vid_basepal[c * 3] / 255.0, vid_basepal[c * 3 + 1] / 255.0,
vid_basepal[c * 3 + 2] / 255.0);
QFGL_glBegin (GL_QUADS);
glBegin (GL_QUADS);
QFGL_glVertex2f (x, y);
QFGL_glVertex2f (x + w, y);
QFGL_glVertex2f (x + w, y + h);
QFGL_glVertex2f (x, y + h);
glVertex2f (x, y);
glVertex2f (x + w, y);
glVertex2f (x + w, y + h);
glVertex2f (x, y + h);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
QFGL_glEnable (GL_TEXTURE_2D);
glEnd ();
glColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D);
}
@ -625,18 +625,18 @@ Draw_Fill (int x, int y, int w, int h, int c)
void
Draw_FadeScreen (void)
{
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glColor4f (0, 0, 0, 0.7);
QFGL_glBegin (GL_QUADS);
glDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.7);
glBegin (GL_QUADS);
QFGL_glVertex2f (0, 0);
QFGL_glVertex2f (vid.width, 0);
QFGL_glVertex2f (vid.width, vid.height);
QFGL_glVertex2f (0, vid.height);
glVertex2f (0, 0);
glVertex2f (vid.width, 0);
glVertex2f (vid.width, vid.height);
glVertex2f (0, vid.height);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
QFGL_glEnable (GL_TEXTURE_2D);
glEnd ();
glColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D);
Sbar_Changed ();
}
@ -677,17 +677,17 @@ Draw_EndDisc (void)
void
GL_Set2D (void)
{
QFGL_glViewport (glx, gly, glwidth, glheight);
glViewport (glx, gly, glwidth, glheight);
QFGL_glMatrixMode (GL_PROJECTION);
QFGL_glLoadIdentity ();
QFGL_glOrtho (0, vid.width, vid.height, 0, -99999, 99999);
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
glOrtho (0, vid.width, vid.height, 0, -99999, 99999);
QFGL_glMatrixMode (GL_MODELVIEW);
QFGL_glLoadIdentity ();
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
QFGL_glDisable (GL_DEPTH_TEST);
QFGL_glDisable (GL_CULL_FACE);
glDisable (GL_DEPTH_TEST);
glDisable (GL_CULL_FACE);
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
}

View File

@ -166,12 +166,12 @@ R_DrawFire (fire_t *f)
return;
}
// we're not - draw it
QFGL_glBegin (GL_TRIANGLE_FAN);
QFGL_glColor3fv (f->color);
glBegin (GL_TRIANGLE_FAN);
glColor3fv (f->color);
for (i = 0; i < 3; i++)
vec[i] = f->origin[i] - vpn[i] * radius;
QFGL_glVertex3fv (vec);
QFGL_glColor3f (0.0, 0.0, 0.0);
glVertex3fv (vec);
glColor3f (0.0, 0.0, 0.0);
// don't panic, this just draws a bubble...
for (i = 16; i >= 0; i--) {
@ -181,14 +181,14 @@ R_DrawFire (fire_t *f)
vec2[j] = f->owner[j] + (*b_cos * vright[j]
+ vup[j] * (*b_sin)) * radius;
}
QFGL_glVertex3fv (vec);
QFGL_glVertex3fv (vec2);
glVertex3fv (vec);
glVertex3fv (vec2);
b_sin += 2;
b_cos += 2;
}
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glEnd ();
glColor3ubv (lighthalf_v);
}
@ -206,9 +206,9 @@ R_UpdateFires (void)
if (!gl_fires->int_val)
return;
QFGL_glDepthMask (GL_FALSE);
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glBlendFunc (GL_ONE, GL_ONE);
glDepthMask (GL_FALSE);
glDisable (GL_TEXTURE_2D);
glBlendFunc (GL_ONE, GL_ONE);
f = r_fires;
for (i = 0; i < MAX_FIRES; i++, f++) {
@ -218,7 +218,7 @@ R_UpdateFires (void)
R_DrawFire (f);
}
QFGL_glEnable (GL_TEXTURE_2D);
QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QFGL_glDepthMask (GL_TRUE);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE);
}

View File

@ -575,7 +575,7 @@ R_DrawParticles (void)
int activeparticles, maxparticle, j, k;
// LordHavoc: particles should not affect zbuffer
QFGL_glDepthMask (GL_FALSE);
glDepthMask (GL_FALSE);
VectorScale (vup, 1.5, o_up);
VectorScale (vright, 1.5, o_right);
@ -660,8 +660,8 @@ R_DrawParticles (void)
varray[3].vertex[1] = part->org[1] + up_scale[1] - right_scale[1];
varray[3].vertex[2] = part->org[2] + up_scale[2] - right_scale[2];
QFGL_glBindTexture (GL_TEXTURE_2D, part->tex);
QFGL_glDrawArrays (GL_QUADS, 0, 4);
glBindTexture (GL_TEXTURE_2D, part->tex);
glDrawArrays (GL_QUADS, 0, 4);
}
for (i = 0; i < 3; i++)
@ -747,6 +747,6 @@ R_DrawParticles (void)
}
numparticles = activeparticles;
QFGL_glColor3ubv (lighthalf_v);
QFGL_glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE);
}

View File

@ -83,10 +83,10 @@ GDT_InitDotParticleTexture (void)
}
}
part_tex_dot = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_dot);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
glBindTexture (GL_TEXTURE_2D, part_tex_dot);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
@ -115,10 +115,10 @@ GDT_InitSparkParticleTexture (void)
}
}
part_tex_spark = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_spark);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
glBindTexture (GL_TEXTURE_2D, part_tex_spark);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
@ -153,10 +153,10 @@ GDT_InitSmokeParticleTexture (void)
}
}
part_tex_smoke[i] = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
}
@ -197,10 +197,10 @@ GDT_InitSmokeRingParticleTexture (void)
}
}
part_tex_smoke_ring[i] = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
}

View File

@ -29,45 +29,105 @@
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <stdio.h>
#include <dlfcn.h>
#include <QF/GL/types.h>
#include <QF/GL/funcs.h>
#include <QF/GL/extensions.h>
#include <QF/cvar.h>
#include <QF/console.h>
#include "r_cvar.h"
// First we need to get all the function pointers declared.
#define QFGL_NEED(ret, name, args) ret (* QFGL_##name) args = NULL;
#define QFGL_NEED(ret, name, args) \
typedef ret (* QF_##name) args; \
QF_##name name = NULL;
#include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED
// Then we need to open the libGL and set all the symbols.
qboolean GLF_Init ()
qboolean
GLF_Init (void)
{
void *handle;
handle = dlopen (gl_libgl->string, RTLD_NOW);
if (!handle) {
Con_Printf("Can't open libgl %s: %s\n", gl_libgl->string, dlerror());
#ifdef HAVE_DLOPEN
if (!(handle = dlopen (gl_libgl->string, RTLD_NOW))) {
Con_Printf ("Couldn't load OpenGL library %s: %s\n", gl_libgl->string, dlerror ());
#else
# if _WIN32
if (!(handle = LoadLibrary (gl_libgl->string))) {
Con_Printf ("Couldn't load OpenGL library %s!\n", gl_libgl->string);
# else
{
Con_Printf ("Cannot load libraries: %s was built without DSO support", PROGRAM);
# endif
#endif
return false;
}
#define QFGL_NEED(ret, name, args) \
QFGL_##name = dlsym(handle, #name); \
if (!QFGL_##name) { \
Con_Printf("Can't load symbol %s: %s\n", #name, dlerror()); \
}
name = QFGL_ProcAddress (handle, (#name));
#include "QF/GL/qf_funcs_list.h"
#undef QFGL_NEED
return true;
}
void *
QFGL_ProcAddress (void *handle, const char *name)
{
#if defined(HAVE_GLX) && defined(HAVE_DLOPEN)
static QF_glXGetProcAddressARB glXGetProcAddress = NULL;
static qboolean inited = false;
if (!inited) {
inited = true;
glXGetProcAddress = dlsym (handle, "glXGetProcAddressARB");
}
#endif
if (name) {
#if defined(HAVE_GLX) && defined(HAVE_DLOPEN)
if (glXGetProcAddress) {
return glXGetProcAddress ((const GLubyte *) name);
} else {
void *glfunction;
if (!(glfunction = dlsym (handle, name))) {
Con_Printf ("Cannot find symbol %s: %s\n", name, dlerror ());
return NULL;
}
return glfunction;
}
}
#else
# ifdef _WIN32
void *glfunction;
char filename[4096];
if (!(glfunction = GetProcAddress (handle, name))) {
if (GetModuleFileName (handle, &filename, sizeof (filename)))
Con_Printf ("Cannot find symbol %s in library %s", name, filename);
else
Con_Printf ("Cannot find symbol %s in library %s", name, gl_libgl->string);
return NULL;
}
return glfunction;
# endif
#endif
return NULL;
}

View File

@ -122,22 +122,22 @@ R_LineGraph (int x, int y, int *h_vals, int count)
dest[0] = 0xff;
}
QFGL_glBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]);
glBindTexture (GL_TEXTURE_2D, graph_texture[graph_index]);
GL_Upload8 (graph_texels[graph_index], graph_width[graph_index], s, 0, 1);
QFGL_glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 0);
QFGL_glVertex2f (x, y);
QFGL_glTexCoord2f (1, 0);
QFGL_glVertex2f (x + graph_width[graph_index], y);
QFGL_glTexCoord2f (1, 1);
QFGL_glVertex2f (x + graph_width[graph_index], y - s);
QFGL_glTexCoord2f (0, 1);
QFGL_glVertex2f (x, y - s);
QFGL_glEnd ();
glBegin (GL_QUADS);
glTexCoord2f (0, 0);
glVertex2f (x, y);
glTexCoord2f (1, 0);
glVertex2f (x + graph_width[graph_index], y);
glTexCoord2f (1, 1);
glVertex2f (x + graph_width[graph_index], y - s);
glTexCoord2f (0, 1);
glVertex2f (x, y - s);
glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
graph_index = (graph_index + 1) % NUM_GRAPH_TEXTURES;
}

View File

@ -129,9 +129,9 @@ R_RenderDlight (dlight_t *light)
return;
}
QFGL_glBegin (GL_TRIANGLE_FAN);
glBegin (GL_TRIANGLE_FAN);
QFGL_glColor3fv (light->color);
glColor3fv (light->color);
VectorSubtract (r_origin, light->origin, v);
VectorNormalize (v);
@ -139,8 +139,8 @@ R_RenderDlight (dlight_t *light)
for (i = 0; i < 3; i++)
v[i] = light->origin[i] + v[i] * rad;
QFGL_glVertex3fv (v);
QFGL_glColor3f (0, 0, 0);
glVertex3fv (v);
glColor3f (0, 0, 0);
for (i = 16; i >= 0; i--) {
for (j = 0; j < 3; j++)
@ -148,10 +148,10 @@ R_RenderDlight (dlight_t *light)
vup[j] * (*bub_sin)) * rad;
bub_sin += 2;
bub_cos += 2;
QFGL_glVertex3fv (v);
glVertex3fv (v);
}
QFGL_glEnd ();
glEnd ();
}
@ -164,10 +164,10 @@ R_RenderDlights (void)
if (!gl_dlight_polyblend->int_val)
return;
QFGL_glDepthMask (GL_FALSE);
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glBlendFunc (GL_ONE, GL_ONE);
QFGL_glShadeModel (GL_SMOOTH);
glDepthMask (GL_FALSE);
glDisable (GL_TEXTURE_2D);
glBlendFunc (GL_ONE, GL_ONE);
glShadeModel (GL_SMOOTH);
l = r_dlights;
for (i = 0; i < MAX_DLIGHTS; i++, l++) {
@ -177,11 +177,11 @@ R_RenderDlights (void)
}
if (!gl_dlight_smooth->int_val)
QFGL_glShadeModel (GL_FLAT);
QFGL_glColor3ubv (lighthalf_v);
QFGL_glEnable (GL_TEXTURE_2D);
QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QFGL_glDepthMask (GL_TRUE);
glShadeModel (GL_FLAT);
glColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDepthMask (GL_TRUE);
}

View File

@ -117,12 +117,12 @@ glrmain_init (void)
void
R_RotateForEntity (entity_t *e)
{
QFGL_glTranslatef (e->origin[0], e->origin[1], e->origin[2]);
glTranslatef (e->origin[0], e->origin[1], e->origin[2]);
QFGL_glRotatef (e->angles[1], 0, 0, 1);
QFGL_glRotatef (-e->angles[0], 0, 1, 0);
glRotatef (e->angles[1], 0, 0, 1);
glRotatef (-e->angles[0], 0, 1, 0);
// ZOID: fixed z angle
QFGL_glRotatef (e->angles[2], 1, 0, 0);
glRotatef (e->angles[2], 1, 0, 0);
}
@ -193,34 +193,34 @@ R_DrawSpriteModel (entity_t *e)
right = vright;
}
QFGL_glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
glBindTexture (GL_TEXTURE_2D, frame->gl_texturenum);
QFGL_glEnable (GL_ALPHA_TEST);
QFGL_glBegin (GL_QUADS);
glEnable (GL_ALPHA_TEST);
glBegin (GL_QUADS);
QFGL_glTexCoord2f (0, 1);
glTexCoord2f (0, 1);
VectorMA (e->origin, frame->down, up, point);
VectorMA (point, frame->left, right, point);
QFGL_glVertex3fv (point);
glVertex3fv (point);
QFGL_glTexCoord2f (0, 0);
glTexCoord2f (0, 0);
VectorMA (e->origin, frame->up, up, point);
VectorMA (point, frame->left, right, point);
QFGL_glVertex3fv (point);
glVertex3fv (point);
QFGL_glTexCoord2f (1, 0);
glTexCoord2f (1, 0);
VectorMA (e->origin, frame->up, up, point);
VectorMA (point, frame->right, right, point);
QFGL_glVertex3fv (point);
glVertex3fv (point);
QFGL_glTexCoord2f (1, 1);
glTexCoord2f (1, 1);
VectorMA (e->origin, frame->down, up, point);
VectorMA (point, frame->right, right, point);
QFGL_glVertex3fv (point);
glVertex3fv (point);
QFGL_glEnd ();
glEnd ();
QFGL_glDisable (GL_ALPHA_TEST);
glDisable (GL_ALPHA_TEST);
}
@ -263,24 +263,24 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
order = (int *) ((byte *) paliashdr + paliashdr->commands);
if (modelalpha != 1.0)
QFGL_glDepthMask (GL_FALSE);
glDepthMask (GL_FALSE);
if (fb) {
QFGL_glColor4f (1, 1, 1, modelalpha);
glColor4f (1, 1, 1, modelalpha);
}
while ((count = *order++)) {
// get the vertex count and primitive type
if (count < 0) {
count = -count;
QFGL_glBegin (GL_TRIANGLE_FAN);
glBegin (GL_TRIANGLE_FAN);
} else {
QFGL_glBegin (GL_TRIANGLE_STRIP);
glBegin (GL_TRIANGLE_STRIP);
}
do {
// texture coordinates come from the draw list
QFGL_glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2;
if (!fb) {
@ -288,21 +288,21 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
l = shadedots[verts->lightnormalindex] * shadelight;
// LordHavoc: cleanup after Endy
QFGL_glColor4f (shadecolor[0] * l, shadecolor[1] * l,
glColor4f (shadecolor[0] * l, shadecolor[1] * l,
shadecolor[2] * l, modelalpha);
}
QFGL_glVertex3f (verts->v[0], verts->v[1], verts->v[2]);
glVertex3f (verts->v[0], verts->v[1], verts->v[2]);
verts++;
} while (--count);
QFGL_glEnd ();
glEnd ();
}
if (modelalpha != 1.0)
QFGL_glDepthMask (GL_TRUE);
glDepthMask (GL_TRUE);
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
}
@ -333,10 +333,10 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
order = (int *) ((byte *) paliashdr + paliashdr->commands);
if (modelalpha != 1.0)
QFGL_glDepthMask (GL_FALSE);
glDepthMask (GL_FALSE);
if (fb) { // don't do this in the loop, it doesn't change
QFGL_glColor4f (1, 1, 1, modelalpha);
glColor4f (1, 1, 1, modelalpha);
}
lerp = 1 - blend;
@ -344,14 +344,14 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
if (count < 0) {
count = -count;
QFGL_glBegin (GL_TRIANGLE_FAN);
glBegin (GL_TRIANGLE_FAN);
} else {
QFGL_glBegin (GL_TRIANGLE_STRIP);
glBegin (GL_TRIANGLE_STRIP);
}
do {
// texture coordinates come from the draw list
QFGL_glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
glTexCoord2f (((float *) order)[0], ((float *) order)[1]);
order += 2;
if (!fb) {
@ -361,24 +361,24 @@ GL_DrawAliasBlendedFrame (aliashdr_t *paliashdr, int pose1, int pose2, float ble
lerp)
+ (shadedots[verts2->lightnormalindex] *
blend));
QFGL_glColor4f (shadecolor[0] * light, shadecolor[1] * light,
glColor4f (shadecolor[0] * light, shadecolor[1] * light,
shadecolor[2] * light, modelalpha);
}
// blend the vertex positions from each frame together
QFGL_glVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend),
glVertex3f ((verts1->v[0] * lerp) + (verts2->v[0] * blend),
(verts1->v[1] * lerp) + (verts2->v[1] * blend),
(verts1->v[2] * lerp) + (verts2->v[2] * blend));
verts1++;
verts2++;
} while (--count);
QFGL_glEnd ();
glEnd ();
}
if (modelalpha != 1.0)
QFGL_glDepthMask (GL_TRUE);
QFGL_glColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
}
@ -412,13 +412,13 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
if (count < 0) {
count = -count;
QFGL_glBegin (GL_TRIANGLE_FAN);
glBegin (GL_TRIANGLE_FAN);
} else
QFGL_glBegin (GL_TRIANGLE_STRIP);
glBegin (GL_TRIANGLE_STRIP);
do {
// texture coordinates come from the draw list
// (skipped for shadows) QFGL_glTexCoord2fv ((float *)order);
// (skipped for shadows) glTexCoord2fv ((float *)order);
order += 2;
// normals and vertexes come from the frame list
@ -436,12 +436,12 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
point[1] -= shadevector[1] * (point[2] + lheight);
point[2] = height;
// height -= 0.001;
QFGL_glVertex3fv (point);
glVertex3fv (point);
verts++;
} while (--count);
QFGL_glEnd ();
glEnd ();
}
}
@ -479,9 +479,9 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
if (count < 0) {
count = -count;
QFGL_glBegin (GL_TRIANGLE_FAN);
glBegin (GL_TRIANGLE_FAN);
} else {
QFGL_glBegin (GL_TRIANGLE_STRIP);
glBegin (GL_TRIANGLE_STRIP);
}
do {
@ -501,14 +501,14 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
point2[0] -= shadevector[0] * (point2[2] + lheight);
point2[1] -= shadevector[1] * (point2[2] + lheight);
QFGL_glVertex3f ((point1[0] * lerp) + (point2[0] * blend),
glVertex3f ((point1[0] * lerp) + (point2[0] * blend),
(point1[1] * lerp) + (point2[1] * blend),
height);
verts1++;
verts2++;
} while (--count);
QFGL_glEnd ();
glEnd ();
}
}
@ -671,21 +671,21 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
c_alias_polys += paliashdr->mdl.numtris;
// draw all the triangles
QFGL_glPushMatrix ();
glPushMatrix ();
R_RotateForEntity (e);
if (strequal (clmodel->name, "progs/eyes.mdl")) {
QFGL_glTranslatef (paliashdr->mdl.scale_origin[0],
glTranslatef (paliashdr->mdl.scale_origin[0],
paliashdr->mdl.scale_origin[1],
paliashdr->mdl.scale_origin[2] - (22 + 8));
// double size of eyes, since they are really hard to see in GL
QFGL_glScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2,
glScalef (paliashdr->mdl.scale[0] * 2, paliashdr->mdl.scale[1] * 2,
paliashdr->mdl.scale[2] * 2);
} else {
QFGL_glTranslatef (paliashdr->mdl.scale_origin[0],
glTranslatef (paliashdr->mdl.scale_origin[0],
paliashdr->mdl.scale_origin[1],
paliashdr->mdl.scale_origin[2]);
QFGL_glScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1],
glScalef (paliashdr->mdl.scale[0], paliashdr->mdl.scale[1],
paliashdr->mdl.scale[2]);
}
@ -712,10 +712,10 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
}
}
QFGL_glBindTexture (GL_TEXTURE_2D, texture);
glBindTexture (GL_TEXTURE_2D, texture);
if (gl_affinemodels->int_val)
QFGL_glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
if (gl_lerp_anim->int_val) {
R_SetupAliasBlendedFrame (currententity->frame, paliashdr, currententity, false);
@ -725,7 +725,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
// This block is GL fullbright support for objects...
if (fb_texture) {
QFGL_glBindTexture (GL_TEXTURE_2D, fb_texture);
glBindTexture (GL_TEXTURE_2D, fb_texture);
if (gl_lerp_anim->int_val) {
R_SetupAliasBlendedFrame (currententity->frame, paliashdr,
currententity, true);
@ -735,9 +735,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
}
if (gl_affinemodels->int_val)
QFGL_glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_DONT_CARE);
QFGL_glPopMatrix ();
glPopMatrix ();
if (r_shadows->int_val) {
// torches, grenades, and lightning bolts do not have shadows
@ -746,11 +746,11 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
if (strequal (clmodel->name, "progs/grenade.mdl"))
return;
QFGL_glPushMatrix ();
glPushMatrix ();
R_RotateForEntity (e);
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glColor4f (0, 0, 0, 0.5);
glDisable (GL_TEXTURE_2D);
glColor4f (0, 0, 0, 0.5);
if (gl_lerp_anim->int_val) {
GL_DrawAliasBlendedShadow (paliashdr, lastposenum0, lastposenum, currententity);
@ -758,9 +758,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
GL_DrawAliasShadow (paliashdr, lastposenum);
}
QFGL_glEnable (GL_TEXTURE_2D);
QFGL_glColor3ubv (lighthalf_v);
QFGL_glPopMatrix ();
glEnable (GL_TEXTURE_2D);
glColor3ubv (lighthalf_v);
glPopMatrix ();
}
}
@ -860,9 +860,9 @@ R_DrawViewModel (void)
modelalpha = currententity->alpha;
// hack the depth range to prevent view model from poking into walls
QFGL_glDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
glDepthRange (gldepthmin, gldepthmin + 0.3 * (gldepthmax - gldepthmin));
R_DrawAliasModel (currententity, false);
QFGL_glDepthRange (gldepthmin, gldepthmax);
glDepthRange (gldepthmin, gldepthmax);
}
@ -957,7 +957,7 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
xmin = ymin * aspect;
xmax = ymax * aspect;
QFGL_glFrustum (xmin, xmax, ymin, ymax, zNear, zFar);
glFrustum (xmin, xmax, ymin, ymax, zNear, zFar);
}
@ -969,8 +969,8 @@ R_SetupGL (void)
int x, x2, y2, y, w, h;
// set up viewpoint
QFGL_glMatrixMode (GL_PROJECTION);
QFGL_glLoadIdentity ();
glMatrixMode (GL_PROJECTION);
glLoadIdentity ();
x = r_refdef.vrect.x * glwidth / vid.width;
x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth / vid.width;
y = (vid.height - r_refdef.vrect.y) * glheight / vid.height;
@ -995,41 +995,41 @@ R_SetupGL (void)
w = h = 256;
}
QFGL_glViewport (glx + x, gly + y2, w, h);
glViewport (glx + x, gly + y2, w, h);
screenaspect = (float) r_refdef.vrect.width / r_refdef.vrect.height;
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
if (mirror) {
if (mirror_plane->normal[2])
QFGL_glScalef (1, -1, 1);
glScalef (1, -1, 1);
else
QFGL_glScalef (-1, 1, 1);
QFGL_glCullFace (GL_BACK);
glScalef (-1, 1, 1);
glCullFace (GL_BACK);
} else
QFGL_glCullFace (GL_FRONT);
glCullFace (GL_FRONT);
QFGL_glMatrixMode (GL_MODELVIEW);
QFGL_glLoadIdentity ();
glMatrixMode (GL_MODELVIEW);
glLoadIdentity ();
QFGL_glRotatef (-90, 1, 0, 0); // put Z going up
QFGL_glRotatef (90, 0, 0, 1); // put Z going up
QFGL_glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
QFGL_glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
QFGL_glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
QFGL_glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1],
glRotatef (-90, 1, 0, 0); // put Z going up
glRotatef (90, 0, 0, 1); // put Z going up
glRotatef (-r_refdef.viewangles[2], 1, 0, 0);
glRotatef (-r_refdef.viewangles[0], 0, 1, 0);
glRotatef (-r_refdef.viewangles[1], 0, 0, 1);
glTranslatef (-r_refdef.vieworg[0], -r_refdef.vieworg[1],
-r_refdef.vieworg[2]);
QFGL_glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
glGetFloatv (GL_MODELVIEW_MATRIX, r_world_matrix);
// set drawing parms
QFGL_glEnable (GL_CULL_FACE);
QFGL_glDisable (GL_ALPHA_TEST);
QFGL_glAlphaFunc (GL_GREATER, 0.5);
QFGL_glEnable (GL_DEPTH_TEST);
glEnable (GL_CULL_FACE);
glDisable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.5);
glEnable (GL_DEPTH_TEST);
if (gl_dlight_smooth->int_val)
QFGL_glShadeModel (GL_SMOOTH);
glShadeModel (GL_SMOOTH);
else
QFGL_glShadeModel (GL_FLAT);
glShadeModel (GL_FLAT);
}
@ -1037,14 +1037,14 @@ static void
R_Clear (void)
{
if (gl_clear->int_val)
QFGL_glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
else
QFGL_glClear (GL_DEPTH_BUFFER_BIT);
glClear (GL_DEPTH_BUFFER_BIT);
gldepthmin = 0;
gldepthmax = 1;
QFGL_glDepthFunc (GL_LEQUAL);
glDepthFunc (GL_LEQUAL);
QFGL_glDepthRange (gldepthmin, gldepthmax);
glDepthRange (gldepthmin, gldepthmax);
}
@ -1112,34 +1112,34 @@ R_Mirror (void)
gldepthmin = 0.5;
gldepthmax = 1;
QFGL_glDepthRange (gldepthmin, gldepthmax);
QFGL_glDepthFunc (GL_LEQUAL);
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
R_RenderScene ();
R_DrawWaterSurfaces ();
gldepthmin = 0;
gldepthmax = 1;//XXX 0.5;
QFGL_glDepthRange (gldepthmin, gldepthmax);
QFGL_glDepthFunc (GL_LEQUAL);
glDepthRange (gldepthmin, gldepthmax);
glDepthFunc (GL_LEQUAL);
// blend on top
QFGL_glMatrixMode (GL_PROJECTION);
glMatrixMode (GL_PROJECTION);
if (mirror_plane->normal[2])
QFGL_glScalef (1, -1, 1);
glScalef (1, -1, 1);
else
QFGL_glScalef (-1, 1, 1);
QFGL_glCullFace (GL_FRONT);
QFGL_glMatrixMode (GL_MODELVIEW);
glScalef (-1, 1, 1);
glCullFace (GL_FRONT);
glMatrixMode (GL_MODELVIEW);
QFGL_glLoadMatrixf (r_base_world_matrix);
glLoadMatrixf (r_base_world_matrix);
QFGL_glColor4f (1, 1, 1, r_mirroralpha->value);
glColor4f (1, 1, 1, r_mirroralpha->value);
s = r_worldentity.model->textures[mirrortexturenum]->texturechain;
for (; s; s = s->texturechain)
R_RenderBrushPoly (s);
r_worldentity.model->textures[mirrortexturenum]->texturechain = NULL;
QFGL_glColor4f (1, 1, 1, 1);
glColor4f (1, 1, 1, 1);
}
@ -1157,7 +1157,7 @@ R_RenderView (void)
if (!r_worldentity.model)
Sys_Error ("R_RenderView: NULL worldmodel");
// QFGL_glFinish ();
// glFinish ();
mirror = false;

View File

@ -80,8 +80,8 @@ R_Envmap_f (void)
{
byte buffer[256 * 256 * 4];
QFGL_glDrawBuffer (GL_FRONT);
QFGL_glReadBuffer (GL_FRONT);
glDrawBuffer (GL_FRONT);
glReadBuffer (GL_FRONT);
envmap = true;
r_refdef.vrect.x = 0;
@ -94,44 +94,44 @@ R_Envmap_f (void)
r_refdef.viewangles[2] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env0.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 90;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env1.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 180;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env2.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[1] = 270;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env3.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[0] = -90;
r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env4.rgb", buffer, sizeof (buffer));
r_refdef.viewangles[0] = 90;
r_refdef.viewangles[1] = 0;
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
R_RenderView ();
QFGL_glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
glReadPixels (0, 0, 256, 256, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
COM_WriteFile ("env5.rgb", buffer, sizeof (buffer));
envmap = false;
QFGL_glDrawBuffer (GL_BACK);
QFGL_glReadBuffer (GL_BACK);
glDrawBuffer (GL_BACK);
glReadBuffer (GL_BACK);
GL_EndRendering ();
}
@ -166,14 +166,14 @@ R_Init (void)
texture_extension_number = Skin_Init_Textures (texture_extension_number);
QFGL_glEnableClientState (GL_COLOR_ARRAY);
QFGL_glEnableClientState (GL_VERTEX_ARRAY);
QFGL_glEnableClientState (GL_TEXTURE_COORD_ARRAY);
glEnableClientState (GL_COLOR_ARRAY);
glEnableClientState (GL_VERTEX_ARRAY);
glEnableClientState (GL_TEXTURE_COORD_ARRAY);
// QFGL_glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray);
QFGL_glTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord);
QFGL_glColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color);
QFGL_glVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
// glInterleavedArrays(GL_T2F_C4F_N3F_V3F, 0, varray);
glTexCoordPointer (2, GL_FLOAT, sizeof(varray[0]), varray[0].texcoord);
glColorPointer (4, GL_FLOAT, sizeof(varray[0]), varray[0].color);
glVertexPointer (3, GL_FLOAT, sizeof(varray[0]), varray[0].vertex);
}
@ -230,7 +230,7 @@ R_TimeRefresh_f (void)
int i;
double start, stop, time;
QFGL_glFinish ();
glFinish ();
GL_EndRendering ();
start = Sys_DoubleTime ();
@ -238,7 +238,7 @@ R_TimeRefresh_f (void)
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
r_refdef.viewangles[1] = i / 128.0 * 360.0;
R_RenderView ();
QFGL_glFinish ();
glFinish ();
GL_EndRendering ();
}

View File

@ -370,11 +370,11 @@ extern float speedscale; // for top sky and bottom sky
void
GL_UploadLightmap (int i, int x, int y, int w, int h)
{
/* QFGL_glTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format,
/* glTexSubImage2D (GL_TEXTURE_2D, 0, 0, y, BLOCK_WIDTH, h, gl_lightmap_format,
GL_UNSIGNED_BYTE,
lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes);
*/
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH,
glTexImage2D (GL_TEXTURE_2D, 0, gl_internalformat, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]);
}
@ -398,17 +398,17 @@ R_DrawMultitexturePoly (msurface_t *s)
i = s->lightmaptexturenum;
QFGL_glColor3f (1, 1, 1);
glColor3f (1, 1, 1);
// Binds world to texture env 0
qglActiveTexture (gl_mtex_enum + 0);
QFGL_glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
QFGL_glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
glEnable (GL_TEXTURE_2D);
// Binds lightmap to texenv 1
qglActiveTexture (gl_mtex_enum + 1);
QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
QFGL_glEnable (GL_TEXTURE_2D);
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable (GL_TEXTURE_2D);
// check for lightmap modification
if (r_dynamic->int_val) {
@ -429,24 +429,24 @@ R_DrawMultitexturePoly (msurface_t *s)
}
}
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
v = s->polys->verts[0];
for (i = 0; i < s->polys->numverts; i++, v += VERTEXSIZE) {
qglMultiTexCoord2f (gl_mtex_enum + 0, v[3], v[4]);
qglMultiTexCoord2f (gl_mtex_enum + 1, v[5], v[6]);
QFGL_glVertex3fv (v);
glVertex3fv (v);
}
QFGL_glEnd ();
QFGL_glDisable (GL_TEXTURE_2D);
glEnd ();
glDisable (GL_TEXTURE_2D);
qglActiveTexture (gl_mtex_enum + 0);
QFGL_glEnable (GL_TEXTURE_2D);
glEnable (GL_TEXTURE_2D);
if (texture->gl_fb_texturenum > 0) {
s->polys->fb_chain = fullbright_polys[texture->gl_fb_texturenum];
fullbright_polys[texture->gl_fb_texturenum] = s->polys;
}
QFGL_glColor3ubv (lighthalf_v);
QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glColor3ubv (lighthalf_v);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
@ -457,17 +457,17 @@ R_BlendLightmaps (void)
glpoly_t *p;
float *v;
QFGL_glDepthMask (GL_FALSE); // don't bother writing Z
glDepthMask (GL_FALSE); // don't bother writing Z
QFGL_glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
glBlendFunc (GL_DST_COLOR, GL_SRC_COLOR);
QFGL_glColor3f (1, 1, 1);
glColor3f (1, 1, 1);
for (i = 0; i < MAX_LIGHTMAPS; i++) {
p = lightmap_polys[i];
if (!p)
continue;
QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
if (lightmap_modified[i]) {
GL_UploadLightmap (i, lightmap_rectchange[i].l,
lightmap_rectchange[i].t,
@ -476,21 +476,21 @@ R_BlendLightmaps (void)
lightmap_modified[i] = false;
}
for (; p; p = p->chain) {
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
v = p->verts[0];
for (j = 0; j < p->numverts; j++, v += VERTEXSIZE) {
QFGL_glTexCoord2fv (&v[5]);
QFGL_glVertex3fv (v);
glTexCoord2fv (&v[5]);
glVertex3fv (v);
}
QFGL_glEnd ();
glEnd ();
}
}
// Return to normal blending --KB
QFGL_glColor3ubv (lighthalf_v);
QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor3ubv (lighthalf_v);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QFGL_glDepthMask (GL_TRUE); // back to normal Z buffering
glDepthMask (GL_TRUE); // back to normal Z buffering
}
@ -501,22 +501,22 @@ R_RenderFullbrights (void)
glpoly_t *p;
float *v;
QFGL_glBlendFunc (GL_ONE, GL_ONE);
glBlendFunc (GL_ONE, GL_ONE);
for (i = 1; i < MAX_GLTEXTURES; i++) {
if (!fullbright_polys[i])
continue;
QFGL_glBindTexture (GL_TEXTURE_2D, i);
glBindTexture (GL_TEXTURE_2D, i);
for (p = fullbright_polys[i]; p; p = p->fb_chain) {
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
for (j = 0, v = p->verts[0]; j < p->numverts; j++, v += VERTEXSIZE) {
QFGL_glTexCoord2fv (&v[3]);
QFGL_glVertex3fv (v);
glTexCoord2fv (&v[3]);
glVertex3fv (v);
}
QFGL_glEnd ();
glEnd ();
}
}
QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
@ -533,16 +533,16 @@ R_RenderBrushPoly (msurface_t *fa)
c_brush_polys++;
QFGL_glColor3f (1, 1, 1);
QFGL_glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
glColor3f (1, 1, 1);
glBindTexture (GL_TEXTURE_2D, texture->gl_texturenum);
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
v = fa->polys->verts[0];
for (i = 0; i < fa->polys->numverts; i++, v += VERTEXSIZE) {
QFGL_glTexCoord2fv (&v[3]);
QFGL_glVertex3fv (v);
glTexCoord2fv (&v[3]);
glVertex3fv (v);
}
QFGL_glEnd ();
glEnd ();
// add the poly to the proper lightmap chain
@ -585,7 +585,7 @@ R_RenderBrushPoly (msurface_t *fa)
R_BuildLightMap (fa, base, BLOCK_WIDTH * lightmap_bytes);
}
}
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
}
@ -595,13 +595,13 @@ GL_WaterSurface (msurface_t *s)
int i;
i = s->texinfo->texture->gl_texturenum;
QFGL_glBindTexture (GL_TEXTURE_2D, i);
glBindTexture (GL_TEXTURE_2D, i);
if (r_wateralpha->value < 1.0) {
QFGL_glDepthMask (GL_FALSE);
QFGL_glColor4f (1, 1, 1, r_wateralpha->value);
glDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value);
EmitWaterPolys (s);
QFGL_glColor3ubv (lighthalf_v);
QFGL_glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE);
} else
EmitWaterPolys (s);
}
@ -617,18 +617,18 @@ R_DrawWaterSurfaces (void)
return;
// go back to the world matrix
QFGL_glLoadMatrixf (r_world_matrix);
glLoadMatrixf (r_world_matrix);
if (r_wateralpha->value < 1.0) {
QFGL_glDepthMask (GL_FALSE);
QFGL_glColor4f (1, 1, 1, r_wateralpha->value);
glDepthMask (GL_FALSE);
glColor4f (1, 1, 1, r_wateralpha->value);
}
i = -1;
for (s = waterchain; s; s = s->texturechain) {
if (i != s->texinfo->texture->gl_texturenum) {
i = s->texinfo->texture->gl_texturenum;
QFGL_glBindTexture (GL_TEXTURE_2D, i);
glBindTexture (GL_TEXTURE_2D, i);
}
EmitWaterPolys (s);
}
@ -636,8 +636,8 @@ R_DrawWaterSurfaces (void)
waterchain = NULL;
if (r_wateralpha->value < 1.0) {
QFGL_glDepthMask (GL_TRUE);
QFGL_glColor3ubv (lighthalf_v);
glDepthMask (GL_TRUE);
glColor3ubv (lighthalf_v);
}
}
@ -648,7 +648,7 @@ DrawTextureChains (void)
int i;
msurface_t *s;
QFGL_glDisable (GL_BLEND);
glDisable (GL_BLEND);
for (i = 0; i < r_worldentity.model->numtextures; i++) {
if (!r_worldentity.model->textures[i])
@ -659,7 +659,7 @@ DrawTextureChains (void)
r_worldentity.model->textures[i]->texturechain = NULL;
}
QFGL_glEnable (GL_BLEND);
glEnable (GL_BLEND);
}
@ -728,7 +728,7 @@ R_DrawBrushModel (entity_t *e)
}
}
QFGL_glPushMatrix ();
glPushMatrix ();
e->angles[0] = -e->angles[0]; // stupid quake bug
R_RotateForEntity (e);
e->angles[0] = -e->angles[0]; // stupid quake bug
@ -771,7 +771,7 @@ R_DrawBrushModel (entity_t *e)
if (gl_sky_clip->int_val)
R_DrawSkyChain (sky_chain);
QFGL_glPopMatrix ();
glPopMatrix ();
}
@ -1198,10 +1198,10 @@ GL_BuildLightmaps (model_t **models, int num_models)
lightmap_rectchange[i].t = BLOCK_HEIGHT;
lightmap_rectchange[i].w = 0;
lightmap_rectchange[i].h = 0;
QFGL_glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
glBindTexture (GL_TEXTURE_2D, lightmap_textures + i);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexImage2D (GL_TEXTURE_2D, 0, lightmap_bytes, BLOCK_WIDTH,
BLOCK_HEIGHT, 0, gl_lightmap_format,
GL_UNSIGNED_BYTE, lightmaps[i]);
}

View File

@ -582,7 +582,7 @@ SCR_ScreenShot (int width, int height)
if (!tex)
return 0;
QFGL_glReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE,
glReadPixels (glx, gly, vid.width, vid.height, GL_RGB, GL_UNSIGNED_BYTE,
tex->data + vid.width * vid.height);
w = (vid.width < width) ? vid.width : width;
@ -653,7 +653,7 @@ SCR_ScreenShot_f (void)
return;
}
buffer = malloc (glwidth * glheight * 3);
QFGL_glReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE,
glReadPixels (glx, gly, glwidth, glheight, GL_BGR_EXT, GL_UNSIGNED_BYTE,
buffer);
WriteTGAfile (pcxname, buffer, glwidth, glheight);
free (buffer);
@ -892,33 +892,33 @@ SCR_UpdateScreen (double realtime, SCR_Func *scr_funcs, int swap)
}
// also makes polyblend apply to whole screen
QFGL_glDisable (GL_TEXTURE_2D);
glDisable (GL_TEXTURE_2D);
if (v_blend[3]) {
QFGL_glBegin (GL_QUADS);
glBegin (GL_QUADS);
QFGL_glColor4fv (v_blend);
QFGL_glVertex2f (0, 0);
QFGL_glVertex2f (vid.width, 0);
QFGL_glVertex2f (vid.width, vid.height);
QFGL_glVertex2f (0, vid.height);
glColor4fv (v_blend);
glVertex2f (0, 0);
glVertex2f (vid.width, 0);
glVertex2f (vid.width, vid.height);
glVertex2f (0, vid.height);
QFGL_glEnd ();
QFGL_glColor3ubv (lighthalf_v);
glEnd ();
glColor3ubv (lighthalf_v);
}
QFGL_glEnable (GL_TEXTURE_2D);
glEnable (GL_TEXTURE_2D);
V_UpdatePalette ();
if (r_speeds->int_val) {
// QFGL_glFinish ();
// glFinish ();
time2 = Sys_DoubleTime ();
Con_Printf ("%3i ms %4i wpoly %4i epoly\n",
(int) ((time2 - time1) * 1000), c_brush_polys,
c_alias_polys);
}
QFGL_glFinish ();
glFinish ();
GL_EndRendering ();
}

View File

@ -137,12 +137,12 @@ build_skin_32 (byte * original, int tinwidth, int tinheight,
}
}
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, samples,
glTexImage2D (GL_TEXTURE_2D, 0, samples,
scaled_width, scaled_height, 0, GL_RGBA,
GL_UNSIGNED_BYTE, pixels);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
static void
@ -153,7 +153,7 @@ build_skin (int texnum, byte *ptexels, int width, int height,
// because this happens during gameplay, do it fast
// instead of sending it through GL_Upload8()
QFGL_glBindTexture (GL_TEXTURE_2D, texnum);
glBindTexture (GL_TEXTURE_2D, texnum);
// FIXME deek: This 512x256 limit sucks!
scaled_width = min (gl_max_size->int_val, 512);

View File

@ -84,7 +84,7 @@ R_LoadSkys (const char *skyname)
for (i = 0; i < 6; i++) {
byte *targa_rgba;
QFGL_glBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
glBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
snprintf (name, sizeof (name), "env/%s%s.tga", skyname, suf[i]);
COM_FOpenFile (name, &f);
if (!f) {
@ -94,13 +94,13 @@ R_LoadSkys (const char *skyname)
}
targa_rgba = LoadTGA (f);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA,
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 256, 256, 0, GL_RGBA,
GL_UNSIGNED_BYTE, targa_rgba);
free (targa_rgba);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}
if (!skyloaded)
Con_Printf ("Unable to load skybox %s, using normal sky\n", skyname);
@ -113,8 +113,8 @@ R_SkyBoxPolyVec (vec5_t v)
// avoid interpolation seams
// s = s * (254.0/256.0) + (1.0/256.0);
// t = t * (254.0/256.0) + (1.0/256.0);
QFGL_glTexCoord2fv (v);
QFGL_glVertex3f (r_refdef.vieworg[0] + v[2],
glTexCoord2fv (v);
glVertex3f (r_refdef.vieworg[0] + v[2],
r_refdef.vieworg[1] + v[3], r_refdef.vieworg[2] + v[4]);
}
@ -172,18 +172,18 @@ R_DrawSkyBox (void)
{
int i, j;
QFGL_glDisable (GL_DEPTH_TEST);
QFGL_glDepthRange (gldepthmax, gldepthmax);
glDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax);
for (i = 0; i < 6; i++) {
QFGL_glBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
QFGL_glBegin (GL_QUADS);
glBindTexture (GL_TEXTURE_2D, SKY_TEX + i);
glBegin (GL_QUADS);
for (j = 0; j < 4; j++)
R_SkyBoxPolyVec (skyvec[i][j]);
QFGL_glEnd ();
glEnd ();
}
QFGL_glEnable (GL_DEPTH_TEST);
QFGL_glDepthRange (gldepthmin, gldepthmax);
glEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax);
}
@ -202,9 +202,9 @@ R_DrawSkyLayer (float s)
a2x = bubble_costable[(a + 1) * 2] * domescale[0];
a2y = -bubble_sintable[(a + 1) * 2] * domescale[1];
QFGL_glBegin (GL_TRIANGLE_STRIP);
QFGL_glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
QFGL_glVertex3f (r_refdef.vieworg[0],
glBegin (GL_TRIANGLE_STRIP);
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] + domescale[2]);
for (b = 1; b < 8; b++) {
x = bubble_costable[b * 2 + 16];
@ -213,23 +213,23 @@ R_DrawSkyLayer (float s)
v[0] = a1x * x;
v[1] = a1y * x;
v[2] = y * domescale[2];
QFGL_glTexCoord2f ((v[0] + s) * (1.0 / 128.0),
glTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0));
QFGL_glVertex3f (v[0] + r_refdef.vieworg[0],
glVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
v[0] = a2x * x;
v[1] = a2y * x;
v[2] = y * domescale[2];
QFGL_glTexCoord2f ((v[0] + s) * (1.0 / 128.0),
glTexCoord2f ((v[0] + s) * (1.0 / 128.0),
(v[1] + s) * (1.0 / 128.0));
QFGL_glVertex3f (v[0] + r_refdef.vieworg[0],
glVertex3f (v[0] + r_refdef.vieworg[0],
v[1] + r_refdef.vieworg[1], v[2] + r_refdef.vieworg[2]);
}
QFGL_glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
QFGL_glVertex3f (r_refdef.vieworg[0],
glTexCoord2f (0.5 + s * (1.0 / 128.0), 0.5 + s * (1.0 / 128.0));
glVertex3f (r_refdef.vieworg[0],
r_refdef.vieworg[1], r_refdef.vieworg[2] - domescale[2]);
QFGL_glEnd ();
glEnd ();
}
}
@ -237,24 +237,24 @@ R_DrawSkyLayer (float s)
void
R_DrawSkyDome (void)
{
QFGL_glDisable (GL_DEPTH_TEST);
QFGL_glDepthRange (gldepthmax, gldepthmax);
glDisable (GL_DEPTH_TEST);
glDepthRange (gldepthmax, gldepthmax);
QFGL_glDisable (GL_BLEND);
glDisable (GL_BLEND);
// base sky
QFGL_glBindTexture (GL_TEXTURE_2D, solidskytexture);
glBindTexture (GL_TEXTURE_2D, solidskytexture);
domescale[0] = 512;
domescale[1] = 512;
domescale[2] = 128;
speedscale = r_realtime * 8;
speedscale -= (int) speedscale & ~127;
R_DrawSkyLayer (speedscale);
QFGL_glEnable (GL_BLEND);
glEnable (GL_BLEND);
// clouds
if (gl_skymultipass->int_val) {
QFGL_glBindTexture (GL_TEXTURE_2D, alphaskytexture);
glBindTexture (GL_TEXTURE_2D, alphaskytexture);
domescale[0] = 512;
domescale[1] = 512;
domescale[2] = 128;
@ -263,8 +263,8 @@ R_DrawSkyDome (void)
R_DrawSkyLayer (speedscale);
}
QFGL_glEnable (GL_DEPTH_TEST);
QFGL_glDepthRange (gldepthmin, gldepthmax);
glEnable (GL_DEPTH_TEST);
glDepthRange (gldepthmin, gldepthmax);
}
@ -317,11 +317,11 @@ R_InitSky (texture_t *mt)
if (!solidskytexture)
solidskytexture = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, solidskytexture);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
glBindTexture (GL_TEXTURE_2D, solidskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_solid_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
for (i = 0; i < 128; i++)
@ -335,9 +335,9 @@ R_InitSky (texture_t *mt)
if (!alphaskytexture)
alphaskytexture = texture_extension_number++;
QFGL_glBindTexture (GL_TEXTURE_2D, alphaskytexture);
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
glBindTexture (GL_TEXTURE_2D, alphaskytexture);
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 128, 128, 0, GL_RGBA,
GL_UNSIGNED_BYTE, trans);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
}

View File

@ -593,13 +593,13 @@ render_box (struct box_def *box)
for (i = 0; i < 6; i++) {
if (box->face[i].poly.numverts <= 2)
continue;
QFGL_glBindTexture (GL_TEXTURE_2D, box->face[i].tex);
QFGL_glBegin (GL_POLYGON);
glBindTexture (GL_TEXTURE_2D, box->face[i].tex);
glBegin (GL_POLYGON);
for (j = 0; j < box->face[i].poly.numverts; j++) {
QFGL_glTexCoord2fv (box->face[i].poly.verts[j] + 3);
QFGL_glVertex3fv (box->face[i].poly.verts[j]);
glTexCoord2fv (box->face[i].poly.verts[j] + 3);
glVertex3fv (box->face[i].poly.verts[j]);
}
QFGL_glEnd ();
glEnd ();
}
}
@ -668,11 +668,11 @@ R_DrawSkyDomePoly (glpoly_t *poly)
{
int i;
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
for (i = 0; i < poly->numverts; i++) {
QFGL_glVertex3fv (poly->verts[i]);
glVertex3fv (poly->verts[i]);
}
QFGL_glEnd ();
glEnd ();
}
void
@ -681,7 +681,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
msurface_t *sc = sky_chain;
if (skyloaded) {
QFGL_glDepthRange (gldepthmax, gldepthmax);
glDepthRange (gldepthmax, gldepthmax);
while (sc) {
glpoly_t *p = sc->polys;
@ -691,11 +691,11 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
sc = sc->texturechain;
}
QFGL_glDepthRange (gldepthmin, gldepthmax);
glDepthRange (gldepthmin, gldepthmax);
} else {
QFGL_glDisable (GL_BLEND);
QFGL_glDisable (GL_TEXTURE_2D);
QFGL_glColor3f (0, 0, 0);
glDisable (GL_BLEND);
glDisable (GL_TEXTURE_2D);
glColor3f (0, 0, 0);
while (sc) {
glpoly_t *p = sc->polys;
@ -705,51 +705,51 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
sc = sc->texturechain;
}
QFGL_glEnable (GL_TEXTURE_2D);
QFGL_glEnable (GL_BLEND);
glEnable (GL_TEXTURE_2D);
glEnable (GL_BLEND);
}
#if 0
// seems to work, but this is the wrong place to do it.
QFGL_glColor4f (1,1,1,0);
glColor4f (1,1,1,0);
sc = sky_chain;
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
int i;
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
for (i = 0; i < p->numverts; i++) {
QFGL_glVertex3fv (p->verts[i]);
glVertex3fv (p->verts[i]);
}
QFGL_glEnd ();
glEnd ();
p = p->next;
}
sc = sc->texturechain;
}
#endif
QFGL_glColor3ubv (lighthalf_v);
glColor3ubv (lighthalf_v);
#if 0
QFGL_glDisable (GL_TEXTURE_2D);
glDisable (GL_TEXTURE_2D);
sc = sky_chain;
QFGL_glColor3f (1, 1, 1);
glColor3f (1, 1, 1);
while (sc) {
glpoly_t *p = sc->polys;
while (p) {
int i;
QFGL_glBegin (GL_LINE_LOOP);
glBegin (GL_LINE_LOOP);
for (i = 0; i < p->numverts; i++) {
QFGL_glVertex3fv (p->verts[i]);
glVertex3fv (p->verts[i]);
}
QFGL_glEnd ();
glEnd ();
p = p->next;
}
sc = sc->texturechain;
}
sc = sky_chain;
QFGL_glColor3f (0, 1, 0);
QFGL_glBegin (GL_POINTS);
glColor3f (0, 1, 0);
glBegin (GL_POINTS);
while (sc) {
glpoly_t *p = sc->polys;
@ -763,29 +763,29 @@ R_DrawSkyChain (msurface_t *sky_chain)
}
VectorScale (c, 1.0 / p->numverts, c);
VectorAdd (c, r_refdef.vieworg, c);
QFGL_glVertex3fv (c);
glVertex3fv (c);
p = p->next;
}
sc = sc->texturechain;
}
QFGL_glEnd ();
glEnd ();
if (skyloaded) {
int i, j;
QFGL_glColor3f (1, 0, 0);
glColor3f (1, 0, 0);
for (i = 0; i < 6; i++) {
vec3_t v;
QFGL_glBegin (GL_LINE_LOOP);
glBegin (GL_LINE_LOOP);
for (j = 0; j < 4; j++) {
memcpy (v, &skyvec[i][j][2], sizeof (v));
VectorAdd (v, r_refdef.vieworg, v);
QFGL_glVertex3fv (v);
glVertex3fv (v);
}
QFGL_glEnd ();
glEnd ();
}
}
QFGL_glColor3ubv (lighthalf_v);
QFGL_glEnable (GL_TEXTURE_2D);
glColor3ubv (lighthalf_v);
glEnable (GL_TEXTURE_2D);
#endif
}

View File

@ -213,10 +213,10 @@ GL_TextureMode_f (void)
// change all the existing mipmap texture objects
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) {
if (glt->mipmap) {
QFGL_glBindTexture (GL_TEXTURE_2D, glt->texnum);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
glBindTexture (GL_TEXTURE_2D, glt->texnum);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
gl_filter_min);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
gl_filter_max);
}
}
@ -395,7 +395,7 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
scaled_height);
}
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0,
glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0,
GL_RGBA, GL_UNSIGNED_BYTE, scaled);
if (mipmap) {
@ -408,20 +408,20 @@ GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
scaled_width = max (scaled_width, 1);
scaled_height = max (scaled_height, 1);
miplevel++;
QFGL_glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width,
glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width,
scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
}
}
if (mipmap) {
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} else {
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
if (gl_picmip->int_val)
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
else
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
free (scaled);
@ -463,7 +463,7 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
GL_Resample8BitTexture (data, width, height, scaled, scaled_width,
scaled_height);
}
QFGL_glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width,
glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width,
scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled);
if (mipmap) {
@ -477,21 +477,21 @@ GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
scaled_width = max (scaled_width, 1);
scaled_height = max (scaled_height, 1);
miplevel++;
QFGL_glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT,
glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT,
scaled_width, scaled_height, 0, GL_COLOR_INDEX,
GL_UNSIGNED_BYTE, scaled);
}
}
if (mipmap) {
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
} else {
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
if (gl_picmip->int_val)
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
else
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
}
free (scaled);
@ -588,7 +588,7 @@ SetupTexture:
glt->bytesperpixel = bytesperpixel;
glt->mipmap = mipmap;
QFGL_glBindTexture (GL_TEXTURE_2D, glt->texnum);
glBindTexture (GL_TEXTURE_2D, glt->texnum);
switch (glt->bytesperpixel) {
case 1:

View File

@ -208,7 +208,7 @@ EmitWaterPolys (msurface_t *fa)
vec3_t nv;
for (p = fa->polys; p; p = p->next) {
QFGL_glBegin (GL_POLYGON);
glBegin (GL_POLYGON);
for (i = 0, v = p->verts[0]; i < p->numverts; i++, v += VERTEXSIZE) {
os = v[3];
ot = v[4];
@ -219,7 +219,7 @@ EmitWaterPolys (msurface_t *fa)
t = ot + turbsin[(int) ((os * 0.125 + r_realtime) * TURBSCALE) & 255];
t *= (1.0 / 64);
QFGL_glTexCoord2f (s, t);
glTexCoord2f (s, t);
VectorCopy (v, nv);
nv[2] += r_waterripple->value
@ -227,8 +227,8 @@ EmitWaterPolys (msurface_t *fa)
* turbsin[(int) ((v[4] * 0.125 + r_realtime) * TURBSCALE) & 255]
* (1.0 / 64.0);
QFGL_glVertex3fv (nv);
glVertex3fv (nv);
}
QFGL_glEnd ();
glEnd ();
}
}

View File

@ -58,7 +58,7 @@
#include "QF/qtypes.h"
#include "QF/GL/qf_ext.h"
#include "QF/GL/extensions.h"
#include "QF/GL/funcs.h"
/*
@ -98,7 +98,7 @@ QFGL_ExtensionPresent (const char *name)
static const GLubyte *gl_extensions = NULL;
if (!gl_extensions) { // get and save GL extension list
gl_extensions = QFGL_glGetString (GL_EXTENSIONS);
gl_extensions = glGetString (GL_EXTENSIONS);
}
return QFGL_ParseExtensionList (gl_extensions, name);

View File

@ -143,7 +143,7 @@ GL_Init (void)
void
GL_EndRendering (void)
{
QFGL_glFlush ();
glFlush ();
fxMesaSwapBuffers ();
Sbar_Changed ();
}

View File

@ -54,7 +54,7 @@
#include "QF/vid.h"
#include "QF/sys.h"
#include "QF/GL/qf_ext.h"
#include "QF/GL/extensions.h"
#include "QF/GL/funcs.h"
#include "QF/GL/defines.h"
@ -121,7 +121,7 @@ CheckMultiTextureExtensions (void)
int max_texture_units = 0;
QFGL_glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units);
glGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units);
if (max_texture_units >= 2) {
Con_Printf ("enabled, %d TMUs.\n", max_texture_units);
qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB");
@ -231,36 +231,36 @@ GL_Init_Common (void)
return;
}
gl_vendor = QFGL_glGetString (GL_VENDOR);
gl_vendor = glGetString (GL_VENDOR);
Con_Printf ("GL_VENDOR: %s\n", gl_vendor);
gl_renderer = QFGL_glGetString (GL_RENDERER);
gl_renderer = glGetString (GL_RENDERER);
Con_Printf ("GL_RENDERER: %s\n", gl_renderer);
gl_version = QFGL_glGetString (GL_VERSION);
gl_version = glGetString (GL_VERSION);
Con_Printf ("GL_VERSION: %s\n", gl_version);
gl_extensions = QFGL_glGetString (GL_EXTENSIONS);
gl_extensions = glGetString (GL_EXTENSIONS);
Con_Printf ("GL_EXTENSIONS: %s\n", gl_extensions);
QFGL_glClearColor (0, 0, 0, 0);
QFGL_glCullFace (GL_FRONT);
QFGL_glEnable (GL_TEXTURE_2D);
glClearColor (0, 0, 0, 0);
glCullFace (GL_FRONT);
glEnable (GL_TEXTURE_2D);
QFGL_glEnable (GL_ALPHA_TEST);
QFGL_glAlphaFunc (GL_GREATER, 0.666);
glEnable (GL_ALPHA_TEST);
glAlphaFunc (GL_GREATER, 0.666);
QFGL_glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
glPolygonMode (GL_FRONT_AND_BACK, GL_FILL);
QFGL_glShadeModel (GL_FLAT);
glShadeModel (GL_FLAT);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
QFGL_glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
QFGL_glEnable (GL_BLEND);
QFGL_glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
QFGL_glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
CheckMultiTextureExtensions ();
}
@ -315,7 +315,7 @@ Tdfx_Init8bitPalette (void)
table[i][3] = 255;
oldpal++;
}
QFGL_glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
qgl3DfxSetPaletteEXT ((GLuint *) table);
is8bit = true;
} else {
@ -351,7 +351,7 @@ Shared_Init8bitPalette (void)
Con_Printf ("GL_EXT_shared_texture_palette\n");
QFGL_glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
glEnable (GL_SHARED_TEXTURE_PALETTE_EXT);
oldPalette = (GLubyte *) d_8to24table; // d_8to24table3dfx;
newPalette = thePalette;
for (i = 0; i < 256; i++) {

View File

@ -148,7 +148,7 @@ GL_Init (void)
void
GL_EndRendering (void)
{
QFGL_glFlush ();
glFlush ();
QFGLX_glXSwapBuffers (x_disp, x_win);
Sbar_Changed ();
}

View File

@ -142,7 +142,7 @@ GL_Init (void)
void
GL_EndRendering (void)
{
QFGL_glFlush ();
glFlush ();
SDL_GL_SwapBuffers ();
Sbar_Changed ();
}