d3dx9/tests: Add basic tests for ID3DXRenderToEnvMap.
[wine/multimedia.git] / dlls / wined3d / gl_compat.c
blobcd22097b6e64626ce598fcb3bc76a134d76fe388
1 /*
2 * Compatibility functions for older GL implementations
4 * Copyright 2008 Stefan Dösinger for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
22 #include "wine/port.h"
24 #include <stdio.h>
25 #ifdef HAVE_FLOAT_H
26 # include <float.h>
27 #endif
29 #include "wined3d_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(gl_compat);
33 /* Start GL_ARB_multitexture emulation */
34 static void WINE_GLAPI wine_glMultiTexCoord1fARB(GLenum target, GLfloat s) {
35 if(target != GL_TEXTURE0) {
36 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
37 return;
39 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1f(s);
42 static void WINE_GLAPI wine_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) {
43 if(target != GL_TEXTURE0) {
44 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
45 return;
47 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord1fv(v);
50 static void WINE_GLAPI wine_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) {
51 if(target != GL_TEXTURE0) {
52 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
53 return;
55 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2f(s, t);
58 static void WINE_GLAPI wine_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) {
59 if(target != GL_TEXTURE0) {
60 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
61 return;
63 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2fv(v);
66 static void WINE_GLAPI wine_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) {
67 if(target != GL_TEXTURE0) {
68 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
69 return;
71 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3f(s, t, r);
74 static void WINE_GLAPI wine_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) {
75 if(target != GL_TEXTURE0) {
76 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
77 return;
79 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord3fv(v);
82 static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) {
83 if(target != GL_TEXTURE0) {
84 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
85 return;
87 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4f(s, t, r, q);
90 static void WINE_GLAPI wine_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) {
91 if(target != GL_TEXTURE0) {
92 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
93 return;
95 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4fv(v);
98 static void WINE_GLAPI wine_glMultiTexCoord2svARB(GLenum target, const GLshort *v) {
99 if(target != GL_TEXTURE0) {
100 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
101 return;
103 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord2sv(v);
106 static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *v) {
107 if(target != GL_TEXTURE0) {
108 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
109 return;
111 context_get_current()->gl_info->gl_ops.gl.p_glTexCoord4sv(v);
114 static void WINE_GLAPI wine_glActiveTextureARB(GLenum texture) {
115 if(texture != GL_TEXTURE0) {
116 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
117 return;
121 static void WINE_GLAPI wine_glClientActiveTextureARB(GLenum texture) {
122 if(texture != GL_TEXTURE0) {
123 ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n");
124 return;
128 static void (WINE_GLAPI *old_multitex_glGetIntegerv) (GLenum pname, GLint* params) = NULL;
129 static void WINE_GLAPI wine_glGetIntegerv(GLenum pname, GLint* params) {
130 switch(pname) {
131 case GL_ACTIVE_TEXTURE: *params = 0; break;
132 case GL_MAX_TEXTURE_UNITS_ARB: *params = 1; break;
133 default: old_multitex_glGetIntegerv(pname, params);
137 static void (WINE_GLAPI *old_multitex_glGetFloatv) (GLenum pname, GLfloat* params) = NULL;
138 static void WINE_GLAPI wine_glGetFloatv(GLenum pname, GLfloat* params) {
139 if (pname == GL_ACTIVE_TEXTURE) *params = 0.0f;
140 else old_multitex_glGetFloatv(pname, params);
143 static void (WINE_GLAPI *old_multitex_glGetDoublev) (GLenum pname, GLdouble* params) = NULL;
144 static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) {
145 if(pname == GL_ACTIVE_TEXTURE) *params = 0.0;
146 else old_multitex_glGetDoublev(pname, params);
149 /* Start GL_EXT_fogcoord emulation */
150 static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL;
151 static void WINE_GLAPI wine_glEnable(GLenum cap) {
152 if(cap == GL_FOG) {
153 struct wined3d_context *ctx = context_get_current();
154 ctx->fog_enabled = 1;
155 if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
157 old_fogcoord_glEnable(cap);
160 static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL;
161 static void WINE_GLAPI wine_glDisable(GLenum cap) {
162 if(cap == GL_FOG) {
163 struct wined3d_context *ctx = context_get_current();
164 ctx->fog_enabled = 0;
165 if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return;
167 old_fogcoord_glDisable(cap);
170 static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL;
171 static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) {
172 struct wined3d_context *ctx = context_get_current();
174 if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
175 ctx->gl_fog_source = param;
176 if(param == GL_FRAGMENT_DEPTH_EXT) {
177 if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
178 } else {
179 WARN("Fog coords activated, but not supported. Using slow emulation\n");
180 old_fogcoord_glDisable(GL_FOG);
182 } else {
183 if(pname == GL_FOG_START) {
184 ctx->fogstart = (float) param;
185 } else if(pname == GL_FOG_END) {
186 ctx->fogend = (float) param;
188 old_fogcoord_glFogi(pname, param);
192 static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL;
193 static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) {
194 struct wined3d_context *ctx = context_get_current();
195 if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
196 ctx->gl_fog_source = *param;
197 if(*param == GL_FRAGMENT_DEPTH_EXT) {
198 if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
199 } else {
200 WARN("Fog coords activated, but not supported. Using slow emulation\n");
201 old_fogcoord_glDisable(GL_FOG);
203 } else {
204 if(pname == GL_FOG_START) {
205 ctx->fogstart = (float) *param;
206 } else if(pname == GL_FOG_END) {
207 ctx->fogend = (float) *param;
209 old_fogcoord_glFogiv(pname, param);
213 static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL;
214 static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) {
215 struct wined3d_context *ctx = context_get_current();
216 if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
217 ctx->gl_fog_source = (GLint) param;
218 if(param == GL_FRAGMENT_DEPTH_EXT) {
219 if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
220 } else {
221 WARN("Fog coords activated, but not supported. Using slow emulation\n");
222 old_fogcoord_glDisable(GL_FOG);
224 } else {
225 if(pname == GL_FOG_START) {
226 ctx->fogstart = param;
227 } else if(pname == GL_FOG_END) {
228 ctx->fogend = param;
230 old_fogcoord_glFogf(pname, param);
234 static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL;
235 static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) {
236 struct wined3d_context *ctx = context_get_current();
237 if(pname == GL_FOG_COORDINATE_SOURCE_EXT) {
238 ctx->gl_fog_source = (GLint) *param;
239 if(*param == GL_FRAGMENT_DEPTH_EXT) {
240 if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG);
241 } else {
242 WARN("Fog coords activated, but not supported. Using slow emulation\n");
243 old_fogcoord_glDisable(GL_FOG);
245 } else {
246 if(pname == GL_FOG_COLOR) {
247 ctx->fogcolor[0] = param[0];
248 ctx->fogcolor[1] = param[1];
249 ctx->fogcolor[2] = param[2];
250 ctx->fogcolor[3] = param[3];
251 } else if(pname == GL_FOG_START) {
252 ctx->fogstart = *param;
253 } else if(pname == GL_FOG_END) {
254 ctx->fogend = *param;
256 old_fogcoord_glFogfv(pname, param);
260 static void (WINE_GLAPI *old_fogcoord_glVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL;
261 static void (WINE_GLAPI *old_fogcoord_glVertex4fv) (const GLfloat *pos) = NULL;
262 static void (WINE_GLAPI *old_fogcoord_glVertex3f) (GLfloat x, GLfloat y, GLfloat z) = NULL;
263 static void (WINE_GLAPI *old_fogcoord_glVertex3fv) (const GLfloat *pos) = NULL;
264 static void (WINE_GLAPI *old_fogcoord_glColor4f) (GLfloat r, GLfloat g, GLfloat b, GLfloat a) = NULL;
265 static void (WINE_GLAPI *old_fogcoord_glColor4fv) (const GLfloat *color) = NULL;
266 static void (WINE_GLAPI *old_fogcoord_glColor3f) (GLfloat r, GLfloat g, GLfloat b) = NULL;
267 static void (WINE_GLAPI *old_fogcoord_glColor3fv) (const GLfloat *color) = NULL;
268 static void (WINE_GLAPI *old_fogcoord_glColor4ub) (GLubyte r, GLubyte g, GLubyte b, GLubyte a) = NULL;
269 static void (WINE_GLAPI *old_fogcoord_glFogCoordfEXT) (GLfloat f) = NULL;
270 static void (WINE_GLAPI *old_fogcoord_glFogCoorddEXT) (GLdouble f) = NULL;
271 static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL;
272 static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL;
274 static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
275 struct wined3d_context *ctx = context_get_current();
276 if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) {
277 GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]};
278 GLfloat i;
280 i = (ctx->fogend - ctx->fog_coord_value) / (ctx->fogend - ctx->fogstart);
281 c[0] = i * c[0] + (1.0f - i) * ctx->fogcolor[0];
282 c[1] = i * c[1] + (1.0f - i) * ctx->fogcolor[1];
283 c[2] = i * c[2] + (1.0f - i) * ctx->fogcolor[2];
285 old_fogcoord_glColor4f(c[0], c[1], c[2], c[3]);
286 old_fogcoord_glVertex4f(x, y, z, w);
287 } else {
288 old_fogcoord_glVertex4f(x, y, z, w);
292 static void WINE_GLAPI wine_glVertex4fv(const GLfloat *pos) {
293 wine_glVertex4f(pos[0], pos[1], pos[2], pos[3]);
296 static void WINE_GLAPI wine_glVertex3f(GLfloat x, GLfloat y, GLfloat z) {
297 wine_glVertex4f(x, y, z, 1.0f);
300 static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) {
301 wine_glVertex4f(pos[0], pos[1], pos[2], 1.0f);
304 static void WINE_GLAPI wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) {
305 struct wined3d_context *ctx = context_get_current();
306 ctx->color[0] = r;
307 ctx->color[1] = g;
308 ctx->color[2] = b;
309 ctx->color[3] = a;
310 old_fogcoord_glColor4f(r, g, b, a);
313 static void WINE_GLAPI wine_glColor4fv(const GLfloat *c) {
314 wine_glColor4f(c[0], c[1], c[2], c[3]);
317 static void WINE_GLAPI wine_glColor3f(GLfloat r, GLfloat g, GLfloat b) {
318 wine_glColor4f(r, g, b, 1.0f);
321 static void WINE_GLAPI wine_glColor3fv(const GLfloat *c) {
322 wine_glColor4f(c[0], c[1], c[2], 1.0f);
325 static void WINE_GLAPI wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) {
326 wine_glColor4f(r / 255.0f, g / 255.0f, b / 255.0f, a / 255.0f);
329 /* In D3D the fog coord is a UBYTE, so there's no problem with using the single
330 * precision function
332 static void WINE_GLAPI wine_glFogCoordfEXT(GLfloat f) {
333 struct wined3d_context *ctx = context_get_current();
334 ctx->fog_coord_value = f;
336 static void WINE_GLAPI wine_glFogCoorddEXT(GLdouble f) {
337 wine_glFogCoordfEXT((GLfloat) f);
339 static void WINE_GLAPI wine_glFogCoordfvEXT(const GLfloat *f) {
340 wine_glFogCoordfEXT(*f);
342 static void WINE_GLAPI wine_glFogCoorddvEXT(const GLdouble *f) {
343 wine_glFogCoordfEXT((GLfloat) *f);
346 /* End GL_EXT_fog_coord emulation */
348 void add_gl_compat_wrappers(struct wined3d_gl_info *gl_info)
350 if (!gl_info->supported[ARB_MULTITEXTURE])
352 TRACE("Applying GL_ARB_multitexture emulation hooks\n");
353 gl_info->gl_ops.ext.p_glActiveTextureARB = wine_glActiveTextureARB;
354 gl_info->gl_ops.ext.p_glClientActiveTextureARB = wine_glClientActiveTextureARB;
355 gl_info->gl_ops.ext.p_glMultiTexCoord1fARB = wine_glMultiTexCoord1fARB;
356 gl_info->gl_ops.ext.p_glMultiTexCoord1fvARB = wine_glMultiTexCoord1fvARB;
357 gl_info->gl_ops.ext.p_glMultiTexCoord2fARB = wine_glMultiTexCoord2fARB;
358 gl_info->gl_ops.ext.p_glMultiTexCoord2fvARB = wine_glMultiTexCoord2fvARB;
359 gl_info->gl_ops.ext.p_glMultiTexCoord3fARB = wine_glMultiTexCoord3fARB;
360 gl_info->gl_ops.ext.p_glMultiTexCoord3fvARB = wine_glMultiTexCoord3fvARB;
361 gl_info->gl_ops.ext.p_glMultiTexCoord4fARB = wine_glMultiTexCoord4fARB;
362 gl_info->gl_ops.ext.p_glMultiTexCoord4fvARB = wine_glMultiTexCoord4fvARB;
363 gl_info->gl_ops.ext.p_glMultiTexCoord2svARB = wine_glMultiTexCoord2svARB;
364 gl_info->gl_ops.ext.p_glMultiTexCoord4svARB = wine_glMultiTexCoord4svARB;
365 if(old_multitex_glGetIntegerv) {
366 FIXME("GL_ARB_multitexture glGetIntegerv hook already applied\n");
367 } else {
368 old_multitex_glGetIntegerv = gl_info->gl_ops.gl.p_glGetIntegerv;
369 gl_info->gl_ops.gl.p_glGetIntegerv = wine_glGetIntegerv;
371 if(old_multitex_glGetFloatv) {
372 FIXME("GL_ARB_multitexture glGetGloatv hook already applied\n");
373 } else {
374 old_multitex_glGetFloatv = gl_info->gl_ops.gl.p_glGetFloatv;
375 gl_info->gl_ops.gl.p_glGetFloatv = wine_glGetFloatv;
377 if(old_multitex_glGetDoublev) {
378 FIXME("GL_ARB_multitexture glGetDoublev hook already applied\n");
379 } else {
380 old_multitex_glGetDoublev = gl_info->gl_ops.gl.p_glGetDoublev;
381 gl_info->gl_ops.gl.p_glGetDoublev = wine_glGetDoublev;
383 gl_info->supported[ARB_MULTITEXTURE] = TRUE;
386 if (!gl_info->supported[EXT_FOG_COORD])
388 /* This emulation isn't perfect. There are a number of potential problems, but they should
389 * not matter in practise:
391 * Fog vs fragment shader: If we are using GL_ARB_fragment_program with the fog option, the
392 * glDisable(GL_FOG) here won't matter. However, if we have GL_ARB_fragment_program, it is pretty
393 * unlikely that we don't have GL_EXT_fog_coord. Besides, we probably have GL_ARB_vertex_program
394 * too, which would allow fog coord emulation in a fixed function vertex pipeline replacement.
396 * Fog vs texture: We apply the fog in the vertex color. An app could set up texturing settings which
397 * ignore the vertex color, thus effectively disabling our fog. However, in D3D this type of fog is
398 * a per-vertex fog too, so the apps shouldn't do that.
400 * Fog vs lighting: The app could in theory use D3DFOG_NONE table and D3DFOG_NONE vertex fog with
401 * untransformed vertices. That enables lighting and fog coords at the same time, and the lighting
402 * calculations could affect the already blended in fog color. There's nothing we can do against that,
403 * but most apps using fog color do their own lighting too and often even use RHW vertices. So live
404 * with it.
406 TRACE("Applying GL_ARB_fog_coord emulation hooks\n");
408 /* This probably means that the implementation doesn't advertise the extension, but implicitly supports
409 * it via the GL core version, or someone messed around in the extension table in directx.c. Add version-
410 * dependent loading for this extension if we ever hit this situation
412 if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
414 FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n");
415 FIXME("The fog coord emulation will most likely fail\n");
417 else if (gl_info->supported[ARB_FRAGMENT_SHADER])
419 FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n");
420 FIXME("The fog coord emulation will most likely fail\n");
423 if(old_fogcoord_glFogi) {
424 FIXME("GL_EXT_fogcoord glFogi hook already applied\n");
425 } else {
426 old_fogcoord_glFogi = gl_info->gl_ops.gl.p_glFogi;
427 gl_info->gl_ops.gl.p_glFogi = wine_glFogi;
429 if(old_fogcoord_glFogiv) {
430 FIXME("GL_EXT_fogcoord glFogiv hook already applied\n");
431 } else {
432 old_fogcoord_glFogiv = gl_info->gl_ops.gl.p_glFogiv;
433 gl_info->gl_ops.gl.p_glFogiv = wine_glFogiv;
435 if(old_fogcoord_glFogf) {
436 FIXME("GL_EXT_fogcoord glFogf hook already applied\n");
437 } else {
438 old_fogcoord_glFogf = gl_info->gl_ops.gl.p_glFogf;
439 gl_info->gl_ops.gl.p_glFogf = wine_glFogf;
441 if(old_fogcoord_glFogfv) {
442 FIXME("GL_EXT_fogcoord glFogfv hook already applied\n");
443 } else {
444 old_fogcoord_glFogfv = gl_info->gl_ops.gl.p_glFogfv;
445 gl_info->gl_ops.gl.p_glFogfv = wine_glFogfv;
447 if(old_fogcoord_glEnable) {
448 FIXME("GL_EXT_fogcoord glEnable hook already applied\n");
449 } else {
450 old_fogcoord_glEnable = glEnableWINE;
451 glEnableWINE = wine_glEnable;
453 if(old_fogcoord_glDisable) {
454 FIXME("GL_EXT_fogcoord glDisable hook already applied\n");
455 } else {
456 old_fogcoord_glDisable = glDisableWINE;
457 glDisableWINE = wine_glDisable;
460 if(old_fogcoord_glVertex4f) {
461 FIXME("GL_EXT_fogcoord glVertex4f hook already applied\n");
462 } else {
463 old_fogcoord_glVertex4f = gl_info->gl_ops.gl.p_glVertex4f;
464 gl_info->gl_ops.gl.p_glVertex4f = wine_glVertex4f;
466 if(old_fogcoord_glVertex4fv) {
467 FIXME("GL_EXT_fogcoord glVertex4fv hook already applied\n");
468 } else {
469 old_fogcoord_glVertex4fv = gl_info->gl_ops.gl.p_glVertex4fv;
470 gl_info->gl_ops.gl.p_glVertex4fv = wine_glVertex4fv;
472 if(old_fogcoord_glVertex3f) {
473 FIXME("GL_EXT_fogcoord glVertex3f hook already applied\n");
474 } else {
475 old_fogcoord_glVertex3f = gl_info->gl_ops.gl.p_glVertex3f;
476 gl_info->gl_ops.gl.p_glVertex3f = wine_glVertex3f;
478 if(old_fogcoord_glVertex3fv) {
479 FIXME("GL_EXT_fogcoord glVertex3fv hook already applied\n");
480 } else {
481 old_fogcoord_glVertex3fv = gl_info->gl_ops.gl.p_glVertex3fv;
482 gl_info->gl_ops.gl.p_glVertex3fv = wine_glVertex3fv;
485 if(old_fogcoord_glColor4f) {
486 FIXME("GL_EXT_fogcoord glColor4f hook already applied\n");
487 } else {
488 old_fogcoord_glColor4f = gl_info->gl_ops.gl.p_glColor4f;
489 gl_info->gl_ops.gl.p_glColor4f = wine_glColor4f;
491 if(old_fogcoord_glColor4fv) {
492 FIXME("GL_EXT_fogcoord glColor4fv hook already applied\n");
493 } else {
494 old_fogcoord_glColor4fv = gl_info->gl_ops.gl.p_glColor4fv;
495 gl_info->gl_ops.gl.p_glColor4fv = wine_glColor4fv;
497 if(old_fogcoord_glColor3f) {
498 FIXME("GL_EXT_fogcoord glColor3f hook already applied\n");
499 } else {
500 old_fogcoord_glColor3f = gl_info->gl_ops.gl.p_glColor3f;
501 gl_info->gl_ops.gl.p_glColor3f = wine_glColor3f;
503 if(old_fogcoord_glColor3fv) {
504 FIXME("GL_EXT_fogcoord glColor3fv hook already applied\n");
505 } else {
506 old_fogcoord_glColor3fv = gl_info->gl_ops.gl.p_glColor3fv;
507 gl_info->gl_ops.gl.p_glColor3fv = wine_glColor3fv;
509 if(old_fogcoord_glColor4ub) {
510 FIXME("GL_EXT_fogcoord glColor4ub hook already applied\n");
511 } else {
512 old_fogcoord_glColor4ub = gl_info->gl_ops.gl.p_glColor4ub;
513 gl_info->gl_ops.gl.p_glColor4ub = wine_glColor4ub;
516 if(old_fogcoord_glFogCoordfEXT) {
517 FIXME("GL_EXT_fogcoord glFogCoordfEXT hook already applied\n");
518 } else {
519 old_fogcoord_glFogCoordfEXT = gl_info->gl_ops.ext.p_glFogCoordfEXT;
520 gl_info->gl_ops.ext.p_glFogCoordfEXT = wine_glFogCoordfEXT;
522 if(old_fogcoord_glFogCoordfvEXT) {
523 FIXME("GL_EXT_fogcoord glFogCoordfvEXT hook already applied\n");
524 } else {
525 old_fogcoord_glFogCoordfvEXT = gl_info->gl_ops.ext.p_glFogCoordfvEXT;
526 gl_info->gl_ops.ext.p_glFogCoordfvEXT = wine_glFogCoordfvEXT;
528 if(old_fogcoord_glFogCoorddEXT) {
529 FIXME("GL_EXT_fogcoord glFogCoorddEXT hook already applied\n");
530 } else {
531 old_fogcoord_glFogCoorddEXT = gl_info->gl_ops.ext.p_glFogCoorddEXT;
532 gl_info->gl_ops.ext.p_glFogCoorddEXT = wine_glFogCoorddEXT;
534 if(old_fogcoord_glFogCoorddvEXT) {
535 FIXME("GL_EXT_fogcoord glFogCoorddvEXT hook already applied\n");
536 } else {
537 old_fogcoord_glFogCoorddvEXT = gl_info->gl_ops.ext.p_glFogCoorddvEXT;
538 gl_info->gl_ops.ext.p_glFogCoorddvEXT = wine_glFogCoorddvEXT;
540 gl_info->supported[EXT_FOG_COORD] = TRUE;