#include "precompiled.h"
#include "lib/ogl.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "lib/external_libraries/libsdl.h"
#include "lib/debug.h"
#include "lib/sysdep/gfx.h"
#include "lib/res/h_mgr.h"
#include "lib/external_libraries/glext_funcs.h"
Go to the source code of this file.
|
#define | FUNC(ret, name, params) ret (GL_CALL_CONV *p##name) params; |
|
#define | FUNC2(ret, nameARB, nameCore, version, params) ret (GL_CALL_CONV *p##nameARB) params; |
|
#define | FUNC3(ret, nameARB, nameCore, version, params) ret (GL_CALL_CONV *p##nameCore) params; |
|
#define | MATCH(known_ext) |
|
#define | FUNC(ret, name, params) p##name = (ret (GL_CALL_CONV*) params)SDL_GL_GetProcAddress(#name); |
|
#define | FUNC23(pname, ret, nameARB, nameCore, version, params) |
|
#define | FUNC2(ret, nameARB, nameCore, version, params) FUNC23(p##nameARB, ret, nameARB, nameCore, version, params) |
|
#define | FUNC3(ret, nameARB, nameCore, version, params) FUNC23(p##nameCore, ret, nameARB, nameCore, version, params) |
|
#define | E(e) case e: debug_printf(L"%ls\n", WIDEN(#e)); break; |
|
|
const char * | ogl_ExtensionString () |
| get a list of all supported extensions. More...
|
|
static bool | isImplementedInCore (const char *ext) |
|
bool | ogl_HaveExtension (const char *ext) |
| check if an extension is supported by the OpenGL implementation. More...
|
|
bool | ogl_HaveVersion (const char *desired_version) |
| make sure the OpenGL implementation version matches or is newer than the given version. More...
|
|
const char * | ogl_HaveExtensions (int dummy,...) |
| check if a list of extensions are all supported (as determined by ogl_HaveExtension). More...
|
|
static void GL_CALL_CONV | dummy_glDrawRangeElementsEXT (GLenum mode, GLuint, GLuint, GLsizei count, GLenum type, GLvoid *indices) |
|
static void GL_CALL_CONV | dummy_glActiveTextureARB (int) |
|
static void GL_CALL_CONV | dummy_glClientActiveTextureARB (int) |
|
static void GL_CALL_CONV | dummy_glMultiTexCoord2fARB (int, float s, float t) |
|
static void GL_CALL_CONV | dummy_glMultiTexCoord3fARB (int, float s, float t, float r) |
|
static void | enableDummyFunctions () |
|
static void | importExtensionFunctions () |
|
static void | dump_gl_error (GLenum err) |
|
void | ogl_WarnIfError () |
| raise a warning (break into the debugger) if an OpenGL error is pending. More...
|
|
bool | ogl_SquelchError (GLenum err_to_ignore) |
| ignore and reset the specified OpenGL error. More...
|
|
void | ogl_Init () |
| initialization: import extension function pointers and do feature detect. More...
|
|
#define E |
( |
|
e | ) |
case e: debug_printf(L"%ls\n", WIDEN(#e)); break; |
#define FUNC |
( |
|
ret, |
|
|
|
name, |
|
|
|
params |
|
) |
| ret (GL_CALL_CONV *p##name) params; |
#define FUNC2 |
( |
|
ret, |
|
|
|
nameARB, |
|
|
|
nameCore, |
|
|
|
version, |
|
|
|
params |
|
) |
| ret (GL_CALL_CONV *p##nameARB) params; |
#define FUNC2 |
( |
|
ret, |
|
|
|
nameARB, |
|
|
|
nameCore, |
|
|
|
version, |
|
|
|
params |
|
) |
| FUNC23(p##nameARB, ret, nameARB, nameCore, version, params) |
#define FUNC23 |
( |
|
pname, |
|
|
|
ret, |
|
|
|
nameARB, |
|
|
|
nameCore, |
|
|
|
version, |
|
|
|
params |
|
) |
| |
Value:pname = NULL; \
if(!pname) \
pname = (ret (GL_CALL_CONV*) params)SDL_GL_GetProcAddress(#nameARB);
void * SDL_GL_GetProcAddress(const char *name)
bool ogl_HaveVersion(const char *desired_version)
make sure the OpenGL implementation version matches or is newer than the given version.
#define FUNC3 |
( |
|
ret, |
|
|
|
nameARB, |
|
|
|
nameCore, |
|
|
|
version, |
|
|
|
params |
|
) |
| ret (GL_CALL_CONV *p##nameCore) params; |
#define FUNC3 |
( |
|
ret, |
|
|
|
nameARB, |
|
|
|
nameCore, |
|
|
|
version, |
|
|
|
params |
|
) |
| FUNC23(p##nameCore, ret, nameARB, nameCore, version, params) |
#define MATCH |
( |
|
known_ext | ) |
|
Value:if(!strcmp(ext, #known_ext))\
return true;
static void GL_CALL_CONV dummy_glClientActiveTextureARB |
( |
int |
| ) |
|
|
static |
static void GL_CALL_CONV dummy_glDrawRangeElementsEXT |
( |
GLenum |
mode, |
|
|
GLuint |
, |
|
|
GLuint |
, |
|
|
GLsizei |
count, |
|
|
GLenum |
type, |
|
|
GLvoid * |
indices |
|
) |
| |
|
static |
static void GL_CALL_CONV dummy_glMultiTexCoord2fARB |
( |
int |
, |
|
|
float |
s, |
|
|
float |
t |
|
) |
| |
|
static |
static void GL_CALL_CONV dummy_glMultiTexCoord3fARB |
( |
int |
, |
|
|
float |
s, |
|
|
float |
t, |
|
|
float |
r |
|
) |
| |
|
static |
static void dump_gl_error |
( |
GLenum |
err | ) |
|
|
static |
static void enableDummyFunctions |
( |
| ) |
|
|
static |
static void importExtensionFunctions |
( |
| ) |
|
|
static |
static bool isImplementedInCore |
( |
const char * |
ext | ) |
|
|
static |
const char* ogl_ExtensionString |
( |
| ) |
|
get a list of all supported extensions.
useful for crash logs / system information.
- Returns
- read-only C string of unspecified length containing all advertised extension names, separated by space.
Definition at line 68 of file ogl.cpp.
bool ogl_HaveExtension |
( |
const char * |
ext | ) |
|
check if an extension is supported by the OpenGL implementation.
takes subsequently added core support for some extensions into account (in case drivers forget to advertise extensions).
- Parameters
-
ext | extension string; exact case. |
- Returns
- bool.
Definition at line 187 of file ogl.cpp.
const char* ogl_HaveExtensions |
( |
int |
dummy, |
|
|
|
... |
|
) |
| |
check if a list of extensions are all supported (as determined by ogl_HaveExtension).
- Parameters
-
dummy | value ignored; varargs requires a placeholder. follow it by a list of const char* extension string parameters, terminated by a 0 pointer. |
- Returns
- 0 if all are present; otherwise, the first extension in the list that's not supported (useful for reporting errors).
Definition at line 266 of file ogl.cpp.
bool ogl_HaveVersion |
( |
const char * |
version | ) |
|
make sure the OpenGL implementation version matches or is newer than the given version.
- Parameters
-
version | version string; format: ("%d.%d", major, minor). example: "1.2". |
Definition at line 219 of file ogl.cpp.
initialization: import extension function pointers and do feature detect.
call before using any other function, and after each video mode change. fails if OpenGL not ready for use.
Definition at line 473 of file ogl.cpp.
bool ogl_SquelchError |
( |
GLenum |
err_to_ignore | ) |
|
ignore and reset the specified OpenGL error.
this is useful for suppressing annoying error messages, e.g. "invalid enum" for GL_CLAMP_TO_EDGE even though we've already warned the user that their OpenGL implementation is too old.
call after the fact, i.e. the error has been raised. if another or different error is pending, those are reported immediately.
- Parameters
-
err_to_ignore,: | one of the glGetError enums. |
- Returns
- true if the requested error was seen and ignored
Definition at line 430 of file ogl.cpp.
raise a warning (break into the debugger) if an OpenGL error is pending.
resets the OpenGL error state afterwards.
when an error is reported, insert calls to this in a binary-search scheme to quickly narrow down the actual error location.
reports a bogus invalid_operation error if called before OpenGL is initialized, so don't!
disabled in release mode for efficiency and to avoid annoying errors.
Definition at line 398 of file ogl.cpp.
GLint ogl_max_tex_size = -1 |
GLint ogl_max_tex_units = -1 |