Quake II RTX doxygen  1.0 dev
fixed.c
Go to the documentation of this file.
1 /*
2 Copyright (C) 1997-2001 Id Software, Inc.
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License along
15 with this program; if not, write to the Free Software Foundation, Inc.,
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 */
18 
19 #include "shared/shared.h"
20 #include "common/common.h"
21 #include "client/video.h"
22 #include "fixed.h"
23 
24 // ==========================================================
25 
26 // OpenGL 3.0 core function
27 PFNGLGENERATEMIPMAPPROC qglGenerateMipmap;
28 
29 // GL_ARB_fragment_program
30 PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB;
31 PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
32 PFNGLDELETEPROGRAMSARBPROC qglDeleteProgramsARB;
33 PFNGLGENPROGRAMSARBPROC qglGenProgramsARB;
34 PFNGLPROGRAMENVPARAMETER4FVARBPROC qglProgramEnvParameter4fvARB;
35 PFNGLPROGRAMLOCALPARAMETER4FVARBPROC qglProgramLocalParameter4fvARB;
36 
37 // GL_ARB_multitexture
38 PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB;
39 PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB;
40 
41 // GL_ARB_vertex_buffer_object
42 PFNGLBINDBUFFERARBPROC qglBindBufferARB;
43 PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB;
44 PFNGLGENBUFFERSARBPROC qglGenBuffersARB;
45 PFNGLBUFFERDATAARBPROC qglBufferDataARB;
46 PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB;
47 
48 // GL_EXT_compiled_vertex_array
49 PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
50 PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
51 
52 // ==========================================================
53 
54 void QGL_ShutdownExtensions(unsigned mask)
55 {
56  if (mask & QGL_ARB_fragment_program) {
57  qglProgramStringARB = NULL;
58  qglBindProgramARB = NULL;
59  qglDeleteProgramsARB = NULL;
60  qglGenProgramsARB = NULL;
63  }
64 
65  if (mask & QGL_ARB_multitexture) {
66  qglActiveTextureARB = NULL;
68  }
69 
70  if (mask & QGL_ARB_vertex_buffer_object) {
71  qglBindBufferARB = NULL;
72  qglDeleteBuffersARB = NULL;
73  qglGenBuffersARB = NULL;
74  qglBufferDataARB = NULL;
75  qglBufferSubDataARB = NULL;
76  }
77 
78  if (mask & QGL_EXT_compiled_vertex_array) {
79  qglLockArraysEXT = NULL;
80  qglUnlockArraysEXT = NULL;
81  }
82 
83  if (mask & QGL_3_0_core_functions) {
84  qglGenerateMipmap = NULL;
85  }
86 }
87 
88 #define GPA(x) VID_GetProcAddr(x)
89 
90 void QGL_InitExtensions(unsigned mask)
91 {
92  if (mask & QGL_ARB_fragment_program) {
93  qglProgramStringARB = GPA("glProgramStringARB");
94  qglBindProgramARB = GPA("glBindProgramARB");
95  qglDeleteProgramsARB = GPA("glDeleteProgramsARB");
96  qglGenProgramsARB = GPA("glGenProgramsARB");
97  qglProgramEnvParameter4fvARB = GPA("glProgramEnvParameter4fvARB");
98  qglProgramLocalParameter4fvARB = GPA("glProgramLocalParameter4fvARB");
99  }
100 
101  if (mask & QGL_ARB_multitexture) {
102  qglActiveTextureARB = GPA("glActiveTextureARB");
103  qglClientActiveTextureARB = GPA("glClientActiveTextureARB");
104  }
105 
106  if (mask & QGL_ARB_vertex_buffer_object) {
107  qglBindBufferARB = GPA("glBindBufferARB");
108  qglDeleteBuffersARB = GPA("glDeleteBuffersARB");
109  qglGenBuffersARB = GPA("glGenBuffersARB");
110  qglBufferDataARB = GPA("glBufferDataARB");
111  qglBufferSubDataARB = GPA("glBufferSubDataARB");
112  }
113 
114  if (mask & QGL_EXT_compiled_vertex_array) {
115  qglLockArraysEXT = GPA("glLockArraysEXT");
116  qglUnlockArraysEXT = GPA("glUnlockArraysEXT");
117  }
118 
119  if (mask & QGL_3_0_core_functions) {
120  qglGenerateMipmap = GPA("glGenerateMipmap");
121  }
122 }
123 
124 #undef GPA
125 
126 unsigned QGL_ParseExtensionString(const char *s)
127 {
128  // must match defines in fixed.h!
129  static const char *const extnames[] = {
130  "GL_ARB_fragment_program",
131  "GL_ARB_multitexture",
132  "GL_ARB_vertex_buffer_object",
133  "GL_EXT_compiled_vertex_array",
134  "GL_EXT_texture_filter_anisotropic",
135  NULL
136  };
137 
138  return Com_ParseExtensionString(s, extnames);
139 }
QGL_3_0_core_functions
#define QGL_3_0_core_functions
Definition: dynamic.h:161
qglClientActiveTextureARB
PFNGLCLIENTACTIVETEXTUREARBPROC qglClientActiveTextureARB
Definition: fixed.c:39
qglBufferSubDataARB
PFNGLBUFFERSUBDATAARBPROC qglBufferSubDataARB
Definition: fixed.c:46
qglGenerateMipmap
PFNGLGENERATEMIPMAPPROC qglGenerateMipmap
Definition: fixed.c:27
qglProgramLocalParameter4fvARB
PFNGLPROGRAMLOCALPARAMETER4FVARBPROC qglProgramLocalParameter4fvARB
Definition: fixed.c:35
qglLockArraysEXT
PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT
Definition: fixed.c:49
qglProgramStringARB
PFNGLPROGRAMSTRINGARBPROC qglProgramStringARB
Definition: fixed.c:30
qglDeleteProgramsARB
PFNGLDELETEPROGRAMSARBPROC qglDeleteProgramsARB
Definition: fixed.c:32
qglDeleteBuffersARB
PFNGLDELETEBUFFERSARBPROC qglDeleteBuffersARB
Definition: fixed.c:43
qglBufferDataARB
PFNGLBUFFERDATAARBPROC qglBufferDataARB
Definition: fixed.c:45
qglGenBuffersARB
PFNGLGENBUFFERSARBPROC qglGenBuffersARB
Definition: fixed.c:44
QGL_ARB_fragment_program
#define QGL_ARB_fragment_program
Definition: dynamic.h:155
qglProgramEnvParameter4fvARB
PFNGLPROGRAMENVPARAMETER4FVARBPROC qglProgramEnvParameter4fvARB
Definition: fixed.c:34
qglActiveTextureARB
PFNGLACTIVETEXTUREARBPROC qglActiveTextureARB
Definition: fixed.c:38
QGL_ARB_vertex_buffer_object
#define QGL_ARB_vertex_buffer_object
Definition: dynamic.h:157
qglGenProgramsARB
PFNGLGENPROGRAMSARBPROC qglGenProgramsARB
Definition: fixed.c:33
fixed.h
qglBindBufferARB
PFNGLBINDBUFFERARBPROC qglBindBufferARB
Definition: fixed.c:42
QGL_ARB_multitexture
#define QGL_ARB_multitexture
Definition: dynamic.h:156
qglUnlockArraysEXT
PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT
Definition: fixed.c:50
GPA
#define GPA(x)
Definition: fixed.c:88
QGL_ParseExtensionString
unsigned QGL_ParseExtensionString(const char *s)
Definition: fixed.c:126
QGL_InitExtensions
void QGL_InitExtensions(unsigned mask)
Definition: fixed.c:90
qglBindProgramARB
PFNGLBINDPROGRAMARBPROC qglBindProgramARB
Definition: fixed.c:31
QGL_ShutdownExtensions
void QGL_ShutdownExtensions(unsigned mask)
Definition: fixed.c:54
QGL_EXT_compiled_vertex_array
#define QGL_EXT_compiled_vertex_array
Definition: dynamic.h:158