diff options
Diffstat (limited to 'code/pnd')
-rwxr-xr-x | code/pnd/GenerateQGL.pl | 147 | ||||
-rwxr-xr-x | code/pnd/egl_glimp.c | 560 | ||||
-rwxr-xr-x | code/pnd/egl_glimp.h | 72 | ||||
-rwxr-xr-x | code/pnd/egl_input.c | 97 | ||||
-rwxr-xr-x | code/pnd/egl_input.h | 24 | ||||
-rwxr-xr-x | code/pnd/pnd_event.c | 435 | ||||
-rwxr-xr-x | code/pnd/pnd_event.h | 12 | ||||
-rwxr-xr-x | code/pnd/pnd_type.h | 306 | ||||
-rw-r--r-- | code/pnd/qgl.h | 2187 |
9 files changed, 3840 insertions, 0 deletions
diff --git a/code/pnd/GenerateQGL.pl b/code/pnd/GenerateQGL.pl new file mode 100755 index 0000000..6c1372b --- /dev/null +++ b/code/pnd/GenerateQGL.pl @@ -0,0 +1,147 @@ +#!/usr/bin/perl
+
+open(INPUT_FILE, ">/tmp/input-$$.h") || die "$!";
+print INPUT_FILE "#import <GLES/gl.h>\n";
+close INPUT_FILE;
+open(CPP, "/usr/bin/cpp /tmp/input-$$.h|") || die "$!";
+
+print "/**** This file is autogenerated. Run GenerateQGL.pl to update it ****/\n\n";
+
+print "#ifdef QGL_LOG_GL_CALLS\n";
+print "extern unsigned int QGLLogGLCalls;\n";
+print "extern FILE *QGLDebugFile(void);\n";
+print "#endif\n\n";
+
+print "extern void QGLCheckError(const char *message);\n";
+print "extern unsigned int QGLBeginStarted;\n\n";
+print "// This has to be done to avoid infinite recursion between our glGetError wrapper and QGLCheckError()\n";
+print "static inline GLenum _glGetError(void) {\n";
+print " return glGetError();\n";
+print "}\n\n";
+
+@functionNames = ();
+
+while (<CPP>) {
+ chop;
+ /^extern/ || next;
+ s/extern //;
+ print "// $_\n";
+
+ # This approach is necessary to deal with glGetString whos type isn't a single word
+ ($type, $rest) = m/(.+)\s+(gl.*)/;
+# print "type='$type'\n";
+# print "rest='$rest'\n";
+
+ ($name, $argString) = ($rest =~ m/(\w+).*\s*\((.*)\)/);
+ next if ($name eq "glColor4f");
+ $isVoid = ($type =~ m/void/);
+ push(@functionNames, $name);
+
+# print "name=$name\n";
+# print "argString=$argString\n";
+# print "argCount=$#args\n";
+
+ # Parse the argument list into two arrays, one of types and one of argument names
+ if ($argString =~ m/^void$/) {
+ @args = ();
+ } else {
+ @args = split(",", $argString);
+ }
+ @argTypes = ();
+ @argNames = ();
+ for $arg (@args) {
+ ($argType, $argName) = ($arg =~ m/(.*[ \*])([_a-zA-Z0-9]+)/);
+ $argType =~ s/^ *//;
+ $argType =~ s/ *$//;
+
+ push(@argTypes, $argType);
+ push(@argNames, $argName);
+# print "argType='$argType'\n";
+# print "argName='$argName'\n";
+ }
+
+
+ print "static inline $type q$name($argString)\n";
+ print "{\n";
+
+ if (! $isVoid) {
+ print " $type returnValue;\n";
+ }
+
+ print "#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS)\n";
+ print " if (QGLLogGLCalls)\n";
+ print " fprintf(QGLDebugFile(), \"$name(";
+
+ if ($#argTypes >= 0) {
+ for ($i = 0; $i <= $#argTypes; $i++) {
+ $argType = $argTypes[$i];
+ $argName = $argNames[$i];
+ $_ = $argType;
+ if (/^GLenum$/ || /^GLuint$/ || /^GLbitfield$/) {
+ print "$argName=%lu";
+ } elsif (/^GLsizei$/ || /^GLint$/ || /^GLsizeiptr$/ || /^GLintptr$/ || /^GLfixed$/ || /^GLclampx$/) {
+ print "$argName=%ld";
+ } elsif (/^GLfloat$/ || /^GLdouble$/ || /^GLclampf$/ || /^GLclampd$/) {
+ print "$argName=%f";
+ } elsif (/^GLbyte$/) {
+ print "$argName=%d";
+ } elsif (/^GLubyte$/) {
+ print "$argName=%u";
+ } elsif (/^GLshort$/) {
+ print "$argName=%d";
+ } elsif (/^GLushort$/) {
+ print "$argName=%u";
+ } elsif (/^GLboolean$/) {
+ print "$argName=%u";
+ } elsif (/\*$/) {
+ # TJW -- Later we should look at the count specified in the function name, look at the basic type and print out an array. Or we could just special case them...
+ print "$argName=%p";
+ } else {
+ print STDERR "Unknown type '$argType'\n";
+ exit(1);
+ }
+
+ print ", " if ($i != $#argTypes);
+ }
+ } else {
+ print "void";
+ }
+
+ print ")\\n\"";
+ print ", " if $#argTypes >= 0;
+ print join(", ", @argNames);
+ print ");\n";
+ print "#endif\n";
+
+ if (! $isVoid) {
+ print " returnValue = ";
+ } else {
+ print " ";
+ }
+ print "$name(" . join(", ", @argNames) . ");\n";
+
+ print "#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS)\n";
+ if ($name eq "glBegin") {
+ print " QGLBeginStarted++;\n";
+ }
+ if ($name eq "glEnd") {
+ print " QGLBeginStarted--;\n";
+ }
+ print " if (!QGLBeginStarted)\n";
+ print " QGLCheckError(\"$name\");\n";
+ print "#endif\n";
+
+ if (! $isVoid) {
+ print " return returnValue;\n";
+ }
+
+ print "}\n\n";
+}
+
+
+print "// Prevent calls to the 'normal' GL functions\n";
+for $name (@functionNames) {
+ print "#define $name CALL_THE_QGL_VERSION_OF_$name\n";
+}
+
+
diff --git a/code/pnd/egl_glimp.c b/code/pnd/egl_glimp.c new file mode 100755 index 0000000..d16317c --- /dev/null +++ b/code/pnd/egl_glimp.c @@ -0,0 +1,560 @@ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/param.h> + +#include <X11/keysym.h> +#include <X11/Xatom.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +#include <GLES/egl.h> +#include <GLES/gl.h> + +//#include <SDL/SDL.h> + +#include "egl_glimp.h" +#include "../client/client.h" +#include "../renderer/tr_local.h" + +Display *dpy = NULL; +Window win = 0; +EGLContext eglContext = NULL; +EGLDisplay eglDisplay = NULL; +EGLSurface eglSurface = NULL; + +int pandora_driver_mode_x11 = 0; +cvar_t* cvarPndMode; + +int Sys_XTimeToSysTime(Time xtime) +{ + return Sys_Milliseconds(); +} + +static char *GLimp_StringErrors[] = { + "EGL_SUCCESS", + "EGL_NOT_INITIALIZED", + "EGL_BAD_ACCESS", + "EGL_BAD_ALLOC", + "EGL_BAD_ATTRIBUTE", + "EGL_BAD_CONFIG", + "EGL_BAD_CONTEXT", + "EGL_BAD_CURRENT_SURFACE", + "EGL_BAD_DISPLAY", + "EGL_BAD_MATCH", + "EGL_BAD_NATIVE_PIXMAP", + "EGL_BAD_NATIVE_WINDOW", + "EGL_BAD_PARAMETER", + "EGL_BAD_SURFACE", + "EGL_CONTEXT_LOST", +}; + +static void GLimp_HandleError(void) +{ + GLint err = eglGetError(); + + fprintf(stderr, "%s: 0x%04x: %s\n", __func__, err, + GLimp_StringErrors[err]); + assert(0); +} + +#define _NET_WM_STATE_REMOVE 0 /* remove/unset property */ +#define _NET_WM_STATE_ADD 1 /* add/set property */ +#define _NET_WM_STATE_TOGGLE 2 /* toggle property */ + +static void GLimp_DisableComposition(void) +{ + XClientMessageEvent xclient; + Atom atom; + int one = 1; + + atom = XInternAtom(dpy, "_HILDON_NON_COMPOSITED_WINDOW", False); + XChangeProperty(dpy, win, atom, XA_INTEGER, 32, PropModeReplace, + (unsigned char *)&one, 1); + + xclient.type = ClientMessage; + xclient.window = win; //GDK_WINDOW_XID (window); + xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False); + xclient.format = 32; + xclient.data.l[0] = + r_fullscreen->integer ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; + //gdk_x11_atom_to_xatom_for_display (display, state1); + //gdk_x11_atom_to_xatom_for_display (display, state2); + xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); + xclient.data.l[2] = 0; + xclient.data.l[3] = 0; + xclient.data.l[4] = 0; + XSendEvent(dpy, DefaultRootWindow(dpy), False, + SubstructureRedirectMask | SubstructureNotifyMask, + (XEvent *) & xclient); +} + + +#define MAX_NUM_CONFIGS 4 + +/* + * Create an RGB, double-buffered window. + * Return the window and context handles. + */ +static void make_window(Display * dpy, Screen * scr, EGLDisplay eglDisplay, + EGLSurface * winRet, EGLContext * ctxRet) +{ + EGLSurface eglSurface = EGL_NO_SURFACE; + EGLContext eglContext; + EGLConfig configs[MAX_NUM_CONFIGS]; + EGLint config_count; + XWindowAttributes WinAttr; + int XResult = BadImplementation; + int blackColour; + EGLint cfg_attribs[] = { + //EGL_NATIVE_VISUAL_TYPE, 0, + + /* RGB565 */ + EGL_BUFFER_SIZE, 16, + EGL_RED_SIZE, 5, + EGL_GREEN_SIZE, 6, + EGL_BLUE_SIZE, 5, + + //EGL_DEPTH_SIZE, 8, + + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT, + + EGL_NONE + }; + EGLint i; + + if (pandora_driver_mode_x11) + { + blackColour = BlackPixel(dpy, DefaultScreen(dpy)); + win = + XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, 1, 1, 0, + blackColour, blackColour); + XStoreName(dpy, win, WINDOW_CLASS_NAME); + + XSelectInput(dpy, win, X_MASK); + + if (!(XResult = XGetWindowAttributes(dpy, win, &WinAttr))) + GLimp_HandleError(); + + GLimp_DisableComposition(); + XMapWindow(dpy, win); + GLimp_DisableComposition(); + + XFlush(dpy); + } + + if (!eglGetConfigs(eglDisplay, configs, MAX_NUM_CONFIGS, &config_count)) + GLimp_HandleError(); + + if (!eglChooseConfig + (eglDisplay, cfg_attribs, configs, MAX_NUM_CONFIGS, &config_count)) + GLimp_HandleError(); + + for (i = 0; i < config_count; i++) + { + if (pandora_driver_mode_x11) + { + if ((eglSurface = + eglCreateWindowSurface(eglDisplay, configs[i], + (NativeDisplayType) win, + NULL)) != EGL_NO_SURFACE) + break; + } + else + { + if ((eglSurface = + eglCreateWindowSurface( eglDisplay, configs[i], + (NativeDisplayType)NULL, + NULL)) != EGL_NO_SURFACE) + break; + } + } + if (eglSurface == EGL_NO_SURFACE) + GLimp_HandleError(); + + if ((eglContext = + eglCreateContext(eglDisplay, configs[i], EGL_NO_CONTEXT, + NULL)) == EGL_NO_CONTEXT) + GLimp_HandleError(); + + if (!eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) + GLimp_HandleError(); + + *winRet = eglSurface; + *ctxRet = eglContext; +} + +static qboolean GLimp_HaveExtension(const char *ext) +{ + const char *ptr = Q_stristr( glConfig.extensions_string, ext ); + if (ptr == NULL) + return qfalse; + ptr += strlen(ext); + return ((*ptr == ' ') || (*ptr == '\0')); // verify it's complete string. +} + +static void qglMultiTexCoord2f(GLenum target, GLfloat s, GLfloat t) +{ + qglMultiTexCoord4f(target,s,t,1,1); +} + + +/* +=============== +GLimp_InitExtensions +=============== +*/ +static void GLimp_InitExtensions( void ) +{ + if ( !r_allowExtensions->integer ) + { + ri.Printf( PRINT_ALL, "* IGNORING OPENGL EXTENSIONS *\n" ); + return; + } + + ri.Printf( PRINT_ALL, "Initializing OpenGL extensions\n" ); + + glConfig.textureCompression = TC_NONE; + + // GL_EXT_texture_compression_s3tc + if ( GLimp_HaveExtension( "GL_ARB_texture_compression" ) && + GLimp_HaveExtension( "GL_EXT_texture_compression_s3tc" ) ) + { + if ( r_ext_compressed_textures->value ) + { + glConfig.textureCompression = TC_S3TC_ARB; + ri.Printf( PRINT_ALL, "...using GL_EXT_texture_compression_s3tc\n" ); + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_compression_s3tc\n" ); + } + } + else + { + ri.Printf( PRINT_ALL, "...GL_EXT_texture_compression_s3tc not found\n" ); + } + + // GL_S3_s3tc ... legacy extension before GL_EXT_texture_compression_s3tc. + if (glConfig.textureCompression == TC_NONE) + { + if ( GLimp_HaveExtension( "GL_S3_s3tc" ) ) + { + if ( r_ext_compressed_textures->value ) + { + glConfig.textureCompression = TC_S3TC; + ri.Printf( PRINT_ALL, "...using GL_S3_s3tc\n" ); + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_S3_s3tc\n" ); + } + } + else + { + ri.Printf( PRINT_ALL, "...GL_S3_s3tc not found\n" ); + } + } + + + // GL_EXT_texture_env_add + glConfig.textureEnvAddAvailable = qtrue; //qfalse; +#if 0 + if ( GLimp_HaveExtension( "EXT_texture_env_add" ) ) + { + if ( r_ext_texture_env_add->integer ) + { + glConfig.textureEnvAddAvailable = qtrue; + ri.Printf( PRINT_ALL, "...using GL_EXT_texture_env_add\n" ); + } + else + { + glConfig.textureEnvAddAvailable = qfalse; + ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_env_add\n" ); + } + } + else + { + ri.Printf( PRINT_ALL, "...GL_EXT_texture_env_add not found\n" ); + } +#endif + + // GL_ARB_multitexture + /* + qglMultiTexCoord2fARB = NULL; + qglActiveTextureARB = NULL; + qglClientActiveTextureARB = NULL; + */ + //if ( GLimp_HaveExtension( "GL_ARB_multitexture" ) ) + { + if ( r_ext_multitexture->value ) + { + qglMultiTexCoord2fARB = qglMultiTexCoord2f; + qglActiveTextureARB = qglActiveTexture; + qglClientActiveTextureARB = qglClientActiveTexture; + + if ( qglActiveTextureARB ) + { + GLint glint = 0; + qglGetIntegerv( GL_MAX_TEXTURE_UNITS, &glint ); + glConfig.numTextureUnits = (int) glint; + if ( glConfig.numTextureUnits > 1 ) + { + ri.Printf( PRINT_ALL, "...using GL_ARB_multitexture\n" ); + } + else + { + qglMultiTexCoord2fARB = NULL; + qglActiveTextureARB = NULL; + qglClientActiveTextureARB = NULL; + ri.Printf( PRINT_ALL, "...not using GL_ARB_multitexture, < 2 texture units\n" ); + } + } + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_ARB_multitexture\n" ); + } + } +#if 0 + else + { + ri.Printf( PRINT_ALL, "...GL_ARB_multitexture not found\n" ); + } +#endif + +#if 0 + // GL_EXT_compiled_vertex_array + if ( GLimp_HaveExtension( "GL_EXT_compiled_vertex_array" ) ) + { + if ( r_ext_compiled_vertex_array->value ) + { + ri.Printf( PRINT_ALL, "...using GL_EXT_compiled_vertex_array\n" ); + qglLockArraysEXT = ( void ( APIENTRY * )( GLint, GLint ) ) SDL_GL_GetProcAddress( "glLockArraysEXT" ); + qglUnlockArraysEXT = ( void ( APIENTRY * )( void ) ) SDL_GL_GetProcAddress( "glUnlockArraysEXT" ); + if (!qglLockArraysEXT || !qglUnlockArraysEXT) + { + ri.Error (ERR_FATAL, "bad getprocaddress"); + } + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_EXT_compiled_vertex_array\n" ); + } + } + else +#endif + { + ri.Printf( PRINT_ALL, "...GL_EXT_compiled_vertex_array not found\n" ); + } + + textureFilterAnisotropic = qfalse; +#if 0 + if ( GLimp_HaveExtension( "GL_EXT_texture_filter_anisotropic" ) ) + { + if ( r_ext_texture_filter_anisotropic->integer ) { + qglGetIntegerv( GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, (GLint *)&maxAnisotropy ); + if ( maxAnisotropy <= 0 ) { + ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not properly supported!\n" ); + maxAnisotropy = 0; + } + else + { + ri.Printf( PRINT_ALL, "...using GL_EXT_texture_filter_anisotropic (max: %i)\n", maxAnisotropy ); + textureFilterAnisotropic = qtrue; + } + } + else + { + ri.Printf( PRINT_ALL, "...ignoring GL_EXT_texture_filter_anisotropic\n" ); + } + } + else +#endif + { + ri.Printf( PRINT_ALL, "...GL_EXT_texture_filter_anisotropic not found\n" ); + } +} + +void GLimp_Init(void) +{ + Screen *screen = NULL; + Visual *vis; + EGLint major, minor; + + ri.Printf(PRINT_ALL, "Initializing OpenGL subsystem\n"); + + cvarPndMode = ri.Cvar_Get("x11", "0", 0); + pandora_driver_mode_x11 = cvarPndMode->value; + + bzero(&glConfig, sizeof(glConfig)); + + if (pandora_driver_mode_x11) + { + if (!(dpy = XOpenDisplay(NULL))) { + printf("Error: couldn't open display \n"); + assert(0); + } + screen = XDefaultScreenOfDisplay(dpy); + vis = DefaultVisual(dpy, DefaultScreen(dpy)); + + eglDisplay = eglGetDisplay((NativeDisplayType) dpy); + } + else + { + dpy = NULL; + eglDisplay = eglGetDisplay((NativeDisplayType)NULL ); + } + + if (!eglInitialize(eglDisplay, &major, &minor)) + GLimp_HandleError(); + + make_window(dpy, screen, eglDisplay, &eglSurface, &eglContext); + + if (pandora_driver_mode_x11) + { + XMoveResizeWindow(dpy, win, 0, 0, WidthOfScreen(screen), + HeightOfScreen(screen)); + glConfig.vidWidth = WidthOfScreen(screen); + glConfig.vidHeight = HeightOfScreen(screen); + } + else + { + glConfig.vidWidth = 800; + glConfig.vidHeight = 480; + } + + glConfig.isFullscreen = r_fullscreen->integer; + glConfig.windowAspect = (float)glConfig.vidWidth / glConfig.vidHeight; + // FIXME + //glConfig.colorBits = 0 + //glConfig.stencilBits = 0; + //glConfig.depthBits = 0; + glConfig.textureCompression = TC_NONE; + + // This values force the UI to disable driver selection + glConfig.driverType = GLDRV_ICD; + glConfig.hardwareType = GLHW_GENERIC; + + Q_strncpyz(glConfig.vendor_string, + (const char *)qglGetString(GL_VENDOR), + sizeof(glConfig.vendor_string)); + Q_strncpyz(glConfig.renderer_string, + (const char *)qglGetString(GL_RENDERER), + sizeof(glConfig.renderer_string)); + Q_strncpyz(glConfig.version_string, + (const char *)qglGetString(GL_VERSION), + sizeof(glConfig.version_string)); + Q_strncpyz(glConfig.extensions_string, + (const char *)qglGetString(GL_EXTENSIONS), + sizeof(glConfig.extensions_string)); + + qglLockArraysEXT = qglLockArrays; + qglUnlockArraysEXT = qglUnlockArrays; + + GLimp_InitExtensions(); + +#if 0 + if ( !SDL_WasInit(SDL_INIT_VIDEO) ) + { + char driverName[ 64 ]; + + if ( SDL_Init(SDL_INIT_VIDEO) == -1 ) + { + ri.Printf( PRINT_ALL, "SDL_Init( SDL_INIT_VIDEO ) FAILED (%s)\n", + SDL_GetError()); + } + + SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 ); + ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName ); + Cvar_Set( "r_sdlDriver", driverName ); + } +#endif + IN_Init( ); + + ri.Printf(PRINT_ALL, "------------------\n"); +} + +void GLimp_LogComment(char *comment) +{ + //fprintf(stderr, "%s: %s\n", __func__, comment); +} + +void GLimp_EndFrame(void) +{ + if (Q_stricmp(r_drawBuffer->string, "GL_FRONT") != 0) { + eglSwapBuffers(eglDisplay, eglSurface); + } + + if (pandora_driver_mode_x11) + XForceScreenSaver(dpy, ScreenSaverReset); + +} + +void GLimp_Shutdown(void) +{ + IN_Shutdown(); + + eglDestroyContext(eglDisplay, eglContext); + eglDestroySurface(eglDisplay, eglSurface); + eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(eglDisplay); + + if (pandora_driver_mode_x11) + { + XDestroyWindow(dpy, win); + XCloseDisplay(dpy); + } +} + +#if 1 +void qglArrayElement(GLint i) +{ +} + +void qglCallList(GLuint list) +{ +} + +void qglDrawBuffer(GLenum mode) +{ +} + +void qglLockArrays(GLint i, GLsizei size) +{ +} + +void qglUnlockArrays(void) +{ +} +#endif + +#if 1 +void GLimp_SetGamma(unsigned char red[256], unsigned char green[256], + unsigned char blue[256]) +{ +} + +qboolean GLimp_SpawnRenderThread(void (*function) (void)) +{ + return qfalse; +} + +void GLimp_FrontEndSleep(void) +{ +} + +void *GLimp_RendererSleep(void) +{ + return NULL; +} + +void GLimp_RenderThreadWrapper(void *data) +{ +} + +void GLimp_WakeRenderer(void *data) +{ +} +#endif diff --git a/code/pnd/egl_glimp.h b/code/pnd/egl_glimp.h new file mode 100755 index 0000000..cd09256 --- /dev/null +++ b/code/pnd/egl_glimp.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2009 Nokia Corporation. All rights reserved. + */ + +#ifndef __EGL_GLIMP_H__ +#define __EGL_GLIMP_H__ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/param.h> + +#include <X11/keysym.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> + +#include <GLES/egl.h> +#include <GLES/gl.h> + +#include "egl_input.h" + +#ifndef GLAPI +#define GLAPI extern +#endif + +#ifndef GLAPIENTRY +#define GLAPIENTRY +#endif + +#ifndef APIENTRY +#define APIENTRY GLAPIENTRY +#endif + +/* "P" suffix to be used for a pointer to a function */ +#ifndef APIENTRYP +#define APIENTRYP APIENTRY * +#endif + +#ifndef GLAPIENTRYP +#define GLAPIENTRYP GLAPIENTRY * +#endif + +extern Display *dpy; +extern Window win; +extern EGLContext eglContext; +extern EGLDisplay eglDisplay; +extern EGLSurface eglSurface; +int Sys_XTimeToSysTime(Time xtime); +void GLimp_Init(void); +void GLimp_LogComment(char *comment); +void GLimp_EndFrame(void); +void GLimp_Shutdown(void); +void qglArrayElement(GLint i); +void qglCallList(GLuint list); +void qglDrawBuffer(GLenum mode); +void qglLockArrays(GLint i, GLsizei size); +void qglUnlockArrays(void); +void GLimp_SetGamma(unsigned char red[256], unsigned char green[256],unsigned char blue[256]); +//qboolean GLimp_SpawnRenderThread(void (*function) (void)); +void GLimp_FrontEndSleep(void); +void *GLimp_RendererSleep(void); +void GLimp_RenderThreadWrapper(void *data); +void GLimp_WakeRenderer(void *data); + +#define WINDOW_CLASS_NAME "Quake III: Arena" + +#define KEY_MASK (KeyPressMask | KeyReleaseMask) +#define MOUSE_MASK (ButtonPressMask | ButtonReleaseMask | PointerMotionMask | ButtonMotionMask) +#define X_MASK (KEY_MASK | MOUSE_MASK | VisibilityChangeMask | StructureNotifyMask) + + +#endif diff --git a/code/pnd/egl_input.c b/code/pnd/egl_input.c new file mode 100755 index 0000000..bfdb51e --- /dev/null +++ b/code/pnd/egl_input.c @@ -0,0 +1,97 @@ +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/param.h> +#include <sys/stat.h> +#include <sys/types.h> +#include <unistd.h> + +#include "pnd_event.h" +#include "egl_glimp.h" +#include "../client/client.h" +#include "../renderer/tr_local.h" +#include "../qcommon/q_shared.h" + +static qboolean mouse_active = qfalse; +static qboolean mouse_avail = qfalse; + +cvar_t *in_nograb; +static cvar_t *in_mouse; + +void IN_ActivateMouse(void) +{ + if (!mouse_avail || !dpy || !win) + return; + + if (!mouse_active) { + if (!in_nograb->value) + //install_grabs(); + mouse_active = qtrue; + } +} + +void IN_DeactivateMouse(void) +{ + if (!mouse_avail || !dpy || !win) + return; + + if (mouse_active) { + if (!in_nograb->value) + //uninstall_grabs(); + mouse_active = qfalse; + } +} + +void IN_Frame(void) +{ + qboolean loading; + + //HandleEvents(); + PND_SendAllEvents(); + + // If not DISCONNECTED (main menu) or ACTIVE (in game), we're loading + loading = !!(cls.state != CA_DISCONNECTED && cls.state != CA_ACTIVE); + + if (!r_fullscreen->integer && (Key_GetCatcher() & KEYCATCH_CONSOLE)) { + // Console is down in windowed mode + IN_DeactivateMouse(); + } else if (!r_fullscreen->integer && loading) { + // Loading in windowed mode + IN_DeactivateMouse(); + } else + IN_ActivateMouse(); +} + +void IN_Init(void) +{ + Com_DPrintf("\n------- Input Initialization -------\n"); + + PND_Setup_Controls(); + + // mouse variables + in_mouse = Cvar_Get("in_mouse", "1", CVAR_ARCHIVE); + in_nograb = Cvar_Get("in_nograb", "0", CVAR_ARCHIVE); + + if (in_mouse->value) { + mouse_avail = qtrue; + IN_ActivateMouse(); + } else { + IN_DeactivateMouse(); + mouse_avail = qfalse; + } + + Com_DPrintf("------------------------------------\n"); +} + +void IN_Shutdown(void) +{ + IN_DeactivateMouse(); + mouse_avail = qfalse; + + PND_Close_Controls(); +} + +void IN_Restart(void) +{ + IN_Init(); +} diff --git a/code/pnd/egl_input.h b/code/pnd/egl_input.h new file mode 100755 index 0000000..53d65a7 --- /dev/null +++ b/code/pnd/egl_input.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2009 Nokia Corporation. All rights reserved. + */ + +#ifndef __EGL_INPUT_H__ +#define __EGL_INPUT_H__ + +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/param.h> + +#include "../qcommon/q_shared.h" + +extern cvar_t *in_nograb; +qboolean IN_MotionPressed(void); +void IN_ActivateMouse(void); +void IN_DeactivateMouse(void); +void IN_Frame(void); +void IN_Init(void); +void IN_Shutdown(void); +void IN_Restart(void); + +#endif diff --git a/code/pnd/pnd_event.c b/code/pnd/pnd_event.c new file mode 100755 index 0000000..f7a7cc6 --- /dev/null +++ b/code/pnd/pnd_event.c @@ -0,0 +1,435 @@ +#include "pnd_event.h" +#include "pnd_type.h" + +#include "../qcommon/q_shared.h" +#include "../client/keycodes.h" +#include "../qcommon/qcommon.h" + +cvar_t* cvarKey; +cvar_t* cvarMouse; + +unsigned char keymap[128] = +{ + 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', /* 9 */ + '9', '0', '-', '=', K_BACKSPACE, /* Backspace */ + K_TAB, /* Tab */ + 'q', 'w', 'e', 'r', /* 19 */ + 't', 'y', 'u', 'i', 'o', 'p', '[', ']', K_ENTER, /* Enter key */ + K_CTRL, /* 29 - Control */ + 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', /* 39 */ + '\'', '`', K_SHIFT, /* Left shift */ + '\\', 'z', 'x', 'c', 'v', 'b', 'n', /* 49 */ + 'm', ',', '.', '/', K_SHIFT, /* Right shift */ + '*', + K_ALT, /* Alt */ + K_SPACE, /* Space bar */ + 0, /* Caps lock */ + K_F1, /* 59 - F1 key ... > */ + K_F2, K_F3, K_F4, K_F5, K_F6, K_F7, K_F8, K_F9, + K_F10, /* < ... F10 */ + 0, /* 69 - Num lock*/ + 0, /* Scroll Lock */ + K_HOME, /* Home key */ + K_UPARROW, /* Up Arrow */ + K_PGUP, /* Page Up */ + '-', + K_LEFTARROW, /* Left Arrow */ + 0, + K_RIGHTARROW, /* Right Arrow */ + '+', + K_END, /* 79 - End key*/ + K_DOWNARROW, /* Down Arrow */ + K_PGDN, /* Page Down */ + K_INS, /* Insert Key */ + K_DEL, /* Delete Key */ + 0, 0, 0, + K_F11, /* F11 Key */ + K_F12, /* F12 Key */ + 0, /* All other keys are undefined */ +}; + +char event_name[30]; +int fd_usbk, fd_usbm, fd_gpio, fd_pndk, fd_nub1, fd_nub2, fd_ts, rd, i, j, k; +struct input_event ev[64]; +int version; +unsigned short id[4]; +unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; +char dev_name[256] = "Unknown"; +int absolute[5]; +int prevtime; + +char pnd_ts[20] = "ADS784x Touchscreen"; +char pnd_nub1[9] = "vsense66"; +char pnd_nub2[9] = "vsense67"; +char pnd_key[19] = "omap_twl4030keypad"; +char pnd_gpio[10] = "gpio-keys"; + +#define DEV_TS 0 +#define DEV_NUB1 1 +#define DEV_NUB2 2 +#define DEV_PNDK 3 +#define DEV_GPIO 4 +#define DEV_USBK 5 +#define DEV_USBM 6 + +#define NUB1_CUTOFF 100 +#define NUB2_CUTOFF 5 +#define NUB2_SCALE 10 + +int mx, my, buttonstate, lasttime; + +void PND_Setup_Controls( void ) +{ + int event_key = 0; + int event_mouse = 0; + + printf( "Setting up Pandora Controls\n" ); + + cvarKey = Cvar_Get("usbk", "0", 0); + cvarMouse = Cvar_Get("usbm", "0", 0); + + event_key = cvarKey->value; + event_mouse = cvarMouse->value; + + // Static Controls + // Pandora keyboard + fd_pndk = PND_OpenEventDeviceByName(pnd_key); + // Pandora buttons + fd_gpio = PND_OpenEventDeviceByName(pnd_gpio); + // Pandora touchscreen + fd_ts = PND_OpenEventDeviceByName(pnd_ts); + // Pandora analog nub's + fd_nub1 = PND_OpenEventDeviceByName(pnd_nub1); + fd_nub2 = PND_OpenEventDeviceByName(pnd_nub2); + + // Dynamic Controls + // USB keyboard + if( event_key > 0 ) { + fd_usbk = PND_OpenEventDeviceByID(event_key); + } else { + printf( "No device selected for USB keyboard\n" ); + } + // USB mouse + if( event_mouse > 0 ) { + fd_usbm = PND_OpenEventDeviceByID(event_mouse); + } else { + printf( "No device selected for USB mouse\n" ); + } +} + +void PND_Close_Controls( void ) +{ + printf( "Closing Pandora Controls\n" ); + + if( fd_pndk > 0 ) + close(fd_pndk ); + if( fd_gpio > 0 ) + close(fd_gpio ); + if( fd_ts > 0 ) + close(fd_ts ); + if( fd_nub1 > 0 ) + close(fd_nub1 ); + if( fd_nub2 > 0 ) + close(fd_nub2 ); + if( fd_usbk > 0 ) + close(fd_usbk ); + if( fd_usbm > 0 ) + close(fd_usbm ); +} + +void PND_SendAllEvents( void ) +{ + // Read the events from the controls + PND_SendKeyEvents(); + PND_SendRelEvents(); + PND_SendAbsEvents(); +} + +void PND_SendKeyEvents( void ) +{ + PND_ReadEvents( fd_pndk, DEV_PNDK ); + PND_ReadEvents( fd_gpio, DEV_GPIO ); + PND_ReadEvents( fd_usbk, DEV_USBK ); + PND_ReadEvents( fd_nub1, DEV_NUB1 ); +} + +void PND_SendRelEvents( void ) +{ + PND_ReadEvents( fd_nub2, DEV_NUB2 ); + PND_ReadEvents( fd_usbm, DEV_USBM ); + + if ( (mx != 0 || my != 0) && (Sys_Milliseconds() - lasttime > 5) ) + { + Com_QueueEvent( 0, SE_MOUSE, mx, my, 0, NULL ); + } + lasttime = Sys_Milliseconds(); +} + +void PND_SendAbsEvents( void ) +{ + PND_ReadEvents( fd_ts, DEV_TS ); +} + +void PND_ReadEvents( int fd, int device ) +{ + if( fd != 0 ) + { + rd = read(fd, ev, sizeof(struct input_event) * 64); + + if (rd > (int) sizeof(struct input_event)) + { + for (i = 0; i < rd / sizeof(struct input_event); i++) + { + PND_CheckEvent( &ev[i], device ); + } + } + } +} + +void PND_CheckEvent( struct input_event *event, int device ) +{ + int sym, value; + long rel_x, rel_y; + + //printf( "Device %d Type %d Code %d Value %d\n", device, event->type, event->code, event->value ); + + rel_x = 0; + rel_y = 0; + sym = 0; + value = event->value; + switch( event->type ) + { + case EV_KEY: + switch( event->code ) + { + case 103: + sym = K_UPARROW; + break; + case 108: + sym = K_DOWNARROW; + break; + case 105: + sym = K_LEFTARROW; + break; + case 106: + sym = K_RIGHTARROW; + break; + case 139: // menu + sym = K_F1; + break; + case 56: // start + sym = K_ENTER; + break; + case 29: // select + sym = K_ESCAPE; + break; + case 104: // up (y) + sym = 'y'; + break; + case 102: // right (a) + sym = 'a'; + break; + case 109: // down (x) + sym = 'x'; + break; + case 107: // left (b) + sym = 'b'; + break; +/* + case 54: // left shoulder + sym = 'l'; + break; + case 97: // right shoulder + sym = 'r'; + break; +*/ + case 54: + sym = K_MOUSE1; + break; + case 97: + sym = K_MOUSE2; + break; + default: + if( keymap[event->code]>0 ) + sym = keymap[event->code]; + break; + } + break; + case EV_REL: + switch( device ) + { + case DEV_USBM: + switch( event->code ) + { + case REL_X: + rel_x = value; + break; + case REL_Y: + rel_y = value; + break; + } + break; + } + break; + case EV_ABS: + switch( device ) + { + case DEV_TS: +#if 0 + if( event->code == ABS_X ) { + rel_x = abs_x - value; + abs_x = value; + } + if( event->code == ABS_Y ) { + rel_y = abs_y - value; + abs_y = value; + } +#endif + break; + case DEV_NUB1: + if( event->code == ABS_X ) { + //printf( "nub1 x %3d\n", value ); + if( abs(value) > NUB1_CUTOFF ) { + if( value > 0 ) { + sym = K_RIGHTARROW; + value = 1; + } + else if( value < 0 ) { + sym = K_LEFTARROW; + value = 1; + } + } + else + { + sym = 0; + value = 0; + Com_QueueEvent(0, SE_KEY, K_RIGHTARROW, 0, 0, NULL); + Com_QueueEvent(0, SE_KEY, K_LEFTARROW, 0, 0, NULL); + } + } + + if( event->code == ABS_Y ) { + //printf( "nub1 y %3d\n", value ); + if( abs(value) > NUB1_CUTOFF ) { + if( value > 0 ) { + sym = K_DOWNARROW; + value = 1; + } + else if( value < 0 ) { + sym = K_UPARROW; + value = 1; + } + } + else + { + sym = 0; + value = 0; + Com_QueueEvent(0, SE_KEY, K_DOWNARROW, 0, 0, NULL); + Com_QueueEvent(0, SE_KEY, K_UPARROW, 0, 0, NULL); + } + } + break; + case DEV_NUB2: + if(event->code == ABS_X) + { + if( abs(value) > NUB2_CUTOFF ) { + mx = value / NUB2_SCALE; + } + else { + mx = 0; + } + } + + if(event->code == ABS_Y) + { + if( abs(value) > NUB2_CUTOFF ) { + my = value / NUB2_SCALE; + } + else { + my = 0; + } + } + break; + } + break; + } + + if( sym > 0 ) { + Com_QueueEvent(0, SE_KEY, sym, value, 0, NULL); + } + + if( rel_x != 0 || rel_y != 0 ) + { + Com_QueueEvent( 0, SE_MOUSE, rel_x, rel_y, 0, NULL ); + } + + //printf( "nub2 x %3d y %3d\n", nub2_x, nub2_y ); +} + +int PND_OpenEventDeviceByID( int event_id ) +{ + int fd; + + snprintf( event_name, sizeof(event_name), "/dev/input/event%d", event_id ); + printf( "Device: %s\n", event_name ); + if ((fd = open(event_name, O_RDONLY | O_NDELAY)) < 0) { + perror("ERROR: Could not open device"); + return 0; + } + + if (ioctl(fd, EVIOCGVERSION, &version)) { + perror("evtest: can't get version"); + return 0; + } + + printf("Input driver version is %d.%d.%d\n", + version >> 16, (version >> 8) & 0xff, version & 0xff); + + ioctl(fd, EVIOCGID, id); + printf("Input device ID: bus 0x%x vendor 0x%x product 0x%x version 0x%x\n", + id[ID_BUS], id[ID_VENDOR], id[ID_PRODUCT], id[ID_VERSION]); + + ioctl(fd, EVIOCGNAME(sizeof(dev_name)), dev_name); + printf("Input device name: \"%s\"\n", dev_name); + + return fd; +} + +int PND_OpenEventDeviceByName( char device_name[] ) +{ + int fd; + + for (i = 0; 1; i++) + { + snprintf( event_name, sizeof(event_name), "/dev/input/event%d", i ); + //printf( "Device: %s\n", event_name ); + if ((fd = open(event_name, O_RDONLY | O_NDELAY)) < 0) { + perror("ERROR: Could not open device"); + return 0; + } + if (fd < 0) break; /* no more devices */ + + ioctl(fd, EVIOCGNAME(sizeof(dev_name)), dev_name); + if (strcmp(dev_name, device_name) == 0) + { + if (ioctl(fd, EVIOCGVERSION, &version)) { + perror("evtest: can't get version"); + return 0; + } + + printf("Input driver version is %d.%d.%d\n", + version >> 16, (version >> 8) & 0xff, version & 0xff); + + ioctl(fd, EVIOCGID, id); + printf("Input device ID: bus 0x%x vendor 0x%x product 0x%x version 0x%x\n", + id[ID_BUS], id[ID_VENDOR], id[ID_PRODUCT], id[ID_VERSION]); + + ioctl(fd, EVIOCGNAME(sizeof(dev_name)), dev_name); + printf("Input device name: \"%s\"\n", dev_name); + + return fd; + } + close(fd); /* we don't need this device */ + } + return 0; +} diff --git a/code/pnd/pnd_event.h b/code/pnd/pnd_event.h new file mode 100755 index 0000000..6f19cb1 --- /dev/null +++ b/code/pnd/pnd_event.h @@ -0,0 +1,12 @@ +#ifndef PND_EVENT_H +#define PND_EVENT_H + +void PND_Setup_Controls( void ); +void PND_Close_Controls( void ); + +void PND_SendAllEvents( void ); +void PND_SendKeyEvents( void ); +void PND_SendRelEvents( void ); +void PND_SendAbsEvents( void ); + +#endif diff --git a/code/pnd/pnd_type.h b/code/pnd/pnd_type.h new file mode 100755 index 0000000..2b95db1 --- /dev/null +++ b/code/pnd/pnd_type.h @@ -0,0 +1,306 @@ +/* + * $Id: evtest.c,v 1.23 2005/02/06 13:51:42 vojtech Exp $ + * + * Copyright (c) 1999-2000 Vojtech Pavlik + * + * Event device test program + */ + +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Should you need to contact me, the author, you can do so either by + * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: + * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic + */ +#ifndef PND_TYPE_H +#define PND_TYPE_H + +#include <stdint.h> + +#include <linux/input.h> + +#include <string.h> +#include <fcntl.h> +#include <unistd.h> +#include <stdio.h> + +#ifndef EV_SYN +#define EV_SYN 0 +#endif + +char *events[EV_MAX + 1] = { + [0 ... EV_MAX] = NULL, + [EV_SYN] = "Sync", [EV_KEY] = "Key", + [EV_REL] = "Relative", [EV_ABS] = "Absolute", + [EV_MSC] = "Misc", [EV_LED] = "LED", + [EV_SND] = "Sound", [EV_REP] = "Repeat", + [EV_FF] = "ForceFeedback", [EV_PWR] = "Power", + [EV_FF_STATUS] = "ForceFeedbackStatus", +}; + +char *pndkeys[KEY_MAX + 1] = { + [0 ... KEY_MAX] = NULL, + [KEY_RESERVED] = "Reserved", [KEY_ESC] = "Esc", + [KEY_1] = "1", [KEY_2] = "2", + [KEY_3] = "3", [KEY_4] = "4", + [KEY_5] = "5", [KEY_6] = "6", + [KEY_7] = "7", [KEY_8] = "8", + [KEY_9] = "9", [KEY_0] = "0", + [KEY_MINUS] = "Minus", [KEY_EQUAL] = "Equal", + [KEY_BACKSPACE] = "Backspace", [KEY_TAB] = "Tab", + [KEY_Q] = "Q", [KEY_W] = "W", + [KEY_E] = "E", [KEY_R] = "R", + [KEY_T] = "T", [KEY_Y] = "Y", + [KEY_U] = "U", [KEY_I] = "I", + [KEY_O] = "O", [KEY_P] = "P", + [KEY_LEFTBRACE] = "LeftBrace", [KEY_RIGHTBRACE] = "RightBrace", + [KEY_ENTER] = "Enter", [KEY_LEFTCTRL] = "LeftControl", + [KEY_A] = "A", [KEY_S] = "S", + [KEY_D] = "D", [KEY_F] = "F", + [KEY_G] = "G", [KEY_H] = "H", + [KEY_J] = "J", [KEY_K] = "K", + [KEY_L] = "L", [KEY_SEMICOLON] = "Semicolon", + [KEY_APOSTROPHE] = "Apostrophe", [KEY_GRAVE] = "Grave", + [KEY_LEFTSHIFT] = "LeftShift", [KEY_BACKSLASH] = "BackSlash", + [KEY_Z] = "Z", [KEY_X] = "X", + [KEY_C] = "C", [KEY_V] = "V", + [KEY_B] = "B", [KEY_N] = "N", + [KEY_M] = "M", [KEY_COMMA] = "Comma", + [KEY_DOT] = "Dot", [KEY_SLASH] = "Slash", + [KEY_RIGHTSHIFT] = "RightShift", [KEY_KPASTERISK] = "KPAsterisk", + [KEY_LEFTALT] = "LeftAlt", [KEY_SPACE] = "Space", + [KEY_CAPSLOCK] = "CapsLock", [KEY_F1] = "F1", + [KEY_F2] = "F2", [KEY_F3] = "F3", + [KEY_F4] = "F4", [KEY_F5] = "F5", + [KEY_F6] = "F6", [KEY_F7] = "F7", + [KEY_F8] = "F8", [KEY_F9] = "F9", + [KEY_F10] = "F10", [KEY_NUMLOCK] = "NumLock", + [KEY_SCROLLLOCK] = "ScrollLock", [KEY_KP7] = "KP7", + [KEY_KP8] = "KP8", [KEY_KP9] = "KP9", + [KEY_KPMINUS] = "KPMinus", [KEY_KP4] = "KP4", + [KEY_KP5] = "KP5", [KEY_KP6] = "KP6", + [KEY_KPPLUS] = "KPPlus", [KEY_KP1] = "KP1", + [KEY_KP2] = "KP2", [KEY_KP3] = "KP3", + [KEY_KP0] = "KP0", [KEY_KPDOT] = "KPDot", + [KEY_ZENKAKUHANKAKU] = "Zenkaku/Hankaku", [KEY_102ND] = "102nd", + [KEY_F11] = "F11", [KEY_F12] = "F12", + [KEY_RO] = "RO", [KEY_KATAKANA] = "Katakana", + [KEY_HIRAGANA] = "HIRAGANA", [KEY_HENKAN] = "Henkan", + [KEY_KATAKANAHIRAGANA] = "Katakana/Hiragana", [KEY_MUHENKAN] = "Muhenkan", + [KEY_KPJPCOMMA] = "KPJpComma", [KEY_KPENTER] = "KPEnter", + [KEY_RIGHTCTRL] = "RightCtrl", [KEY_KPSLASH] = "KPSlash", + [KEY_SYSRQ] = "SysRq", [KEY_RIGHTALT] = "RightAlt", + [KEY_LINEFEED] = "LineFeed", [KEY_HOME] = "Home", + [KEY_UP] = "Up", [KEY_PAGEUP] = "PageUp", + [KEY_LEFT] = "Left", [KEY_RIGHT] = "Right", + [KEY_END] = "End", [KEY_DOWN] = "Down", + [KEY_PAGEDOWN] = "PageDown", [KEY_INSERT] = "Insert", + [KEY_DELETE] = "Delete", [KEY_MACRO] = "Macro", + [KEY_MUTE] = "Mute", [KEY_VOLUMEDOWN] = "VolumeDown", + [KEY_VOLUMEUP] = "VolumeUp", [KEY_POWER] = "Power", + [KEY_KPEQUAL] = "KPEqual", [KEY_KPPLUSMINUS] = "KPPlusMinus", + [KEY_PAUSE] = "Pause", [KEY_KPCOMMA] = "KPComma", + [KEY_HANGUEL] = "Hanguel", [KEY_HANJA] = "Hanja", + [KEY_YEN] = "Yen", [KEY_LEFTMETA] = "LeftMeta", + [KEY_RIGHTMETA] = "RightMeta", [KEY_COMPOSE] = "Compose", + [KEY_STOP] = "Stop", [KEY_AGAIN] = "Again", + [KEY_PROPS] = "Props", [KEY_UNDO] = "Undo", + [KEY_FRONT] = "Front", [KEY_COPY] = "Copy", + [KEY_OPEN] = "Open", [KEY_PASTE] = "Paste", + [KEY_FIND] = "Find", [KEY_CUT] = "Cut", + [KEY_HELP] = "Help", [KEY_MENU] = "Menu", + [KEY_CALC] = "Calc", [KEY_SETUP] = "Setup", + [KEY_SLEEP] = "Sleep", [KEY_WAKEUP] = "WakeUp", + [KEY_FILE] = "File", [KEY_SENDFILE] = "SendFile", + [KEY_DELETEFILE] = "DeleteFile", [KEY_XFER] = "X-fer", + [KEY_PROG1] = "Prog1", [KEY_PROG2] = "Prog2", + [KEY_WWW] = "WWW", [KEY_MSDOS] = "MSDOS", + [KEY_COFFEE] = "Coffee", [KEY_DIRECTION] = "Direction", + [KEY_CYCLEWINDOWS] = "CycleWindows", [KEY_MAIL] = "Mail", + [KEY_BOOKMARKS] = "Bookmarks", [KEY_COMPUTER] = "Computer", + [KEY_BACK] = "Back", [KEY_FORWARD] = "Forward", + [KEY_CLOSECD] = "CloseCD", [KEY_EJECTCD] = "EjectCD", + [KEY_EJECTCLOSECD] = "EjectCloseCD", [KEY_NEXTSONG] = "NextSong", + [KEY_PLAYPAUSE] = "PlayPause", [KEY_PREVIOUSSONG] = "PreviousSong", + [KEY_STOPCD] = "StopCD", [KEY_RECORD] = "Record", + [KEY_REWIND] = "Rewind", [KEY_PHONE] = "Phone", + [KEY_ISO] = "ISOKey", [KEY_CONFIG] = "Config", + [KEY_HOMEPAGE] = "HomePage", [KEY_REFRESH] = "Refresh", + [KEY_EXIT] = "Exit", [KEY_MOVE] = "Move", + [KEY_EDIT] = "Edit", [KEY_SCROLLUP] = "ScrollUp", + [KEY_SCROLLDOWN] = "ScrollDown", [KEY_KPLEFTPAREN] = "KPLeftParenthesis", + [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_F13] = "F13", + [KEY_F14] = "F14", [KEY_F15] = "F15", + [KEY_F16] = "F16", [KEY_F17] = "F17", + [KEY_F18] = "F18", [KEY_F19] = "F19", + [KEY_F20] = "F20", [KEY_F21] = "F21", + [KEY_F22] = "F22", [KEY_F23] = "F23", + [KEY_F24] = "F24", [KEY_PLAYCD] = "PlayCD", + [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3", + [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend", + [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play", + [KEY_FASTFORWARD] = "Fast Forward", [KEY_BASSBOOST] = "Bass Boost", + [KEY_PRINT] = "Print", [KEY_HP] = "HP", + [KEY_CAMERA] = "Camera", [KEY_SOUND] = "Sound", + [KEY_QUESTION] = "Question", [KEY_EMAIL] = "Email", + [KEY_CHAT] = "Chat", [KEY_SEARCH] = "Search", + [KEY_CONNECT] = "Connect", [KEY_FINANCE] = "Finance", + [KEY_SPORT] = "Sport", [KEY_SHOP] = "Shop", + [KEY_ALTERASE] = "Alternate Erase", [KEY_CANCEL] = "Cancel", + [KEY_BRIGHTNESSDOWN] = "Brightness down", [KEY_BRIGHTNESSUP] = "Brightness up", + [KEY_MEDIA] = "Media", [KEY_UNKNOWN] = "Unknown", + [BTN_0] = "Btn0", [BTN_1] = "Btn1", + [BTN_2] = "Btn2", [BTN_3] = "Btn3", + [BTN_4] = "Btn4", [BTN_5] = "Btn5", + [BTN_6] = "Btn6", [BTN_7] = "Btn7", + [BTN_8] = "Btn8", [BTN_9] = "Btn9", + [BTN_LEFT] = "LeftBtn", [BTN_RIGHT] = "RightBtn", + [BTN_MIDDLE] = "MiddleBtn", [BTN_SIDE] = "SideBtn", + [BTN_EXTRA] = "ExtraBtn", [BTN_FORWARD] = "ForwardBtn", + [BTN_BACK] = "BackBtn", [BTN_TASK] = "TaskBtn", + [BTN_TRIGGER] = "Trigger", [BTN_THUMB] = "ThumbBtn", + [BTN_THUMB2] = "ThumbBtn2", [BTN_TOP] = "TopBtn", + [BTN_TOP2] = "TopBtn2", [BTN_PINKIE] = "PinkieBtn", + [BTN_BASE] = "BaseBtn", [BTN_BASE2] = "BaseBtn2", + [BTN_BASE3] = "BaseBtn3", [BTN_BASE4] = "BaseBtn4", + [BTN_BASE5] = "BaseBtn5", [BTN_BASE6] = "BaseBtn6", + [BTN_DEAD] = "BtnDead", [BTN_A] = "BtnA", + [BTN_B] = "BtnB", [BTN_C] = "BtnC", + [BTN_X] = "BtnX", [BTN_Y] = "BtnY", + [BTN_Z] = "BtnZ", [BTN_TL] = "BtnTL", + [BTN_TR] = "BtnTR", [BTN_TL2] = "BtnTL2", + [BTN_TR2] = "BtnTR2", [BTN_SELECT] = "BtnSelect", + [BTN_START] = "BtnStart", [BTN_MODE] = "BtnMode", + [BTN_THUMBL] = "BtnThumbL", [BTN_THUMBR] = "BtnThumbR", + [BTN_TOOL_PEN] = "ToolPen", [BTN_TOOL_RUBBER] = "ToolRubber", + [BTN_TOOL_BRUSH] = "ToolBrush", [BTN_TOOL_PENCIL] = "ToolPencil", + [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger", + [BTN_TOOL_MOUSE] = "ToolMouse", [BTN_TOOL_LENS] = "ToolLens", + [BTN_TOUCH] = "Touch", [BTN_STYLUS] = "Stylus", + [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "Tool Doubletap", + [BTN_TOOL_TRIPLETAP] = "Tool Tripletap", [BTN_GEAR_DOWN] = "WheelBtn", + [BTN_GEAR_UP] = "Gear up", [KEY_OK] = "Ok", + [KEY_SELECT] = "Select", [KEY_GOTO] = "Goto", + [KEY_CLEAR] = "Clear", [KEY_POWER2] = "Power2", + [KEY_OPTION] = "Option", [KEY_INFO] = "Info", + [KEY_TIME] = "Time", [KEY_VENDOR] = "Vendor", + [KEY_ARCHIVE] = "Archive", [KEY_PROGRAM] = "Program", + [KEY_CHANNEL] = "Channel", [KEY_FAVORITES] = "Favorites", + [KEY_EPG] = "EPG", [KEY_PVR] = "PVR", + [KEY_MHP] = "MHP", [KEY_LANGUAGE] = "Language", + [KEY_TITLE] = "Title", [KEY_SUBTITLE] = "Subtitle", + [KEY_ANGLE] = "Angle", [KEY_ZOOM] = "Zoom", + [KEY_MODE] = "Mode", [KEY_KEYBOARD] = "Keyboard", + [KEY_SCREEN] = "Screen", [KEY_PC] = "PC", + [KEY_TV] = "TV", [KEY_TV2] = "TV2", + [KEY_VCR] = "VCR", [KEY_VCR2] = "VCR2", + [KEY_SAT] = "Sat", [KEY_SAT2] = "Sat2", + [KEY_CD] = "CD", [KEY_TAPE] = "Tape", + [KEY_RADIO] = "Radio", [KEY_TUNER] = "Tuner", + [KEY_PLAYER] = "Player", [KEY_TEXT] = "Text", + [KEY_DVD] = "DVD", [KEY_AUX] = "Aux", + [KEY_MP3] = "MP3", [KEY_AUDIO] = "Audio", + [KEY_VIDEO] = "Video", [KEY_DIRECTORY] = "Directory", + [KEY_LIST] = "List", [KEY_MEMO] = "Memo", + [KEY_CALENDAR] = "Calendar", [KEY_RED] = "Red", + [KEY_GREEN] = "Green", [KEY_YELLOW] = "Yellow", + [KEY_BLUE] = "Blue", [KEY_CHANNELUP] = "ChannelUp", + [KEY_CHANNELDOWN] = "ChannelDown", [KEY_FIRST] = "First", + [KEY_LAST] = "Last", [KEY_AB] = "AB", + [KEY_NEXT] = "Next", [KEY_RESTART] = "Restart", + [KEY_SLOW] = "Slow", [KEY_SHUFFLE] = "Shuffle", + [KEY_BREAK] = "Break", [KEY_PREVIOUS] = "Previous", + [KEY_DIGITS] = "Digits", [KEY_TEEN] = "TEEN", + [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "Delete EOL", + [KEY_DEL_EOS] = "Delete EOS", [KEY_INS_LINE] = "Insert line", + [KEY_DEL_LINE] = "Delete line", +}; + +char *absval[5] = { "Value", "Min ", "Max ", "Fuzz ", "Flat " }; + +char *relatives[REL_MAX + 1] = { + [0 ... REL_MAX] = NULL, + [REL_X] = "X", [REL_Y] = "Y", + [REL_Z] = "Z", [REL_HWHEEL] = "HWheel", + [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel", + [REL_MISC] = "Misc", +}; + +char *absolutes[ABS_MAX + 1] = { + [0 ... ABS_MAX] = NULL, + [ABS_X] = "X", [ABS_Y] = "Y", + [ABS_Z] = "Z", [ABS_RX] = "Rx", + [ABS_RY] = "Ry", [ABS_RZ] = "Rz", + [ABS_THROTTLE] = "Throttle", [ABS_RUDDER] = "Rudder", + [ABS_WHEEL] = "Wheel", [ABS_GAS] = "Gas", + [ABS_BRAKE] = "Brake", [ABS_HAT0X] = "Hat0X", + [ABS_HAT0Y] = "Hat0Y", [ABS_HAT1X] = "Hat1X", + [ABS_HAT1Y] = "Hat1Y", [ABS_HAT2X] = "Hat2X", + [ABS_HAT2Y] = "Hat2Y", [ABS_HAT3X] = "Hat3X", + [ABS_HAT3Y] = "Hat 3Y", [ABS_PRESSURE] = "Pressure", + [ABS_DISTANCE] = "Distance", [ABS_TILT_X] = "XTilt", + [ABS_TILT_Y] = "YTilt", [ABS_TOOL_WIDTH] = "Tool Width", + [ABS_VOLUME] = "Volume", [ABS_MISC] = "Misc", +}; + +char *misc[MSC_MAX + 1] = { + [ 0 ... MSC_MAX] = NULL, + [MSC_SERIAL] = "Serial", [MSC_PULSELED] = "Pulseled", + [MSC_GESTURE] = "Gesture", [MSC_RAW] = "RawData", + [MSC_SCAN] = "ScanCode", +}; + +char *leds[LED_MAX + 1] = { + [0 ... LED_MAX] = NULL, + [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", + [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", + [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", + [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute", + [LED_MISC] = "Misc", +}; + +char *repeats[REP_MAX + 1] = { + [0 ... REP_MAX] = NULL, + [REP_DELAY] = "Delay", [REP_PERIOD] = "Period" +}; + +char *sounds[SND_MAX + 1] = { + [0 ... SND_MAX] = NULL, + [SND_CLICK] = "Click", [SND_BELL] = "Bell", + [SND_TONE] = "Tone" +}; + +char **names[EV_MAX + 1] = { + [0 ... EV_MAX] = NULL, + [EV_SYN] = events, [EV_KEY] = pndkeys, + [EV_REL] = relatives, [EV_ABS] = absolutes, + [EV_MSC] = misc, [EV_LED] = leds, + [EV_SND] = sounds, [EV_REP] = repeats, +}; + +#define BITS_PER_LONG (sizeof(long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define BIT(x) (1UL<<OFF(x)) +#define LONG(x) ((x)/BITS_PER_LONG) +#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) + +void PND_ReadEvents( int fd, int device ); +void PND_CheckEvent( struct input_event *event, int device ); +int PND_OpenEventDeviceByID( int event_id ); +int PND_OpenEventDeviceByName( char event_name[] ); + +#endif diff --git a/code/pnd/qgl.h b/code/pnd/qgl.h new file mode 100644 index 0000000..f4c3371 --- /dev/null +++ b/code/pnd/qgl.h @@ -0,0 +1,2187 @@ +/**** This file is autogenerated. Run GenerateQGL.pl to update it ****/ + +#ifdef QGL_LOG_GL_CALLS +extern unsigned int QGLLogGLCalls; +extern FILE *QGLDebugFile(void); +#endif + +extern void QGLCheckError(const char *message); +extern unsigned int QGLBeginStarted; + +// This has to be done to avoid infinite recursion between our glGetError wrapper and QGLCheckError() +static inline GLenum _glGetError(void) { + return glGetError(); +} + +// void glAlphaFunc (GLenum func, GLclampf ref); +static inline void qglAlphaFunc(GLenum func, GLclampf ref) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glAlphaFunc(func=%lu, ref=%f)\n", func, ref); +#endif + glAlphaFunc(func, ref); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glAlphaFunc"); +#endif +} + +// void glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +static inline void qglClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClearColor(red=%f, green=%f, blue=%f, alpha=%f)\n", red, green, blue, alpha); +#endif + glClearColor(red, green, blue, alpha); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClearColor"); +#endif +} + +// void glClearDepthf (GLclampf depth); +static inline void qglClearDepthf(GLclampf depth) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClearDepthf(depth=%f)\n", depth); +#endif + glClearDepthf(depth); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClearDepthf"); +#endif +} + +// void glClipPlanef (GLenum plane, const GLfloat *equation); +static inline void qglClipPlanef(GLenum plane, const GLfloat *equation) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClipPlanef(plane=%lu, equation=%p)\n", plane, equation); +#endif + glClipPlanef(plane, equation); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClipPlanef"); +#endif +} + +// void glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +// void glDepthRangef (GLclampf zNear, GLclampf zFar); +static inline void qglDepthRangef(GLclampf zNear, GLclampf zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDepthRangef(zNear=%f, zFar=%f)\n", zNear, zFar); +#endif + glDepthRangef(zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDepthRangef"); +#endif +} + +// void glFogf (GLenum pname, GLfloat param); +static inline void qglFogf(GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFogf(pname=%lu, param=%f)\n", pname, param); +#endif + glFogf(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFogf"); +#endif +} + +// void glFogfv (GLenum pname, const GLfloat *params); +static inline void qglFogfv(GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFogfv(pname=%lu, params=%p)\n", pname, params); +#endif + glFogfv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFogfv"); +#endif +} + +// void glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +static inline void qglFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFrustumf(left=%f, right=%f, bottom=%f, top=%f, zNear=%f, zFar=%f)\n", left, right, bottom, top, zNear, zFar); +#endif + glFrustumf(left, right, bottom, top, zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFrustumf"); +#endif +} + +// void glGetClipPlanef (GLenum pname, GLfloat eqn[4]); +static inline void qglGetClipPlanef(GLenum pname, GLfloat eqn[4]) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetClipPlanef(pname=%lu, eqn=%f)\n", pname, eqn); +#endif + glGetClipPlanef(pname, eqn); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetClipPlanef"); +#endif +} + +// void glGetFloatv (GLenum pname, GLfloat *params); +static inline void qglGetFloatv(GLenum pname, GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetFloatv(pname=%lu, params=%p)\n", pname, params); +#endif + glGetFloatv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetFloatv"); +#endif +} + +// void glGetLightfv (GLenum light, GLenum pname, GLfloat *params); +static inline void qglGetLightfv(GLenum light, GLenum pname, GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetLightfv(light=%lu, pname=%lu, params=%p)\n", light, pname, params); +#endif + glGetLightfv(light, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetLightfv"); +#endif +} + +// void glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params); +static inline void qglGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetMaterialfv(face=%lu, pname=%lu, params=%p)\n", face, pname, params); +#endif + glGetMaterialfv(face, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetMaterialfv"); +#endif +} + +// void glGetTexEnvfv (GLenum env, GLenum pname, GLfloat *params); +static inline void qglGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexEnvfv(env=%lu, pname=%lu, params=%p)\n", env, pname, params); +#endif + glGetTexEnvfv(env, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexEnvfv"); +#endif +} + +// void glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +static inline void qglGetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexParameterfv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glGetTexParameterfv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexParameterfv"); +#endif +} + +// void glLightModelf (GLenum pname, GLfloat param); +static inline void qglLightModelf(GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightModelf(pname=%lu, param=%f)\n", pname, param); +#endif + glLightModelf(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightModelf"); +#endif +} + +// void glLightModelfv (GLenum pname, const GLfloat *params); +static inline void qglLightModelfv(GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightModelfv(pname=%lu, params=%p)\n", pname, params); +#endif + glLightModelfv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightModelfv"); +#endif +} + +// void glLightf (GLenum light, GLenum pname, GLfloat param); +static inline void qglLightf(GLenum light, GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightf(light=%lu, pname=%lu, param=%f)\n", light, pname, param); +#endif + glLightf(light, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightf"); +#endif +} + +// void glLightfv (GLenum light, GLenum pname, const GLfloat *params); +static inline void qglLightfv(GLenum light, GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightfv(light=%lu, pname=%lu, params=%p)\n", light, pname, params); +#endif + glLightfv(light, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightfv"); +#endif +} + +// void glLineWidth (GLfloat width); +static inline void qglLineWidth(GLfloat width) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLineWidth(width=%f)\n", width); +#endif + glLineWidth(width); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLineWidth"); +#endif +} + +// void glLoadMatrixf (const GLfloat *m); +static inline void qglLoadMatrixf(const GLfloat *m) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLoadMatrixf(m=%p)\n", m); +#endif + glLoadMatrixf(m); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLoadMatrixf"); +#endif +} + +// void glMaterialf (GLenum face, GLenum pname, GLfloat param); +static inline void qglMaterialf(GLenum face, GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMaterialf(face=%lu, pname=%lu, param=%f)\n", face, pname, param); +#endif + glMaterialf(face, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMaterialf"); +#endif +} + +// void glMaterialfv (GLenum face, GLenum pname, const GLfloat *params); +static inline void qglMaterialfv(GLenum face, GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMaterialfv(face=%lu, pname=%lu, params=%p)\n", face, pname, params); +#endif + glMaterialfv(face, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMaterialfv"); +#endif +} + +// void glMultMatrixf (const GLfloat *m); +static inline void qglMultMatrixf(const GLfloat *m) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMultMatrixf(m=%p)\n", m); +#endif + glMultMatrixf(m); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMultMatrixf"); +#endif +} + +// void glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); +static inline void qglMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMultiTexCoord4f(target=%lu, s=%f, t=%f, r=%f, q=%f)\n", target, s, t, r, q); +#endif + glMultiTexCoord4f(target, s, t, r, q); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMultiTexCoord4f"); +#endif +} + +// void glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz); +static inline void qglNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glNormal3f(nx=%f, ny=%f, nz=%f)\n", nx, ny, nz); +#endif + glNormal3f(nx, ny, nz); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glNormal3f"); +#endif +} + +// void glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +static inline void qglOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glOrthof(left=%f, right=%f, bottom=%f, top=%f, zNear=%f, zFar=%f)\n", left, right, bottom, top, zNear, zFar); +#endif + glOrthof(left, right, bottom, top, zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glOrthof"); +#endif +} + +// void glPointParameterf (GLenum pname, GLfloat param); +static inline void qglPointParameterf(GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointParameterf(pname=%lu, param=%f)\n", pname, param); +#endif + glPointParameterf(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointParameterf"); +#endif +} + +// void glPointParameterfv (GLenum pname, const GLfloat *params); +static inline void qglPointParameterfv(GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointParameterfv(pname=%lu, params=%p)\n", pname, params); +#endif + glPointParameterfv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointParameterfv"); +#endif +} + +// void glPointSize (GLfloat size); +static inline void qglPointSize(GLfloat size) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointSize(size=%f)\n", size); +#endif + glPointSize(size); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointSize"); +#endif +} + +// void glPolygonOffset (GLfloat factor, GLfloat units); +static inline void qglPolygonOffset(GLfloat factor, GLfloat units) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPolygonOffset(factor=%f, units=%f)\n", factor, units); +#endif + glPolygonOffset(factor, units); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPolygonOffset"); +#endif +} + +// void glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z); +static inline void qglRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glRotatef(angle=%f, x=%f, y=%f, z=%f)\n", angle, x, y, z); +#endif + glRotatef(angle, x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glRotatef"); +#endif +} + +// void glScalef (GLfloat x, GLfloat y, GLfloat z); +static inline void qglScalef(GLfloat x, GLfloat y, GLfloat z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glScalef(x=%f, y=%f, z=%f)\n", x, y, z); +#endif + glScalef(x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glScalef"); +#endif +} + +// void glTexEnvf (GLenum target, GLenum pname, GLfloat param); +static inline void qglTexEnvf(GLenum target, GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnvf(target=%lu, pname=%lu, param=%f)\n", target, pname, param); +#endif + glTexEnvf(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnvf"); +#endif +} + +// void glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params); +static inline void qglTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnvfv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexEnvfv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnvfv"); +#endif +} + +// void glTexParameterf (GLenum target, GLenum pname, GLfloat param); +static inline void qglTexParameterf(GLenum target, GLenum pname, GLfloat param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameterf(target=%lu, pname=%lu, param=%f)\n", target, pname, param); +#endif + glTexParameterf(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameterf"); +#endif +} + +// void glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +static inline void qglTexParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameterfv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexParameterfv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameterfv"); +#endif +} + +// void glTranslatef (GLfloat x, GLfloat y, GLfloat z); +static inline void qglTranslatef(GLfloat x, GLfloat y, GLfloat z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTranslatef(x=%f, y=%f, z=%f)\n", x, y, z); +#endif + glTranslatef(x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTranslatef"); +#endif +} + +// void glActiveTexture (GLenum texture); +static inline void qglActiveTexture(GLenum texture) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glActiveTexture(texture=%lu)\n", texture); +#endif + glActiveTexture(texture); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glActiveTexture"); +#endif +} + +// void glAlphaFuncx (GLenum func, GLclampx ref); +static inline void qglAlphaFuncx(GLenum func, GLclampx ref) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glAlphaFuncx(func=%lu, ref=%ld)\n", func, ref); +#endif + glAlphaFuncx(func, ref); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glAlphaFuncx"); +#endif +} + +// void glBindBuffer (GLenum target, GLuint buffer); +static inline void qglBindBuffer(GLenum target, GLuint buffer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glBindBuffer(target=%lu, buffer=%lu)\n", target, buffer); +#endif + glBindBuffer(target, buffer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glBindBuffer"); +#endif +} + +// void glBindTexture (GLenum target, GLuint texture); +static inline void qglBindTexture(GLenum target, GLuint texture) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glBindTexture(target=%lu, texture=%lu)\n", target, texture); +#endif + glBindTexture(target, texture); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glBindTexture"); +#endif +} + +// void glBlendFunc (GLenum sfactor, GLenum dfactor); +static inline void qglBlendFunc(GLenum sfactor, GLenum dfactor) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glBlendFunc(sfactor=%lu, dfactor=%lu)\n", sfactor, dfactor); +#endif + glBlendFunc(sfactor, dfactor); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glBlendFunc"); +#endif +} + +// void glBufferData (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage); +static inline void qglBufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glBufferData(target=%lu, size=%ld, data=%p, usage=%lu)\n", target, size, data, usage); +#endif + glBufferData(target, size, data, usage); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glBufferData"); +#endif +} + +// void glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data); +static inline void qglBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glBufferSubData(target=%lu, offset=%ld, size=%ld, data=%p)\n", target, offset, size, data); +#endif + glBufferSubData(target, offset, size, data); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glBufferSubData"); +#endif +} + +// void glClear (GLbitfield mask); +static inline void qglClear(GLbitfield mask) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClear(mask=%lu)\n", mask); +#endif + glClear(mask); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClear"); +#endif +} + +// void glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +static inline void qglClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClearColorx(red=%ld, green=%ld, blue=%ld, alpha=%ld)\n", red, green, blue, alpha); +#endif + glClearColorx(red, green, blue, alpha); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClearColorx"); +#endif +} + +// void glClearDepthx (GLclampx depth); +static inline void qglClearDepthx(GLclampx depth) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClearDepthx(depth=%ld)\n", depth); +#endif + glClearDepthx(depth); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClearDepthx"); +#endif +} + +// void glClearStencil (GLint s); +static inline void qglClearStencil(GLint s) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClearStencil(s=%ld)\n", s); +#endif + glClearStencil(s); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClearStencil"); +#endif +} + +// void glClientActiveTexture (GLenum texture); +static inline void qglClientActiveTexture(GLenum texture) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClientActiveTexture(texture=%lu)\n", texture); +#endif + glClientActiveTexture(texture); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClientActiveTexture"); +#endif +} + +// void glClipPlanex (GLenum plane, const GLfixed *equation); +static inline void qglClipPlanex(GLenum plane, const GLfixed *equation) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glClipPlanex(plane=%lu, equation=%p)\n", plane, equation); +#endif + glClipPlanex(plane, equation); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glClipPlanex"); +#endif +} + +// void glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); +static inline void qglColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glColor4ub(red=%u, green=%u, blue=%u, alpha=%u)\n", red, green, blue, alpha); +#endif + glColor4ub(red, green, blue, alpha); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glColor4ub"); +#endif +} + +// void glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); +static inline void qglColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glColor4x(red=%ld, green=%ld, blue=%ld, alpha=%ld)\n", red, green, blue, alpha); +#endif + glColor4x(red, green, blue, alpha); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glColor4x"); +#endif +} + +// void glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +static inline void qglColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glColorMask(red=%u, green=%u, blue=%u, alpha=%u)\n", red, green, blue, alpha); +#endif + glColorMask(red, green, blue, alpha); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glColorMask"); +#endif +} + +// void glColorPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +static inline void qglColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glColorPointer(size=%ld, type=%lu, stride=%ld, pointer=%p)\n", size, type, stride, pointer); +#endif + glColorPointer(size, type, stride, pointer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glColorPointer"); +#endif +} + +// void glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data); +static inline void qglCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glCompressedTexImage2D(target=%lu, level=%ld, internalformat=%lu, width=%ld, height=%ld, border=%ld, imageSize=%ld, data=%p)\n", target, level, internalformat, width, height, border, imageSize, data); +#endif + glCompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glCompressedTexImage2D"); +#endif +} + +// void glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data); +static inline void qglCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glCompressedTexSubImage2D(target=%lu, level=%ld, xoffset=%ld, yoffset=%ld, width=%ld, height=%ld, format=%lu, imageSize=%ld, data=%p)\n", target, level, xoffset, yoffset, width, height, format, imageSize, data); +#endif + glCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glCompressedTexSubImage2D"); +#endif +} + +// void glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +static inline void qglCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glCopyTexImage2D(target=%lu, level=%ld, internalformat=%lu, x=%ld, y=%ld, width=%ld, height=%ld, border=%ld)\n", target, level, internalformat, x, y, width, height, border); +#endif + glCopyTexImage2D(target, level, internalformat, x, y, width, height, border); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glCopyTexImage2D"); +#endif +} + +// void glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +static inline void qglCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glCopyTexSubImage2D(target=%lu, level=%ld, xoffset=%ld, yoffset=%ld, x=%ld, y=%ld, width=%ld, height=%ld)\n", target, level, xoffset, yoffset, x, y, width, height); +#endif + glCopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glCopyTexSubImage2D"); +#endif +} + +// void glCullFace (GLenum mode); +static inline void qglCullFace(GLenum mode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glCullFace(mode=%lu)\n", mode); +#endif + glCullFace(mode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glCullFace"); +#endif +} + +// void glDeleteBuffers (GLsizei n, const GLuint *buffers); +static inline void qglDeleteBuffers(GLsizei n, const GLuint *buffers) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDeleteBuffers(n=%ld, buffers=%p)\n", n, buffers); +#endif + glDeleteBuffers(n, buffers); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDeleteBuffers"); +#endif +} + +// void glDeleteTextures (GLsizei n, const GLuint *textures); +static inline void qglDeleteTextures(GLsizei n, const GLuint *textures) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDeleteTextures(n=%ld, textures=%p)\n", n, textures); +#endif + glDeleteTextures(n, textures); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDeleteTextures"); +#endif +} + +// void glDepthFunc (GLenum func); +static inline void qglDepthFunc(GLenum func) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDepthFunc(func=%lu)\n", func); +#endif + glDepthFunc(func); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDepthFunc"); +#endif +} + +// void glDepthMask (GLboolean flag); +static inline void qglDepthMask(GLboolean flag) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDepthMask(flag=%u)\n", flag); +#endif + glDepthMask(flag); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDepthMask"); +#endif +} + +// void glDepthRangex (GLclampx zNear, GLclampx zFar); +static inline void qglDepthRangex(GLclampx zNear, GLclampx zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDepthRangex(zNear=%ld, zFar=%ld)\n", zNear, zFar); +#endif + glDepthRangex(zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDepthRangex"); +#endif +} + +// void glDisable (GLenum cap); +static inline void qglDisable(GLenum cap) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDisable(cap=%lu)\n", cap); +#endif + glDisable(cap); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDisable"); +#endif +} + +// void glDisableClientState (GLenum array); +static inline void qglDisableClientState(GLenum array) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDisableClientState(array=%lu)\n", array); +#endif + glDisableClientState(array); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDisableClientState"); +#endif +} + +// void glDrawArrays (GLenum mode, GLint first, GLsizei count); +static inline void qglDrawArrays(GLenum mode, GLint first, GLsizei count) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDrawArrays(mode=%lu, first=%ld, count=%ld)\n", mode, first, count); +#endif + glDrawArrays(mode, first, count); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDrawArrays"); +#endif +} + +// void glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices); +static inline void qglDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glDrawElements(mode=%lu, count=%ld, type=%lu, indices=%p)\n", mode, count, type, indices); +#endif + glDrawElements(mode, count, type, indices); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glDrawElements"); +#endif +} + +// void glEnable (GLenum cap); +static inline void qglEnable(GLenum cap) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glEnable(cap=%lu)\n", cap); +#endif + glEnable(cap); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glEnable"); +#endif +} + +// void glEnableClientState (GLenum array); +static inline void qglEnableClientState(GLenum array) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glEnableClientState(array=%lu)\n", array); +#endif + glEnableClientState(array); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glEnableClientState"); +#endif +} + +// void glFinish (void); +static inline void qglFinish(void) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFinish(void)\n"); +#endif + glFinish(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFinish"); +#endif +} + +// void glFlush (void); +static inline void qglFlush(void) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFlush(void)\n"); +#endif + glFlush(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFlush"); +#endif +} + +// void glFogx (GLenum pname, GLfixed param); +static inline void qglFogx(GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFogx(pname=%lu, param=%ld)\n", pname, param); +#endif + glFogx(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFogx"); +#endif +} + +// void glFogxv (GLenum pname, const GLfixed *params); +static inline void qglFogxv(GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFogxv(pname=%lu, params=%p)\n", pname, params); +#endif + glFogxv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFogxv"); +#endif +} + +// void glFrontFace (GLenum mode); +static inline void qglFrontFace(GLenum mode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFrontFace(mode=%lu)\n", mode); +#endif + glFrontFace(mode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFrontFace"); +#endif +} + +// void glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +static inline void qglFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glFrustumx(left=%ld, right=%ld, bottom=%ld, top=%ld, zNear=%ld, zFar=%ld)\n", left, right, bottom, top, zNear, zFar); +#endif + glFrustumx(left, right, bottom, top, zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glFrustumx"); +#endif +} + +// void glGetBooleanv (GLenum pname, GLboolean *params); +static inline void qglGetBooleanv(GLenum pname, GLboolean *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetBooleanv(pname=%lu, params=%p)\n", pname, params); +#endif + glGetBooleanv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetBooleanv"); +#endif +} + +// void glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +static inline void qglGetBufferParameteriv(GLenum target, GLenum pname, GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetBufferParameteriv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glGetBufferParameteriv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetBufferParameteriv"); +#endif +} + +// void glGetClipPlanex (GLenum pname, GLfixed eqn[4]); +static inline void qglGetClipPlanex(GLenum pname, GLfixed eqn[4]) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetClipPlanex(pname=%lu, eqn=%ld)\n", pname, eqn); +#endif + glGetClipPlanex(pname, eqn); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetClipPlanex"); +#endif +} + +// void glGenBuffers (GLsizei n, GLuint *buffers); +static inline void qglGenBuffers(GLsizei n, GLuint *buffers) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGenBuffers(n=%ld, buffers=%p)\n", n, buffers); +#endif + glGenBuffers(n, buffers); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGenBuffers"); +#endif +} + +// void glGenTextures (GLsizei n, GLuint *textures); +static inline void qglGenTextures(GLsizei n, GLuint *textures) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGenTextures(n=%ld, textures=%p)\n", n, textures); +#endif + glGenTextures(n, textures); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGenTextures"); +#endif +} + +// GLenum glGetError (void); +static inline GLenum qglGetError(void) +{ + GLenum returnValue; +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetError(void)\n"); +#endif + returnValue = glGetError(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetError"); +#endif + return returnValue; +} + +// void glGetFixedv (GLenum pname, GLfixed *params); +static inline void qglGetFixedv(GLenum pname, GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetFixedv(pname=%lu, params=%p)\n", pname, params); +#endif + glGetFixedv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetFixedv"); +#endif +} + +// void glGetIntegerv (GLenum pname, GLint *params); +static inline void qglGetIntegerv(GLenum pname, GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetIntegerv(pname=%lu, params=%p)\n", pname, params); +#endif + glGetIntegerv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetIntegerv"); +#endif +} + +// void glGetLightxv (GLenum light, GLenum pname, GLfixed *params); +static inline void qglGetLightxv(GLenum light, GLenum pname, GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetLightxv(light=%lu, pname=%lu, params=%p)\n", light, pname, params); +#endif + glGetLightxv(light, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetLightxv"); +#endif +} + +// void glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); +static inline void qglGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetMaterialxv(face=%lu, pname=%lu, params=%p)\n", face, pname, params); +#endif + glGetMaterialxv(face, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetMaterialxv"); +#endif +} + +// void glGetPointerv (GLenum pname, void **params); +static inline void qglGetPointerv(GLenum pname, void **params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetPointerv(pname=%lu, params=%p)\n", pname, params); +#endif + glGetPointerv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetPointerv"); +#endif +} + +// const GLubyte * glGetString (GLenum name); +static inline const GLubyte * qglGetString(GLenum name) +{ + const GLubyte * returnValue; +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetString(name=%lu)\n", name); +#endif + returnValue = glGetString(name); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetString"); +#endif + return returnValue; +} + +// void glGetTexEnviv (GLenum env, GLenum pname, GLint *params); +static inline void qglGetTexEnviv(GLenum env, GLenum pname, GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexEnviv(env=%lu, pname=%lu, params=%p)\n", env, pname, params); +#endif + glGetTexEnviv(env, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexEnviv"); +#endif +} + +// void glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); +static inline void qglGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexEnvxv(env=%lu, pname=%lu, params=%p)\n", env, pname, params); +#endif + glGetTexEnvxv(env, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexEnvxv"); +#endif +} + +// void glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +static inline void qglGetTexParameteriv(GLenum target, GLenum pname, GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexParameteriv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glGetTexParameteriv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexParameteriv"); +#endif +} + +// void glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); +static inline void qglGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glGetTexParameterxv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glGetTexParameterxv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glGetTexParameterxv"); +#endif +} + +// void glHint (GLenum target, GLenum mode); +static inline void qglHint(GLenum target, GLenum mode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glHint(target=%lu, mode=%lu)\n", target, mode); +#endif + glHint(target, mode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glHint"); +#endif +} + +// GLboolean glIsBuffer (GLuint buffer); +static inline GLboolean qglIsBuffer(GLuint buffer) +{ + GLboolean returnValue; +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glIsBuffer(buffer=%lu)\n", buffer); +#endif + returnValue = glIsBuffer(buffer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glIsBuffer"); +#endif + return returnValue; +} + +// GLboolean glIsEnabled (GLenum cap); +static inline GLboolean qglIsEnabled(GLenum cap) +{ + GLboolean returnValue; +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glIsEnabled(cap=%lu)\n", cap); +#endif + returnValue = glIsEnabled(cap); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glIsEnabled"); +#endif + return returnValue; +} + +// GLboolean glIsTexture (GLuint texture); +static inline GLboolean qglIsTexture(GLuint texture) +{ + GLboolean returnValue; +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glIsTexture(texture=%lu)\n", texture); +#endif + returnValue = glIsTexture(texture); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glIsTexture"); +#endif + return returnValue; +} + +// void glLightModelx (GLenum pname, GLfixed param); +static inline void qglLightModelx(GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightModelx(pname=%lu, param=%ld)\n", pname, param); +#endif + glLightModelx(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightModelx"); +#endif +} + +// void glLightModelxv (GLenum pname, const GLfixed *params); +static inline void qglLightModelxv(GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightModelxv(pname=%lu, params=%p)\n", pname, params); +#endif + glLightModelxv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightModelxv"); +#endif +} + +// void glLightx (GLenum light, GLenum pname, GLfixed param); +static inline void qglLightx(GLenum light, GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightx(light=%lu, pname=%lu, param=%ld)\n", light, pname, param); +#endif + glLightx(light, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightx"); +#endif +} + +// void glLightxv (GLenum light, GLenum pname, const GLfixed *params); +static inline void qglLightxv(GLenum light, GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLightxv(light=%lu, pname=%lu, params=%p)\n", light, pname, params); +#endif + glLightxv(light, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLightxv"); +#endif +} + +// void glLineWidthx (GLfixed width); +static inline void qglLineWidthx(GLfixed width) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLineWidthx(width=%ld)\n", width); +#endif + glLineWidthx(width); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLineWidthx"); +#endif +} + +// void glLoadIdentity (void); +static inline void qglLoadIdentity(void) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLoadIdentity(void)\n"); +#endif + glLoadIdentity(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLoadIdentity"); +#endif +} + +// void glLoadMatrixx (const GLfixed *m); +static inline void qglLoadMatrixx(const GLfixed *m) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLoadMatrixx(m=%p)\n", m); +#endif + glLoadMatrixx(m); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLoadMatrixx"); +#endif +} + +// void glLogicOp (GLenum opcode); +static inline void qglLogicOp(GLenum opcode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glLogicOp(opcode=%lu)\n", opcode); +#endif + glLogicOp(opcode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glLogicOp"); +#endif +} + +// void glMaterialx (GLenum face, GLenum pname, GLfixed param); +static inline void qglMaterialx(GLenum face, GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMaterialx(face=%lu, pname=%lu, param=%ld)\n", face, pname, param); +#endif + glMaterialx(face, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMaterialx"); +#endif +} + +// void glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); +static inline void qglMaterialxv(GLenum face, GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMaterialxv(face=%lu, pname=%lu, params=%p)\n", face, pname, params); +#endif + glMaterialxv(face, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMaterialxv"); +#endif +} + +// void glMatrixMode (GLenum mode); +static inline void qglMatrixMode(GLenum mode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMatrixMode(mode=%lu)\n", mode); +#endif + glMatrixMode(mode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMatrixMode"); +#endif +} + +// void glMultMatrixx (const GLfixed *m); +static inline void qglMultMatrixx(const GLfixed *m) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMultMatrixx(m=%p)\n", m); +#endif + glMultMatrixx(m); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMultMatrixx"); +#endif +} + +// void glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +static inline void qglMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glMultiTexCoord4x(target=%lu, s=%ld, t=%ld, r=%ld, q=%ld)\n", target, s, t, r, q); +#endif + glMultiTexCoord4x(target, s, t, r, q); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glMultiTexCoord4x"); +#endif +} + +// void glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); +static inline void qglNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glNormal3x(nx=%ld, ny=%ld, nz=%ld)\n", nx, ny, nz); +#endif + glNormal3x(nx, ny, nz); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glNormal3x"); +#endif +} + +// void glNormalPointer (GLenum type, GLsizei stride, const GLvoid *pointer); +static inline void qglNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glNormalPointer(type=%lu, stride=%ld, pointer=%p)\n", type, stride, pointer); +#endif + glNormalPointer(type, stride, pointer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glNormalPointer"); +#endif +} + +// void glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +static inline void qglOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glOrthox(left=%ld, right=%ld, bottom=%ld, top=%ld, zNear=%ld, zFar=%ld)\n", left, right, bottom, top, zNear, zFar); +#endif + glOrthox(left, right, bottom, top, zNear, zFar); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glOrthox"); +#endif +} + +// void glPixelStorei (GLenum pname, GLint param); +static inline void qglPixelStorei(GLenum pname, GLint param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPixelStorei(pname=%lu, param=%ld)\n", pname, param); +#endif + glPixelStorei(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPixelStorei"); +#endif +} + +// void glPointParameterx (GLenum pname, GLfixed param); +static inline void qglPointParameterx(GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointParameterx(pname=%lu, param=%ld)\n", pname, param); +#endif + glPointParameterx(pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointParameterx"); +#endif +} + +// void glPointParameterxv (GLenum pname, const GLfixed *params); +static inline void qglPointParameterxv(GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointParameterxv(pname=%lu, params=%p)\n", pname, params); +#endif + glPointParameterxv(pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointParameterxv"); +#endif +} + +// void glPointSizex (GLfixed size); +static inline void qglPointSizex(GLfixed size) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointSizex(size=%ld)\n", size); +#endif + glPointSizex(size); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointSizex"); +#endif +} + +// void glPolygonOffsetx (GLfixed factor, GLfixed units); +static inline void qglPolygonOffsetx(GLfixed factor, GLfixed units) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPolygonOffsetx(factor=%ld, units=%ld)\n", factor, units); +#endif + glPolygonOffsetx(factor, units); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPolygonOffsetx"); +#endif +} + +// void glPopMatrix (void); +static inline void qglPopMatrix(void) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPopMatrix(void)\n"); +#endif + glPopMatrix(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPopMatrix"); +#endif +} + +// void glPushMatrix (void); +static inline void qglPushMatrix(void) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPushMatrix(void)\n"); +#endif + glPushMatrix(); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPushMatrix"); +#endif +} + +// void glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels); +static inline void qglReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glReadPixels(x=%ld, y=%ld, width=%ld, height=%ld, format=%lu, type=%lu, pixels=%p)\n", x, y, width, height, format, type, pixels); +#endif + glReadPixels(x, y, width, height, format, type, pixels); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glReadPixels"); +#endif +} + +// void glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); +static inline void qglRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glRotatex(angle=%ld, x=%ld, y=%ld, z=%ld)\n", angle, x, y, z); +#endif + glRotatex(angle, x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glRotatex"); +#endif +} + +// void glSampleCoverage (GLclampf value, GLboolean invert); +static inline void qglSampleCoverage(GLclampf value, GLboolean invert) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glSampleCoverage(value=%f, invert=%u)\n", value, invert); +#endif + glSampleCoverage(value, invert); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glSampleCoverage"); +#endif +} + +// void glSampleCoveragex (GLclampx value, GLboolean invert); +static inline void qglSampleCoveragex(GLclampx value, GLboolean invert) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glSampleCoveragex(value=%ld, invert=%u)\n", value, invert); +#endif + glSampleCoveragex(value, invert); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glSampleCoveragex"); +#endif +} + +// void glScalex (GLfixed x, GLfixed y, GLfixed z); +static inline void qglScalex(GLfixed x, GLfixed y, GLfixed z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glScalex(x=%ld, y=%ld, z=%ld)\n", x, y, z); +#endif + glScalex(x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glScalex"); +#endif +} + +// void glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +static inline void qglScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glScissor(x=%ld, y=%ld, width=%ld, height=%ld)\n", x, y, width, height); +#endif + glScissor(x, y, width, height); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glScissor"); +#endif +} + +// void glShadeModel (GLenum mode); +static inline void qglShadeModel(GLenum mode) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glShadeModel(mode=%lu)\n", mode); +#endif + glShadeModel(mode); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glShadeModel"); +#endif +} + +// void glStencilFunc (GLenum func, GLint ref, GLuint mask); +static inline void qglStencilFunc(GLenum func, GLint ref, GLuint mask) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glStencilFunc(func=%lu, ref=%ld, mask=%lu)\n", func, ref, mask); +#endif + glStencilFunc(func, ref, mask); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glStencilFunc"); +#endif +} + +// void glStencilMask (GLuint mask); +static inline void qglStencilMask(GLuint mask) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glStencilMask(mask=%lu)\n", mask); +#endif + glStencilMask(mask); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glStencilMask"); +#endif +} + +// void glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +static inline void qglStencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glStencilOp(fail=%lu, zfail=%lu, zpass=%lu)\n", fail, zfail, zpass); +#endif + glStencilOp(fail, zfail, zpass); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glStencilOp"); +#endif +} + +// void glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +static inline void qglTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexCoordPointer(size=%ld, type=%lu, stride=%ld, pointer=%p)\n", size, type, stride, pointer); +#endif + glTexCoordPointer(size, type, stride, pointer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexCoordPointer"); +#endif +} + +// void glTexEnvi (GLenum target, GLenum pname, GLint param); +static inline void qglTexEnvi(GLenum target, GLenum pname, GLint param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnvi(target=%lu, pname=%lu, param=%ld)\n", target, pname, param); +#endif + glTexEnvi(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnvi"); +#endif +} + +// void glTexEnvx (GLenum target, GLenum pname, GLfixed param); +static inline void qglTexEnvx(GLenum target, GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnvx(target=%lu, pname=%lu, param=%ld)\n", target, pname, param); +#endif + glTexEnvx(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnvx"); +#endif +} + +// void glTexEnviv (GLenum target, GLenum pname, const GLint *params); +static inline void qglTexEnviv(GLenum target, GLenum pname, const GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnviv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexEnviv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnviv"); +#endif +} + +// void glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); +static inline void qglTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexEnvxv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexEnvxv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexEnvxv"); +#endif +} + +// void glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +static inline void qglTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexImage2D(target=%lu, level=%ld, internalformat=%ld, width=%ld, height=%ld, border=%ld, format=%lu, type=%lu, pixels=%p)\n", target, level, internalformat, width, height, border, format, type, pixels); +#endif + glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexImage2D"); +#endif +} + +// void glTexParameteri (GLenum target, GLenum pname, GLint param); +static inline void qglTexParameteri(GLenum target, GLenum pname, GLint param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameteri(target=%lu, pname=%lu, param=%ld)\n", target, pname, param); +#endif + glTexParameteri(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameteri"); +#endif +} + +// void glTexParameterx (GLenum target, GLenum pname, GLfixed param); +static inline void qglTexParameterx(GLenum target, GLenum pname, GLfixed param) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameterx(target=%lu, pname=%lu, param=%ld)\n", target, pname, param); +#endif + glTexParameterx(target, pname, param); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameterx"); +#endif +} + +// void glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +static inline void qglTexParameteriv(GLenum target, GLenum pname, const GLint *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameteriv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexParameteriv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameteriv"); +#endif +} + +// void glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); +static inline void qglTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexParameterxv(target=%lu, pname=%lu, params=%p)\n", target, pname, params); +#endif + glTexParameterxv(target, pname, params); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexParameterxv"); +#endif +} + +// void glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels); +static inline void qglTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTexSubImage2D(target=%lu, level=%ld, xoffset=%ld, yoffset=%ld, width=%ld, height=%ld, format=%lu, type=%lu, pixels=%p)\n", target, level, xoffset, yoffset, width, height, format, type, pixels); +#endif + glTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTexSubImage2D"); +#endif +} + +// void glTranslatex (GLfixed x, GLfixed y, GLfixed z); +static inline void qglTranslatex(GLfixed x, GLfixed y, GLfixed z) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glTranslatex(x=%ld, y=%ld, z=%ld)\n", x, y, z); +#endif + glTranslatex(x, y, z); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glTranslatex"); +#endif +} + +// void glVertexPointer (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +static inline void qglVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glVertexPointer(size=%ld, type=%lu, stride=%ld, pointer=%p)\n", size, type, stride, pointer); +#endif + glVertexPointer(size, type, stride, pointer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glVertexPointer"); +#endif +} + +// void glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +static inline void qglViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glViewport(x=%ld, y=%ld, width=%ld, height=%ld)\n", x, y, width, height); +#endif + glViewport(x, y, width, height); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glViewport"); +#endif +} + +// void glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); +static inline void qglPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) +{ +#if !defined(NDEBUG) && defined(QGL_LOG_GL_CALLS) + if (QGLLogGLCalls) + fprintf(QGLDebugFile(), "glPointSizePointerOES(type=%lu, stride=%ld, pointer=%p)\n", type, stride, pointer); +#endif + glPointSizePointerOES(type, stride, pointer); +#if !defined(NDEBUG) && defined(QGL_CHECK_GL_ERRORS) + if (!QGLBeginStarted) + QGLCheckError("glPointSizePointerOES"); +#endif +} + +// Prevent calls to the 'normal' GL functions +#define glAlphaFunc CALL_THE_QGL_VERSION_OF_glAlphaFunc +#define glClearColor CALL_THE_QGL_VERSION_OF_glClearColor +#define glClearDepthf CALL_THE_QGL_VERSION_OF_glClearDepthf +#define glClipPlanef CALL_THE_QGL_VERSION_OF_glClipPlanef +#define glDepthRangef CALL_THE_QGL_VERSION_OF_glDepthRangef +#define glFogf CALL_THE_QGL_VERSION_OF_glFogf +#define glFogfv CALL_THE_QGL_VERSION_OF_glFogfv +#define glFrustumf CALL_THE_QGL_VERSION_OF_glFrustumf +#define glGetClipPlanef CALL_THE_QGL_VERSION_OF_glGetClipPlanef +#define glGetFloatv CALL_THE_QGL_VERSION_OF_glGetFloatv +#define glGetLightfv CALL_THE_QGL_VERSION_OF_glGetLightfv +#define glGetMaterialfv CALL_THE_QGL_VERSION_OF_glGetMaterialfv +#define glGetTexEnvfv CALL_THE_QGL_VERSION_OF_glGetTexEnvfv +#define glGetTexParameterfv CALL_THE_QGL_VERSION_OF_glGetTexParameterfv +#define glLightModelf CALL_THE_QGL_VERSION_OF_glLightModelf +#define glLightModelfv CALL_THE_QGL_VERSION_OF_glLightModelfv +#define glLightf CALL_THE_QGL_VERSION_OF_glLightf +#define glLightfv CALL_THE_QGL_VERSION_OF_glLightfv +#define glLineWidth CALL_THE_QGL_VERSION_OF_glLineWidth +#define glLoadMatrixf CALL_THE_QGL_VERSION_OF_glLoadMatrixf +#define glMaterialf CALL_THE_QGL_VERSION_OF_glMaterialf +#define glMaterialfv CALL_THE_QGL_VERSION_OF_glMaterialfv +#define glMultMatrixf CALL_THE_QGL_VERSION_OF_glMultMatrixf +#define glMultiTexCoord4f CALL_THE_QGL_VERSION_OF_glMultiTexCoord4f +#define glNormal3f CALL_THE_QGL_VERSION_OF_glNormal3f +#define glOrthof CALL_THE_QGL_VERSION_OF_glOrthof +#define glPointParameterf CALL_THE_QGL_VERSION_OF_glPointParameterf +#define glPointParameterfv CALL_THE_QGL_VERSION_OF_glPointParameterfv +#define glPointSize CALL_THE_QGL_VERSION_OF_glPointSize +#define glPolygonOffset CALL_THE_QGL_VERSION_OF_glPolygonOffset +#define glRotatef CALL_THE_QGL_VERSION_OF_glRotatef +#define glScalef CALL_THE_QGL_VERSION_OF_glScalef +#define glTexEnvf CALL_THE_QGL_VERSION_OF_glTexEnvf +#define glTexEnvfv CALL_THE_QGL_VERSION_OF_glTexEnvfv +#define glTexParameterf CALL_THE_QGL_VERSION_OF_glTexParameterf +#define glTexParameterfv CALL_THE_QGL_VERSION_OF_glTexParameterfv +#define glTranslatef CALL_THE_QGL_VERSION_OF_glTranslatef +#define glActiveTexture CALL_THE_QGL_VERSION_OF_glActiveTexture +#define glAlphaFuncx CALL_THE_QGL_VERSION_OF_glAlphaFuncx +#define glBindBuffer CALL_THE_QGL_VERSION_OF_glBindBuffer +#define glBindTexture CALL_THE_QGL_VERSION_OF_glBindTexture +#define glBlendFunc CALL_THE_QGL_VERSION_OF_glBlendFunc +#define glBufferData CALL_THE_QGL_VERSION_OF_glBufferData +#define glBufferSubData CALL_THE_QGL_VERSION_OF_glBufferSubData +#define glClear CALL_THE_QGL_VERSION_OF_glClear +#define glClearColorx CALL_THE_QGL_VERSION_OF_glClearColorx +#define glClearDepthx CALL_THE_QGL_VERSION_OF_glClearDepthx +#define glClearStencil CALL_THE_QGL_VERSION_OF_glClearStencil +#define glClientActiveTexture CALL_THE_QGL_VERSION_OF_glClientActiveTexture +#define glClipPlanex CALL_THE_QGL_VERSION_OF_glClipPlanex +#define glColor4ub CALL_THE_QGL_VERSION_OF_glColor4ub +#define glColor4x CALL_THE_QGL_VERSION_OF_glColor4x +#define glColorMask CALL_THE_QGL_VERSION_OF_glColorMask +#define glColorPointer CALL_THE_QGL_VERSION_OF_glColorPointer +#define glCompressedTexImage2D CALL_THE_QGL_VERSION_OF_glCompressedTexImage2D +#define glCompressedTexSubImage2D CALL_THE_QGL_VERSION_OF_glCompressedTexSubImage2D +#define glCopyTexImage2D CALL_THE_QGL_VERSION_OF_glCopyTexImage2D +#define glCopyTexSubImage2D CALL_THE_QGL_VERSION_OF_glCopyTexSubImage2D +#define glCullFace CALL_THE_QGL_VERSION_OF_glCullFace +#define glDeleteBuffers CALL_THE_QGL_VERSION_OF_glDeleteBuffers +#define glDeleteTextures CALL_THE_QGL_VERSION_OF_glDeleteTextures +#define glDepthFunc CALL_THE_QGL_VERSION_OF_glDepthFunc +#define glDepthMask CALL_THE_QGL_VERSION_OF_glDepthMask +#define glDepthRangex CALL_THE_QGL_VERSION_OF_glDepthRangex +#define glDisable CALL_THE_QGL_VERSION_OF_glDisable +#define glDisableClientState CALL_THE_QGL_VERSION_OF_glDisableClientState +#define glDrawArrays CALL_THE_QGL_VERSION_OF_glDrawArrays +#define glDrawElements CALL_THE_QGL_VERSION_OF_glDrawElements +#define glEnable CALL_THE_QGL_VERSION_OF_glEnable +#define glEnableClientState CALL_THE_QGL_VERSION_OF_glEnableClientState +#define glFinish CALL_THE_QGL_VERSION_OF_glFinish +#define glFlush CALL_THE_QGL_VERSION_OF_glFlush +#define glFogx CALL_THE_QGL_VERSION_OF_glFogx +#define glFogxv CALL_THE_QGL_VERSION_OF_glFogxv +#define glFrontFace CALL_THE_QGL_VERSION_OF_glFrontFace +#define glFrustumx CALL_THE_QGL_VERSION_OF_glFrustumx +#define glGetBooleanv CALL_THE_QGL_VERSION_OF_glGetBooleanv +#define glGetBufferParameteriv CALL_THE_QGL_VERSION_OF_glGetBufferParameteriv +#define glGetClipPlanex CALL_THE_QGL_VERSION_OF_glGetClipPlanex +#define glGenBuffers CALL_THE_QGL_VERSION_OF_glGenBuffers +#define glGenTextures CALL_THE_QGL_VERSION_OF_glGenTextures +#define glGetError CALL_THE_QGL_VERSION_OF_glGetError +#define glGetFixedv CALL_THE_QGL_VERSION_OF_glGetFixedv +#define glGetIntegerv CALL_THE_QGL_VERSION_OF_glGetIntegerv +#define glGetLightxv CALL_THE_QGL_VERSION_OF_glGetLightxv +#define glGetMaterialxv CALL_THE_QGL_VERSION_OF_glGetMaterialxv +#define glGetPointerv CALL_THE_QGL_VERSION_OF_glGetPointerv +#define glGetString CALL_THE_QGL_VERSION_OF_glGetString +#define glGetTexEnviv CALL_THE_QGL_VERSION_OF_glGetTexEnviv +#define glGetTexEnvxv CALL_THE_QGL_VERSION_OF_glGetTexEnvxv +#define glGetTexParameteriv CALL_THE_QGL_VERSION_OF_glGetTexParameteriv +#define glGetTexParameterxv CALL_THE_QGL_VERSION_OF_glGetTexParameterxv +#define glHint CALL_THE_QGL_VERSION_OF_glHint +#define glIsBuffer CALL_THE_QGL_VERSION_OF_glIsBuffer +#define glIsEnabled CALL_THE_QGL_VERSION_OF_glIsEnabled +#define glIsTexture CALL_THE_QGL_VERSION_OF_glIsTexture +#define glLightModelx CALL_THE_QGL_VERSION_OF_glLightModelx +#define glLightModelxv CALL_THE_QGL_VERSION_OF_glLightModelxv +#define glLightx CALL_THE_QGL_VERSION_OF_glLightx +#define glLightxv CALL_THE_QGL_VERSION_OF_glLightxv +#define glLineWidthx CALL_THE_QGL_VERSION_OF_glLineWidthx +#define glLoadIdentity CALL_THE_QGL_VERSION_OF_glLoadIdentity +#define glLoadMatrixx CALL_THE_QGL_VERSION_OF_glLoadMatrixx +#define glLogicOp CALL_THE_QGL_VERSION_OF_glLogicOp +#define glMaterialx CALL_THE_QGL_VERSION_OF_glMaterialx +#define glMaterialxv CALL_THE_QGL_VERSION_OF_glMaterialxv +#define glMatrixMode CALL_THE_QGL_VERSION_OF_glMatrixMode +#define glMultMatrixx CALL_THE_QGL_VERSION_OF_glMultMatrixx +#define glMultiTexCoord4x CALL_THE_QGL_VERSION_OF_glMultiTexCoord4x +#define glNormal3x CALL_THE_QGL_VERSION_OF_glNormal3x +#define glNormalPointer CALL_THE_QGL_VERSION_OF_glNormalPointer +#define glOrthox CALL_THE_QGL_VERSION_OF_glOrthox +#define glPixelStorei CALL_THE_QGL_VERSION_OF_glPixelStorei +#define glPointParameterx CALL_THE_QGL_VERSION_OF_glPointParameterx +#define glPointParameterxv CALL_THE_QGL_VERSION_OF_glPointParameterxv +#define glPointSizex CALL_THE_QGL_VERSION_OF_glPointSizex +#define glPolygonOffsetx CALL_THE_QGL_VERSION_OF_glPolygonOffsetx +#define glPopMatrix CALL_THE_QGL_VERSION_OF_glPopMatrix +#define glPushMatrix CALL_THE_QGL_VERSION_OF_glPushMatrix +#define glReadPixels CALL_THE_QGL_VERSION_OF_glReadPixels +#define glRotatex CALL_THE_QGL_VERSION_OF_glRotatex +#define glSampleCoverage CALL_THE_QGL_VERSION_OF_glSampleCoverage +#define glSampleCoveragex CALL_THE_QGL_VERSION_OF_glSampleCoveragex +#define glScalex CALL_THE_QGL_VERSION_OF_glScalex +#define glScissor CALL_THE_QGL_VERSION_OF_glScissor +#define glShadeModel CALL_THE_QGL_VERSION_OF_glShadeModel +#define glStencilFunc CALL_THE_QGL_VERSION_OF_glStencilFunc +#define glStencilMask CALL_THE_QGL_VERSION_OF_glStencilMask +#define glStencilOp CALL_THE_QGL_VERSION_OF_glStencilOp +#define glTexCoordPointer CALL_THE_QGL_VERSION_OF_glTexCoordPointer +#define glTexEnvi CALL_THE_QGL_VERSION_OF_glTexEnvi +#define glTexEnvx CALL_THE_QGL_VERSION_OF_glTexEnvx +#define glTexEnviv CALL_THE_QGL_VERSION_OF_glTexEnviv +#define glTexEnvxv CALL_THE_QGL_VERSION_OF_glTexEnvxv +#define glTexImage2D CALL_THE_QGL_VERSION_OF_glTexImage2D +#define glTexParameteri CALL_THE_QGL_VERSION_OF_glTexParameteri +#define glTexParameterx CALL_THE_QGL_VERSION_OF_glTexParameterx +#define glTexParameteriv CALL_THE_QGL_VERSION_OF_glTexParameteriv +#define glTexParameterxv CALL_THE_QGL_VERSION_OF_glTexParameterxv +#define glTexSubImage2D CALL_THE_QGL_VERSION_OF_glTexSubImage2D +#define glTranslatex CALL_THE_QGL_VERSION_OF_glTranslatex +#define glVertexPointer CALL_THE_QGL_VERSION_OF_glVertexPointer +#define glViewport CALL_THE_QGL_VERSION_OF_glViewport +#define glPointSizePointerOES CALL_THE_QGL_VERSION_OF_glPointSizePointerOES |