mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
start working on VA support for borked GL libs
This commit is contained in:
parent
abe657ea12
commit
6a8469df14
3 changed files with 685 additions and 49 deletions
|
@ -56,37 +56,37 @@ QFGL_NEED (void, glClearIndex, (GLfloat c))
|
|||
QFGL_NEED (void, glClearStencil, (GLint s))
|
||||
QFGL_DONT_NEED (void, glClipPlane, (GLenum plane, const GLdouble * equation))
|
||||
QFGL_DONT_NEED (void, glColor3b, (GLbyte red, GLbyte green, GLbyte blue))
|
||||
QFGL_DONT_NEED (void, glColor3bv, (const GLbyte * v))
|
||||
QFGL_NEED (void, glColor3bv, (const GLbyte * v))
|
||||
QFGL_DONT_NEED (void, glColor3d, (GLdouble red, GLdouble green, GLdouble blue))
|
||||
QFGL_DONT_NEED (void, glColor3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glColor3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glColor3f, (GLfloat red, GLfloat green, GLfloat blue))
|
||||
QFGL_NEED (void, glColor3fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glColor3i, (GLint red, GLint green, GLint blue))
|
||||
QFGL_DONT_NEED (void, glColor3iv, (const GLint * v))
|
||||
QFGL_NEED (void, glColor3iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glColor3s, (GLshort red, GLshort green, GLshort blue))
|
||||
QFGL_DONT_NEED (void, glColor3sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glColor3sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glColor3ub, (GLubyte red, GLubyte green, GLubyte blue))
|
||||
QFGL_NEED (void, glColor3ubv, (const GLubyte * v))
|
||||
QFGL_DONT_NEED (void, glColor3ui, (GLuint red, GLuint green, GLuint blue))
|
||||
QFGL_DONT_NEED (void, glColor3uiv, (const GLuint * v))
|
||||
QFGL_NEED (void, glColor3uiv, (const GLuint * v))
|
||||
QFGL_DONT_NEED (void, glColor3us, (GLushort red, GLushort green, GLushort blue))
|
||||
QFGL_DONT_NEED (void, glColor3usv, (const GLushort * v))
|
||||
QFGL_NEED (void, glColor3usv, (const GLushort * v))
|
||||
QFGL_DONT_NEED (void, glColor4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha))
|
||||
QFGL_DONT_NEED (void, glColor4bv, (const GLbyte * v))
|
||||
QFGL_NEED (void, glColor4bv, (const GLbyte * v))
|
||||
QFGL_DONT_NEED (void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha))
|
||||
QFGL_DONT_NEED (void, glColor4dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glColor4dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha))
|
||||
QFGL_NEED (void, glColor4fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glColor4i, (GLint red, GLint green, GLint blue, GLint alpha))
|
||||
QFGL_DONT_NEED (void, glColor4iv, (const GLint * v))
|
||||
QFGL_NEED (void, glColor4iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glColor4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha))
|
||||
QFGL_DONT_NEED (void, glColor4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glColor4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha))
|
||||
QFGL_NEED (void, glColor4ubv, (const GLubyte * v))
|
||||
QFGL_DONT_NEED (void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha))
|
||||
QFGL_DONT_NEED (void, glColor4uiv, (const GLuint * v))
|
||||
QFGL_NEED (void, glColor4uiv, (const GLuint * v))
|
||||
QFGL_DONT_NEED (void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha))
|
||||
QFGL_DONT_NEED (void, glColor4usv, (const GLushort * v))
|
||||
QFGL_NEED (void, glColor4usv, (const GLushort * v))
|
||||
QFGL_NEED (void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha))
|
||||
QFGL_DONT_NEED (void, glColorMaterial, (GLenum face, GLenum mode))
|
||||
QFGL_NEED (void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr))
|
||||
|
@ -125,7 +125,7 @@ QFGL_DONT_NEED (void, glDrawPixels, (GLsizei width, GLsizei height, GLenum forma
|
|||
QFGL_DONT_NEED (void, glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid * indices))
|
||||
QFGL_DONT_NEED (void, glEdgeFlag, (GLboolean flag))
|
||||
QFGL_DONT_NEED (void, glEdgeFlagPointer, (GLsizei stride, const GLvoid * ptr))
|
||||
QFGL_DONT_NEED (void, glEdgeFlagv, (const GLboolean * flag))
|
||||
QFGL_NEED (void, glEdgeFlagv, (const GLboolean * flag))
|
||||
QFGL_NEED (void, glEnable, (GLenum cap))
|
||||
QFGL_NEED (void, glEnableClientState, (GLenum cap))
|
||||
QFGL_NEED (void, glEnd, (void))
|
||||
|
@ -200,15 +200,15 @@ QFGL_DONT_NEED (void, glHistogram, (GLenum target, GLsizei width, GLenum interna
|
|||
QFGL_DONT_NEED (void, glIndexMask, (GLuint mask))
|
||||
QFGL_DONT_NEED (void, glIndexPointer, (GLenum type, GLsizei stride, const GLvoid * ptr))
|
||||
QFGL_DONT_NEED (void, glIndexd, (GLdouble c))
|
||||
QFGL_DONT_NEED (void, glIndexdv, (const GLdouble * c))
|
||||
QFGL_NEED (void, glIndexdv, (const GLdouble * c))
|
||||
QFGL_DONT_NEED (void, glIndexf, (GLfloat c))
|
||||
QFGL_DONT_NEED (void, glIndexfv, (const GLfloat * c))
|
||||
QFGL_NEED (void, glIndexfv, (const GLfloat * c))
|
||||
QFGL_DONT_NEED (void, glIndexi, (GLint c))
|
||||
QFGL_DONT_NEED (void, glIndexiv, (const GLint * c))
|
||||
QFGL_NEED (void, glIndexiv, (const GLint * c))
|
||||
QFGL_DONT_NEED (void, glIndexs, (GLshort c))
|
||||
QFGL_DONT_NEED (void, glIndexsv, (const GLshort * c))
|
||||
QFGL_NEED (void, glIndexsv, (const GLshort * c))
|
||||
QFGL_DONT_NEED (void, glIndexub, (GLubyte c))
|
||||
QFGL_DONT_NEED (void, glIndexubv, (const GLubyte * c))
|
||||
QFGL_NEED (void, glIndexubv, (const GLubyte * c))
|
||||
QFGL_DONT_NEED (void, glInitNames, (void))
|
||||
QFGL_NEED (void, glInterleavedArrays, (GLenum format, GLsizei stride, const GLvoid * pointer))
|
||||
QFGL_DONT_NEED (GLboolean, glIsEnabled, (GLenum cap))
|
||||
|
@ -248,15 +248,15 @@ QFGL_DONT_NEED (void, glMultMatrixd, (const GLdouble * m))
|
|||
QFGL_DONT_NEED (void, glMultMatrixf, (const GLfloat * m))
|
||||
QFGL_NEED (void, glNewList, (GLuint list, GLenum mode))
|
||||
QFGL_DONT_NEED (void, glNormal3b, (GLbyte nx, GLbyte ny, GLbyte nz))
|
||||
QFGL_DONT_NEED (void, glNormal3bv, (const GLbyte * v))
|
||||
QFGL_NEED (void, glNormal3bv, (const GLbyte * v))
|
||||
QFGL_DONT_NEED (void, glNormal3d, (GLdouble nx, GLdouble ny, GLdouble nz))
|
||||
QFGL_DONT_NEED (void, glNormal3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glNormal3dv, (const GLdouble * v))
|
||||
QFGL_DONT_NEED (void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz))
|
||||
QFGL_DONT_NEED (void, glNormal3fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glNormal3fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glNormal3i, (GLint nx, GLint ny, GLint nz))
|
||||
QFGL_DONT_NEED (void, glNormal3iv, (const GLint * v))
|
||||
QFGL_NEED (void, glNormal3iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glNormal3s, (GLshort nx, GLshort ny, GLshort nz))
|
||||
QFGL_DONT_NEED (void, glNormal3sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glNormal3sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid * ptr))
|
||||
QFGL_NEED (void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble near_val, GLdouble far_val))
|
||||
QFGL_DONT_NEED (void, glPassThrough, (GLfloat token))
|
||||
|
@ -330,37 +330,37 @@ QFGL_DONT_NEED (void, glStencilFunc, (GLenum func, GLint ref, GLuint mask))
|
|||
QFGL_DONT_NEED (void, glStencilMask, (GLuint mask))
|
||||
QFGL_DONT_NEED (void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass))
|
||||
QFGL_DONT_NEED (void, glTexCoord1d, (GLdouble s))
|
||||
QFGL_DONT_NEED (void, glTexCoord1dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord1dv, (const GLdouble * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord1f, (GLfloat s))
|
||||
QFGL_DONT_NEED (void, glTexCoord1fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glTexCoord1fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord1i, (GLint s))
|
||||
QFGL_DONT_NEED (void, glTexCoord1iv, (const GLint * v))
|
||||
QFGL_NEED (void, glTexCoord1iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord1s, (GLshort s))
|
||||
QFGL_DONT_NEED (void, glTexCoord1sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glTexCoord1sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord2d, (GLdouble s, GLdouble t))
|
||||
QFGL_DONT_NEED (void, glTexCoord2dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord2dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord2f, (GLfloat s, GLfloat t))
|
||||
QFGL_NEED (void, glTexCoord2fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord2i, (GLint s, GLint t))
|
||||
QFGL_DONT_NEED (void, glTexCoord2iv, (const GLint * v))
|
||||
QFGL_NEED (void, glTexCoord2iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord2s, (GLshort s, GLshort t))
|
||||
QFGL_DONT_NEED (void, glTexCoord2sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glTexCoord2sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord3d, (GLdouble s, GLdouble t, GLdouble r))
|
||||
QFGL_DONT_NEED (void, glTexCoord3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord3f, (GLfloat s, GLfloat t, GLfloat r))
|
||||
QFGL_DONT_NEED (void, glTexCoord3fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glTexCoord3fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord3i, (GLint s, GLint t, GLint r))
|
||||
QFGL_DONT_NEED (void, glTexCoord3iv, (const GLint * v))
|
||||
QFGL_NEED (void, glTexCoord3iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord3s, (GLshort s, GLshort t, GLshort r))
|
||||
QFGL_DONT_NEED (void, glTexCoord3sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glTexCoord3sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q))
|
||||
QFGL_DONT_NEED (void, glTexCoord4dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glTexCoord4dv, (const GLdouble * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q))
|
||||
QFGL_DONT_NEED (void, glTexCoord4fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glTexCoord4fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord4i, (GLint s, GLint t, GLint r, GLint q))
|
||||
QFGL_DONT_NEED (void, glTexCoord4iv, (const GLint * v))
|
||||
QFGL_NEED (void, glTexCoord4iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glTexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q))
|
||||
QFGL_DONT_NEED (void, glTexCoord4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glTexCoord4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr))
|
||||
QFGL_NEED (void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param))
|
||||
QFGL_NEED (void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat * params))
|
||||
|
@ -385,29 +385,29 @@ QFGL_DONT_NEED (void, glTexSubImage3D, (GLenum target, GLint level, GLint xoffse
|
|||
QFGL_DONT_NEED (void, glTranslated, (GLdouble x, GLdouble y, GLdouble z))
|
||||
QFGL_NEED (void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z))
|
||||
QFGL_DONT_NEED (void, glVertex2d, (GLdouble x, GLdouble y))
|
||||
QFGL_DONT_NEED (void, glVertex2dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glVertex2dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glVertex2f, (GLfloat x, GLfloat y))
|
||||
QFGL_NEED (void, glVertex2fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glVertex2i, (GLint x, GLint y))
|
||||
QFGL_DONT_NEED (void, glVertex2iv, (const GLint * v))
|
||||
QFGL_NEED (void, glVertex2iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glVertex2s, (GLshort x, GLshort y))
|
||||
QFGL_DONT_NEED (void, glVertex2sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glVertex2sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glVertex3d, (GLdouble x, GLdouble y, GLdouble z))
|
||||
QFGL_DONT_NEED (void, glVertex3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glVertex3dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z))
|
||||
QFGL_NEED (void, glVertex3fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glVertex3i, (GLint x, GLint y, GLint z))
|
||||
QFGL_DONT_NEED (void, glVertex3iv, (const GLint * v))
|
||||
QFGL_NEED (void, glVertex3iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glVertex3s, (GLshort x, GLshort y, GLshort z))
|
||||
QFGL_DONT_NEED (void, glVertex3sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glVertex3sv, (const GLshort * v))
|
||||
QFGL_DONT_NEED (void, glVertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w))
|
||||
QFGL_DONT_NEED (void, glVertex4dv, (const GLdouble * v))
|
||||
QFGL_NEED (void, glVertex4dv, (const GLdouble * v))
|
||||
QFGL_DONT_NEED (void, glVertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w))
|
||||
QFGL_DONT_NEED (void, glVertex4fv, (const GLfloat * v))
|
||||
QFGL_NEED (void, glVertex4fv, (const GLfloat * v))
|
||||
QFGL_DONT_NEED (void, glVertex4i, (GLint x, GLint y, GLint z, GLint w))
|
||||
QFGL_DONT_NEED (void, glVertex4iv, (const GLint * v))
|
||||
QFGL_NEED (void, glVertex4iv, (const GLint * v))
|
||||
QFGL_DONT_NEED (void, glVertex4s, (GLshort x, GLshort y, GLshort z, GLshort w))
|
||||
QFGL_DONT_NEED (void, glVertex4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glVertex4sv, (const GLshort * v))
|
||||
QFGL_NEED (void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid * ptr))
|
||||
QFGL_NEED (void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height))
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ libvid_sw32_la_SOURCES= vid_common_sw32.c
|
|||
libvid_sw32_la_CFLAGS= @PREFER_NON_PIC@
|
||||
libvid_sw32_la_LDFLAGS= -static
|
||||
|
||||
libvid_gl_la_SOURCES= vid_common_gl.c qfgl_ext.c
|
||||
libvid_gl_la_SOURCES= vid_common_gl.c qfgl_ext.c vtxarray.c
|
||||
libvid_gl_la_CFLAGS= @PREFER_NON_PIC@
|
||||
libvid_gl_la_LDFLAGS= -static
|
||||
|
||||
|
|
636
libs/video/targets/vtxarray.c
Normal file
636
libs/video/targets/vtxarray.c
Normal file
|
@ -0,0 +1,636 @@
|
|||
#include "QF/sys.h"
|
||||
|
||||
#include "QF/GL/defines.h"
|
||||
#include "QF/GL/funcs.h"
|
||||
|
||||
typedef void (*qfgl_func_t) (const GLvoid *);
|
||||
|
||||
static const GLvoid *color_pointer;
|
||||
static GLsizei color_stride;
|
||||
static qfgl_func_t color_func;
|
||||
static int color_enabled = 0;
|
||||
|
||||
static const GLvoid *edgeflag_pointer;
|
||||
static GLsizei edgeflag_stride;
|
||||
static int edgeflag_enabled = 0;
|
||||
|
||||
static const GLvoid *index_pointer;
|
||||
static GLsizei index_stride;
|
||||
static qfgl_func_t index_func;
|
||||
static int index_enabled = 0;
|
||||
|
||||
static const GLvoid *normal_pointer;
|
||||
static GLsizei normal_stride;
|
||||
static qfgl_func_t normal_func;
|
||||
static int normal_enabled = 0;
|
||||
|
||||
static const GLvoid *texcoord_pointer;
|
||||
static GLsizei texcoord_stride;
|
||||
static qfgl_func_t texcoord_func;
|
||||
static int texcoord_enabled = 0;
|
||||
|
||||
static const GLvoid *vertex_pointer;
|
||||
static GLsizei vertex_stride;
|
||||
static qfgl_func_t vertex_func;
|
||||
static int vertex_enabled = 0;
|
||||
|
||||
static qfgl_func_t *color_functions[][8] = {
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglColor3bv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3ubv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3sv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3usv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3iv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3uiv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3fv,
|
||||
(qfgl_func_t *) (char *) &qfglColor3dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglColor4bv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4ubv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4sv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4usv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4iv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4uiv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4fv,
|
||||
(qfgl_func_t *) (char *) &qfglColor4dv,
|
||||
},
|
||||
};
|
||||
|
||||
static qfgl_func_t *index_functions[] = {
|
||||
(qfgl_func_t *) (char *) &qfglIndexubv,
|
||||
(qfgl_func_t *) (char *) &qfglIndexsv,
|
||||
(qfgl_func_t *) (char *) &qfglIndexiv,
|
||||
(qfgl_func_t *) (char *) &qfglIndexfv,
|
||||
(qfgl_func_t *) (char *) &qfglIndexdv,
|
||||
};
|
||||
|
||||
static qfgl_func_t *normal_functions[] = {
|
||||
(qfgl_func_t *) (char *) &qfglNormal3bv,
|
||||
(qfgl_func_t *) (char *) &qfglNormal3sv,
|
||||
(qfgl_func_t *) (char *) &qfglNormal3iv,
|
||||
(qfgl_func_t *) (char *) &qfglNormal3fv,
|
||||
(qfgl_func_t *) (char *) &qfglNormal3dv,
|
||||
};
|
||||
|
||||
static qfgl_func_t *texcoord_functions[][4] = {
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord1sv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord1iv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord1fv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord1dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord2sv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord2iv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord2fv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord2dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord3sv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord3iv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord3fv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord3dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord4sv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord4iv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord4fv,
|
||||
(qfgl_func_t *) (char *) &qfglTexCoord4dv,
|
||||
},
|
||||
};
|
||||
|
||||
static qfgl_func_t *vertex_functions[][4] = {
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglVertex2sv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex2iv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex2fv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex2dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglVertex3sv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex3iv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex3fv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex3dv,
|
||||
},
|
||||
{
|
||||
(qfgl_func_t *) (char *) &qfglVertex4sv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex4iv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex4fv,
|
||||
(qfgl_func_t *) (char *) &qfglVertex4dv,
|
||||
},
|
||||
};
|
||||
|
||||
static void
|
||||
qfgl_ColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
int index;
|
||||
int bytes = 0;
|
||||
|
||||
switch (type) {
|
||||
case GL_BYTE:
|
||||
index = 0;
|
||||
bytes = sizeof (GLbyte);
|
||||
break;
|
||||
case GL_UNSIGNED_BYTE:
|
||||
index = 1;
|
||||
bytes = sizeof (GLubyte);
|
||||
break;
|
||||
case GL_SHORT:
|
||||
index = 2;
|
||||
bytes = sizeof (GLshort);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
index = 3;
|
||||
bytes = sizeof (GLushort);
|
||||
break;
|
||||
case GL_INT:
|
||||
index = 4;
|
||||
bytes = sizeof (GLint);
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
index = 5;
|
||||
bytes = sizeof (GLuint);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
index = 6;
|
||||
bytes = sizeof (GLfloat);
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
index = 7;
|
||||
bytes = sizeof (GLdouble);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
color_pointer = ptr;
|
||||
color_stride = stride + size * bytes;
|
||||
color_func = *color_functions[size - 3][index];
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_EdgeFlagPointer (GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
edgeflag_pointer = ptr;
|
||||
edgeflag_stride = stride + sizeof (GLboolean);
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_IndexPointer (GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
int index;
|
||||
int bytes = 0;
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
index = 0;
|
||||
bytes = sizeof (GLubyte);
|
||||
break;
|
||||
case GL_SHORT:
|
||||
index = 1;
|
||||
bytes = sizeof (GLshort);
|
||||
break;
|
||||
case GL_INT:
|
||||
index = 2;
|
||||
bytes = sizeof (GLint);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
index = 3;
|
||||
bytes = sizeof (GLfloat);
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
index = 4;
|
||||
bytes = sizeof (GLdouble);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
index_pointer = ptr;
|
||||
index_stride = stride + bytes;
|
||||
index_func = *index_functions[index];
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_NormalPointer (GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
int index;
|
||||
int bytes = 0;
|
||||
|
||||
switch (type) {
|
||||
case GL_BYTE:
|
||||
index = 0;
|
||||
bytes = sizeof (GLbyte);
|
||||
break;
|
||||
case GL_SHORT:
|
||||
index = 1;
|
||||
bytes = sizeof (GLshort);
|
||||
break;
|
||||
case GL_INT:
|
||||
index = 2;
|
||||
bytes = sizeof (GLint);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
index = 3;
|
||||
bytes = sizeof (GLfloat);
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
index = 4;
|
||||
bytes = sizeof (GLdouble);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
normal_pointer = ptr;
|
||||
normal_stride = stride + bytes;
|
||||
normal_func = *normal_functions[index];
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_TexCoordPointer (GLint size, GLenum type, GLsizei stride,
|
||||
const GLvoid *ptr)
|
||||
{
|
||||
int index;
|
||||
int bytes = 0;
|
||||
|
||||
switch (type) {
|
||||
case GL_SHORT:
|
||||
index = 0;
|
||||
bytes = sizeof (GLshort);
|
||||
break;
|
||||
case GL_INT:
|
||||
index = 1;
|
||||
bytes = sizeof (GLint);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
index = 2;
|
||||
bytes = sizeof (GLfloat);
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
index = 3;
|
||||
bytes = sizeof (GLdouble);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
texcoord_pointer = ptr;
|
||||
texcoord_stride = stride + size * bytes;
|
||||
texcoord_func = *texcoord_functions[size - 1][index];
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_VertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *ptr)
|
||||
{
|
||||
int index;
|
||||
int bytes = 0;
|
||||
|
||||
switch (type) {
|
||||
case GL_SHORT:
|
||||
index = 0;
|
||||
bytes = sizeof (GLshort);
|
||||
break;
|
||||
case GL_INT:
|
||||
index = 1;
|
||||
bytes = sizeof (GLint);
|
||||
break;
|
||||
case GL_FLOAT:
|
||||
index = 2;
|
||||
bytes = sizeof (GLfloat);
|
||||
break;
|
||||
case GL_DOUBLE:
|
||||
index = 3;
|
||||
bytes = sizeof (GLdouble);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
vertex_pointer = ptr;
|
||||
vertex_stride = stride + size * bytes;
|
||||
vertex_func = *vertex_functions[size - 2][index];
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_InterleavedArrays (GLenum format, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
const GLbyte *ptr = pointer;
|
||||
|
||||
switch (format) {
|
||||
case GL_V2F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_V3F:
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_C4UB_V2F:
|
||||
stride += 4 * sizeof (GLubyte);
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_C4UB_V3F:
|
||||
stride += 4 * sizeof (GLubyte);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_C3F_V3F:
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_N3F_V3F:
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_C4F_N3F_V3F:
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T2F_V3F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T4F_V4F:
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T2F_C4UB_V3F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
stride += 4 * sizeof (GLubyte);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T2F_C3F_V3F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T2F_N3F_V3F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T2F_C4F_N3F_V3F:
|
||||
stride += 2 * sizeof (GLfloat);
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T4F_C4F_N3F_V4F:
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
stride += 3 * sizeof (GLfloat);
|
||||
stride += 4 * sizeof (GLfloat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (format) {
|
||||
case GL_T2F_V3F:
|
||||
case GL_T2F_C4UB_V3F:
|
||||
case GL_T2F_C3F_V3F:
|
||||
case GL_T2F_N3F_V3F:
|
||||
case GL_T2F_C4F_N3F_V3F:
|
||||
qfgl_TexCoordPointer (2, GL_FLOAT, stride - 2 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 2 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T4F_V4F:
|
||||
case GL_T4F_C4F_N3F_V4F:
|
||||
qfgl_TexCoordPointer (4, GL_FLOAT, stride - 4 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 4 * sizeof (GLfloat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (format) {
|
||||
case GL_C4UB_V2F:
|
||||
case GL_C4UB_V3F:
|
||||
case GL_T2F_C4UB_V3F:
|
||||
qfgl_ColorPointer (4, GL_UNSIGNED_BYTE,
|
||||
stride - 4 * sizeof (GLubyte), ptr);
|
||||
ptr += 4 * sizeof (GLubyte);
|
||||
break;
|
||||
case GL_C3F_V3F:
|
||||
case GL_T2F_C3F_V3F:
|
||||
qfgl_ColorPointer (3, GL_FLOAT, stride - 3 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_C4F_N3F_V3F:
|
||||
case GL_T2F_C4F_N3F_V3F:
|
||||
case GL_T4F_C4F_N3F_V4F:
|
||||
qfgl_ColorPointer (4, GL_FLOAT, stride - 4 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 4 * sizeof (GLfloat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (format) {
|
||||
case GL_N3F_V3F:
|
||||
case GL_C4F_N3F_V3F:
|
||||
case GL_T2F_N3F_V3F:
|
||||
case GL_T2F_C4F_N3F_V3F:
|
||||
case GL_T4F_C4F_N3F_V4F:
|
||||
qfgl_NormalPointer (GL_FLOAT, stride - 3 * sizeof (GLfloat), ptr);
|
||||
ptr += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (format) {
|
||||
case GL_V2F:
|
||||
case GL_C4UB_V2F:
|
||||
qfgl_VertexPointer (2, GL_FLOAT, stride - 2 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 2 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_V3F:
|
||||
case GL_C4UB_V3F:
|
||||
case GL_C3F_V3F:
|
||||
case GL_N3F_V3F:
|
||||
case GL_C4F_N3F_V3F:
|
||||
case GL_T2F_V3F:
|
||||
case GL_T2F_C4UB_V3F:
|
||||
case GL_T2F_C3F_V3F:
|
||||
case GL_T2F_N3F_V3F:
|
||||
case GL_T2F_C4F_N3F_V3F:
|
||||
qfgl_VertexPointer (3, GL_FLOAT, stride - 3 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 3 * sizeof (GLfloat);
|
||||
break;
|
||||
case GL_T4F_V4F:
|
||||
case GL_T4F_C4F_N3F_V4F:
|
||||
qfgl_VertexPointer (4, GL_FLOAT, stride - 4 * sizeof (GLfloat),
|
||||
ptr);
|
||||
ptr += 4 * sizeof (GLfloat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_ArrayElement (GLint i)
|
||||
{
|
||||
if (texcoord_enabled)
|
||||
texcoord_func (texcoord_pointer + i * texcoord_stride);
|
||||
if (edgeflag_enabled)
|
||||
qfglEdgeFlagv (edgeflag_pointer + i * edgeflag_stride);
|
||||
if (color_enabled)
|
||||
color_func (color_pointer + i * color_stride);
|
||||
if (normal_enabled)
|
||||
normal_func (normal_pointer + i * normal_stride);
|
||||
if (index_enabled)
|
||||
index_func (index_pointer + i * index_stride);
|
||||
if (vertex_enabled)
|
||||
vertex_func (vertex_pointer + i * vertex_stride);
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_DrawArrays (GLenum mode, GLint first, GLsizei count)
|
||||
{
|
||||
GLint i;
|
||||
|
||||
qfglBegin (mode);
|
||||
for (i = first; i < first + count; i++)
|
||||
qfgl_ArrayElement (i);
|
||||
qfglEnd ();
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_DrawElements (GLenum mode, GLsizei count, GLenum type,
|
||||
const GLvoid * indices)
|
||||
{
|
||||
GLsizei i;
|
||||
const GLubyte *ub_indices;
|
||||
const GLushort *us_indices;
|
||||
const GLuint *ui_indices;
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
ub_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
qfgl_ArrayElement (ub_indices[i]);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
us_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
qfgl_ArrayElement (us_indices[i]);
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
ui_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
qfgl_ArrayElement (ui_indices[i]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_DrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count,
|
||||
GLenum type, const GLvoid * indices)
|
||||
{
|
||||
GLsizei i;
|
||||
const GLubyte *ub_indices;
|
||||
const GLushort *us_indices;
|
||||
const GLuint *ui_indices;
|
||||
|
||||
switch (type) {
|
||||
case GL_UNSIGNED_BYTE:
|
||||
ub_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
if (ub_indices[i] >= start && ub_indices[i] <= end)
|
||||
qfgl_ArrayElement (ub_indices[i]);
|
||||
break;
|
||||
case GL_UNSIGNED_SHORT:
|
||||
us_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
if (us_indices[i] >= start && us_indices[i] <= end)
|
||||
qfgl_ArrayElement (us_indices[i]);
|
||||
break;
|
||||
case GL_UNSIGNED_INT:
|
||||
ui_indices = indices;
|
||||
for (i = 0; i < count; i++)
|
||||
if (ui_indices[i] >= start && ui_indices[i] <= end)
|
||||
qfgl_ArrayElement (ui_indices[i]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
client_state (GLenum cap, GLboolean state)
|
||||
{
|
||||
switch (cap) {
|
||||
case GL_VERTEX_ARRAY:
|
||||
vertex_enabled = state;
|
||||
break;
|
||||
case GL_NORMAL_ARRAY:
|
||||
normal_enabled = state;
|
||||
break;
|
||||
case GL_COLOR_ARRAY:
|
||||
color_enabled = state;
|
||||
break;
|
||||
case GL_INDEX_ARRAY:
|
||||
index_enabled = state;
|
||||
break;
|
||||
case GL_TEXTURE_COORD_ARRAY:
|
||||
texcoord_enabled = state;
|
||||
break;
|
||||
case GL_EDGE_FLAG_ARRAY:
|
||||
edgeflag_enabled = state;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_EnableClientState (GLenum cap)
|
||||
{
|
||||
client_state (cap, GL_TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_DisableClientState (GLenum cap)
|
||||
{
|
||||
client_state (cap, GL_FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_GetPointerv (GLenum pname, void **params)
|
||||
{
|
||||
Sys_Error ("GetPointerv not implemented");
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_PopClientAttrib (void)
|
||||
{
|
||||
Sys_Error ("PopClientAttrib not implemented");
|
||||
}
|
||||
|
||||
static void
|
||||
qfgl_PushClientAttrib (GLbitfield mask)
|
||||
{
|
||||
Sys_Error ("PushClientAttrib not implemented");
|
||||
}
|
||||
|
||||
struct {
|
||||
const char *name;
|
||||
void *func;
|
||||
} qfgl_functions [] = {
|
||||
{"glColorPointer", qfgl_ColorPointer},
|
||||
{"glEdgeFlagPointer", qfgl_EdgeFlagPointer},
|
||||
{"glIndexPointer", qfgl_IndexPointer},
|
||||
{"glNormalPointer", qfgl_NormalPointer},
|
||||
{"glTexCoordPointer", qfgl_TexCoordPointer},
|
||||
{"glVertexPointer", qfgl_VertexPointer},
|
||||
{"glInterleavedArrays", qfgl_InterleavedArrays},
|
||||
{"glArrayElement", qfgl_ArrayElement},
|
||||
{"glDrawArrays", qfgl_DrawArrays},
|
||||
{"glDrawElements", qfgl_DrawElements},
|
||||
{"glDrawRangeElements", qfgl_DrawRangeElements},
|
||||
{"glEnableClientState", qfgl_EnableClientState},
|
||||
{"glDisableClientState", qfgl_DisableClientState},
|
||||
{"glGetPointerv", qfgl_GetPointerv},
|
||||
{"glPopClientAttrib", qfgl_PopClientAttrib},
|
||||
{"glPushClientAttrib", qfgl_PushClientAttrib},
|
||||
};
|
Loading…
Reference in a new issue