Pyrogenesis  trunk
Macros | Typedefs | Functions | Variables
ogl.h File Reference
#include "lib/external_libraries/opengl.h"
#include "lib/external_libraries/glext_funcs.h"
Include dependency graph for ogl.h:

Go to the source code of this file.

Macros

#define GL_MIN_PROGRAM_TEXEL_OFFSET   0x8904
 
#define GL_MAX_PROGRAM_TEXEL_OFFSET   0x8905
 
#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT   0x8C8A
 
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT   0x8C8B
 
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT   0x8C80
 
#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB   0x8C29
 
#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB   0x8DDD
 
#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB   0x8DDE
 
#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB   0x8DDF
 
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB   0x8DE0
 
#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB   0x8DE1
 
#define GL_TIME_ELAPSED   0x88BF
 
#define GL_TIMESTAMP   0x8E28
 
#define GL_INVALID_FRAMEBUFFER_OPERATION   0x0506
 
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT   0x88FF
 
#define GL_CALL_CONV
 
#define FUNC(ret, name, params)   EXTERN_C ret (GL_CALL_CONV *p##name) params;
 
#define FUNC2(ret, nameARB, nameCore, version, params)   EXTERN_C ret (GL_CALL_CONV *p##nameARB) params;
 
#define FUNC3(ret, nameARB, nameCore, version, params)   EXTERN_C ret (GL_CALL_CONV *p##nameCore) params;
 
#define ogl_WarnIfError()   ogl_WarnIfErrorLoc(__FILE__, __LINE__)
 

Typedefs

typedef int64_t GLint64
 
typedef uint64_t GLuint64
 

Functions

void ogl_Init ()
 initialization: import extension function pointers and do feature detect. More...
 
bool ogl_HaveExtension (const char *ext)
 check if an extension is supported by the OpenGL implementation. More...
 
bool ogl_HaveVersion (const char *version)
 make sure the OpenGL implementation version matches or is newer than the given version. More...
 
const char * ogl_HaveExtensions (int dummy,...) SENTINEL_ARG
 check if a list of extensions are all supported (as determined by ogl_HaveExtension). More...
 
const char * ogl_ExtensionString ()
 get a list of all supported extensions. More...
 
void ogl_WarnIfErrorLoc (const char *file, int line)
 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...
 

Variables

GLint ogl_max_tex_size
 
GLint ogl_max_tex_units
 [pixels] More...
 

Macro Definition Documentation

#define FUNC (   ret,
  name,
  params 
)    EXTERN_C ret (GL_CALL_CONV *p##name) params;
#define FUNC2 (   ret,
  nameARB,
  nameCore,
  version,
  params 
)    EXTERN_C ret (GL_CALL_CONV *p##nameARB) params;
#define FUNC3 (   ret,
  nameARB,
  nameCore,
  version,
  params 
)    EXTERN_C ret (GL_CALL_CONV *p##nameCore) params;
#define GL_CALL_CONV
#define GL_INVALID_FRAMEBUFFER_OPERATION   0x0506
#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT   0x88FF
#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB   0x8DE0
#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB   0x8C29
#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB   0x8DE1
#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB   0x8DDF
#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB   0x8DDD
#define GL_MAX_PROGRAM_TEXEL_OFFSET   0x8905
#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT   0x8C8A
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT   0x8C8B
#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT   0x8C80
#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB   0x8DDE
#define GL_MIN_PROGRAM_TEXEL_OFFSET   0x8904
#define GL_TIME_ELAPSED   0x88BF
#define GL_TIMESTAMP   0x8E28
#define ogl_WarnIfError ( )    ogl_WarnIfErrorLoc(__FILE__, __LINE__)

Typedef Documentation

typedef int64_t GLint64
typedef uint64_t GLuint64

Function Documentation

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.
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
extextension string; exact case.
Returns
bool.
const char* ogl_HaveExtensions ( int  dummy,
  ... 
)

check if a list of extensions are all supported (as determined by ogl_HaveExtension).

Parameters
dummyvalue 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).
bool ogl_HaveVersion ( const char *  version)

make sure the OpenGL implementation version matches or is newer than the given version.

Parameters
versionversion string; format: ("%d.%d", major, minor). example: "1.2".
void ogl_Init ( )

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.

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_ignoreone of the glGetError enums.
Returns
true if the requested error was seen and ignored
void ogl_WarnIfErrorLoc ( const char *  file,
int  line 
)

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.

Variable Documentation

GLint ogl_max_tex_size
GLint ogl_max_tex_units

[pixels]