diff options
-rw-r--r-- | game/LuaCommands.odt | bin | 0 -> 15724 bytes | |||
-rw-r--r-- | game/main.lua | 38 | ||||
-rw-r--r-- | src/base/UMain.pas | 29 | ||||
-rw-r--r-- | src/lib/Lua/ULua.pas | 1080 | ||||
-rw-r--r-- | src/lua/ULuaGl.pas | 1427 | ||||
-rw-r--r-- | src/lua/ULuaLog.pas | 166 | ||||
-rw-r--r-- | src/ultrastardx.dpr | 7 |
7 files changed, 2747 insertions, 0 deletions
diff --git a/game/LuaCommands.odt b/game/LuaCommands.odt Binary files differnew file mode 100644 index 00000000..fcbcc426 --- /dev/null +++ b/game/LuaCommands.odt diff --git a/game/main.lua b/game/main.lua new file mode 100644 index 00000000..ed12d8ed --- /dev/null +++ b/game/main.lua @@ -0,0 +1,38 @@ +-- Calculate FPS +FPScounter = 1 + (FPScounter or 0) -- increment FPScounter (which is nil, when undefined, therefore "or 0") +if os.time() > (LastTime or 0) then + LastTime = os.time() + print("FPS: " .. FPScounter - (LastFPScounter or 0)) -- print is only displayed, if compiled with DEBUG + LastFPScounter = FPScounter + -- Show the first 200 Textures + TexNum = 1 + (TexNum or 0) + if TexNum > 200 then TexNum = 1 end + print("TexNum: " .. (TexNum or 0)) +end + +-- Draw some rectangles +gl.Enable("GL_BLEND") +gl.Color(1, 1, 1, 0.5) +for i = 1,10 do + gl.Begin("GL_LINE_loop") + gl.Vertex(0+4*i, 0+4*i); + gl.Vertex(0+4*i, 600-4*i); + gl.Vertex(800-4*i, 600-4*i); + gl.Vertex(800-4*i, 0+4*i); + gl.End() +end +gl.Disable("GL_BLEND") + +-- Display a Texture +gl.Enable("GL_BLEND") +gl.Enable("GL_TEXTURE_2D") +gl.Color(1, 1, 1, 1) +gl.BindTexture("GL_TEXTURE_2D", TexNum or 0) +gl.Begin("GL_QUADS") +gl.TexCoord(0, 0); gl.Vertex(10, 10); +gl.TexCoord(0, 1); gl.Vertex(10, 110); +gl.TexCoord(1, 1); gl.Vertex(110, 110); +gl.TexCoord(1, 0); gl.Vertex(110, 10); +gl.End() +gl.Disable("GL_TEXTURE_2D") +gl.Disable("GL_BLEND") diff --git a/src/base/UMain.pas b/src/base/UMain.pas index 6300f18b..99127b76 100644 --- a/src/base/UMain.pas +++ b/src/base/UMain.pas @@ -46,6 +46,7 @@ uses ULyrics, UScreenSing, USong, + ULua, gl; type @@ -116,6 +117,7 @@ var PlayersPlay: integer; CurrentSong : TSong; + Lua : Plua_State; const MAX_SONG_SCORE = 10000; // max. achievable points per song @@ -180,6 +182,8 @@ uses UGraphicClasses, UPluginDefs, UPlatform, + ULuaLog, + ULuaGl, UThemes; @@ -379,6 +383,19 @@ begin Log.LogBenchmark('Initializing Joystick', 1); end; + // Lua + Log.BenchmarkStart(1); + Lua := luaL_newstate; + if Lua = nil then + Log.LogError('Lua init failed','Lua'); + luaL_openlibs(Lua); + + luaopen_Log(Lua); // Log + Benchmark (Lua) + luaopen_gl(Lua); // gl (Lua) + + Log.BenchmarkEnd(1); + Log.LogBenchmark('Initializing Lua', 1); + Log.BenchmarkEnd(0); Log.LogBenchmark('Loading Time', 0); @@ -416,6 +433,8 @@ begin //TTF_Quit(); SDL_Quit(); + lua_close(Lua); + if assigned(Log) then begin Log.LogStatus('Main Loop', 'Finished'); @@ -446,6 +465,16 @@ begin // display done := not Display.Draw; + + // FIXME remove this when the Partymode works + if FileExists('main.lua') then + begin + if 0 <> luaL_dofile(Lua, 'main.lua') then + begin + Log.LogError(lua_tostring(Lua,-1)); + end; + end; + SwapBuffers; // delay diff --git a/src/lib/Lua/ULua.pas b/src/lib/Lua/ULua.pas new file mode 100644 index 00000000..e05de12c --- /dev/null +++ b/src/lib/Lua/ULua.pas @@ -0,0 +1,1080 @@ +unit ULua; + +(* + * A complete Pascal wrapper for Lua 5.1 DLL module. + * + * Created by Geo Massar, 2006 + * Distributed as free/open source. + *) + +interface + +{$IFDEF UNIX} +uses + dl; +{$ENDIF} + +{$DEFINE LUA51} + +type + size_t = type Cardinal; + Psize_t = ^size_t; + PPointer = ^Pointer; + + lua_State = record end; + Plua_State = ^lua_State; + +const +{$IFDEF WIN32} + LuaDLL = 'lua5.1.dll'; +{$ENDIF} +{$IFDEF UNIX} +{$IFDEF DARWIN} + LuaDLL = 'lua5.1.dylib'; +{$ELSE} + LuaDLL = 'lua5.1.so'; +{$ENDIF} +{$ENDIF} +{$IFDEF MACOS} + SDLgfxLibName = 'lua5.1'; +{$ENDIF} + +(* formats for Lua numbers *) +{$IFNDEF LUA_NUMBER_SCAN} +const + LUA_NUMBER_SCAN = '%lf'; +{$ENDIF} + +{$IFNDEF LUA_NUMBER_FMT} +const + LUA_NUMBER_FMT = '%.14g'; +{$ENDIF} + +(*****************************************************************************) +(* luaconfig.h *) +(*****************************************************************************) + +(* +** $Id: luaconf.h,v 1.81 2006/02/10 17:44:06 roberto Exp $ +** Configuration file for Lua +** See Copyright Notice in lua.h +*) + +(* +** {================================================================== +@@ LUA_NUMBER is the type of numbers in Lua. +** CHANGE the following definitions only if you want to build Lua +** with a number type different from double. You may also need to +** change lua_number2int & lua_number2integer. +** =================================================================== +*) +type + LUA_NUMBER_ = type Double; // ending underscore is needed in Pascal + LUA_INTEGER_ = type Integer; + +(* +@@ LUA_IDSIZE gives the maximum size for the description of the source +@* of a function in debug information. +** CHANGE it if you want a different size. +*) +const + LUA_IDSIZE = 60; + +(* +@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. +*) +const + LUAL_BUFFERSIZE = 1024; + +(* +@@ LUA_PROMPT is the default prompt used by stand-alone Lua. +@@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua. +** CHANGE them if you want different prompts. (You can also change the +** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.) +*) +const + LUA_PROMPT = '> '; + LUA_PROMPT2 = '>> '; + +(* +@@ lua_readline defines how to show a prompt and then read a line from +@* the standard input. +@@ lua_saveline defines how to "save" a read line in a "history". +@@ lua_freeline defines how to free a line read by lua_readline. +** CHANGE them if you want to improve this functionality (e.g., by using +** GNU readline and history facilities). +*) +function lua_readline(L : Plua_State; var b : PChar; p : PChar): Boolean; +procedure lua_saveline(L : Plua_State; idx : Integer); +procedure lua_freeline(L : Plua_State; b : PChar); + +(* +@@ lua_stdin_is_tty detects whether the standard input is a 'tty' (that +@* is, whether we're running lua interactively). +** CHANGE it if you have a better definition for non-POSIX/non-Windows +** systems. +*/ +#include <io.h> +#include <stdio.h> +#define lua_stdin_is_tty() _isatty(_fileno(stdin)) +*) +const + lua_stdin_is_tty = TRUE; + +(*****************************************************************************) +(* lua.h *) +(*****************************************************************************) + +(* +** $Id: lua.h,v 1.216 2006/01/10 12:50:13 roberto Exp $ +** Lua - An Extensible Extension Language +** Lua.org, PUC-Rio, Brazil (http://www.lua.org) +** See Copyright Notice at the end of this file +*) + +const + LUA_VERSION = 'Lua 5.1'; + LUA_VERSION_NUM = 501; + LUA_COPYRIGHT = 'Copyright (C) 1994-2006 Tecgraf, PUC-Rio'; + LUA_AUTHORS = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes'; + + (* mark for precompiled code (`<esc>Lua') *) + LUA_SIGNATURE = #27'Lua'; + + (* option for multiple returns in `lua_pcall' and `lua_call' *) + LUA_MULTRET = -1; + + (* + ** pseudo-indices + *) + LUA_REGISTRYINDEX = -10000; + LUA_ENVIRONINDEX = -10001; + LUA_GLOBALSINDEX = -10002; + +function lua_upvalueindex(idx : Integer) : Integer; // a marco + +const + (* thread status; 0 is OK *) + LUA_YIELD_ = 1; // Note: the ending underscore is needed in Pascal + LUA_ERRRUN = 2; + LUA_ERRSYNTAX = 3; + LUA_ERRMEM = 4; + LUA_ERRERR = 5; + +type + lua_CFunction = function(L : Plua_State) : Integer; cdecl; + + (* + ** functions that read/write blocks when loading/dumping Lua chunks + *) + lua_Reader = function (L : Plua_State; ud : Pointer; + sz : Psize_t) : PChar; cdecl; + lua_Writer = function (L : Plua_State; const p : Pointer; sz : size_t; + ud : Pointer) : Integer; cdecl; + + (* + ** prototype for memory-allocation functions + *) + lua_Alloc = function (ud, ptr : Pointer; + osize, nsize : size_t) : Pointer; cdecl; + +const + (* + ** basic types + *) + LUA_TNONE = -1; + + LUA_TNIL = 0; + LUA_TBOOLEAN = 1; + LUA_TLIGHTUSERDATA = 2; + LUA_TNUMBER = 3; + LUA_TSTRING = 4; + LUA_TTABLE = 5; + LUA_TFUNCTION = 6; + LUA_TUSERDATA = 7; + LUA_TTHREAD = 8; + + (* minimum Lua stack available to a C function *) + LUA_MINSTACK = 20; + +type + (* type of numbers in Lua *) + lua_Number = LUA_NUMBER_; + + (* type for integer functions *) + lua_Integer = LUA_INTEGER_; + +(* +** state manipulation +*) +function lua_newstate(f : lua_Alloc; ud : Pointer) : Plua_State; + cdecl; external LuaDLL; +procedure lua_close(L: Plua_State); + cdecl; external LuaDLL; +function lua_newthread(L : Plua_State) : Plua_State; + cdecl; external LuaDLL; + +function lua_atpanic(L : Plua_State; panicf : lua_CFunction) : lua_CFunction; + cdecl; external LuaDLL; + + +(* +** basic stack manipulation +*) +function lua_gettop(L : Plua_State) : Integer; + cdecl; external LuaDLL; +procedure lua_settop(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_pushvalue(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_remove(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_insert(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_replace(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +function lua_checkstack(L : Plua_State; sz : Integer) : LongBool; + cdecl; external LuaDLL; + +procedure lua_xmove(src, dest : Plua_State; n : Integer); + cdecl; external LuaDLL; + + +(* +** access functions (stack -> C) +*) +function lua_isnumber(L : Plua_State; idx : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_isstring(L : Plua_State; idx : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_iscfunction(L : Plua_State; idx : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_isuserdata(L : Plua_State; idx : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_type(L : Plua_State; idx : Integer) : Integer; + cdecl; external LuaDLL; +function lua_typename(L : Plua_State; tp : Integer) : PChar; + cdecl; external LuaDLL; + +function lua_equal(L : Plua_State; idx1, idx2 : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_rawequal(L : Plua_State; idx1, idx2 : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_lessthan(L : Plua_State; idx1, idx2 : Integer) : LongBool; + cdecl; external LuaDLL; + +function lua_tonumber(L : Plua_State; idx : Integer) : lua_Number; + cdecl; external LuaDLL; +function lua_tointeger(L : Plua_State; idx : Integer) : lua_Integer; + cdecl; external LuaDLL; +function lua_toboolean(L : Plua_State; idx : Integer) : LongBool; + cdecl; external LuaDLL; +function lua_tolstring(L : Plua_State; idx : Integer; + len : Psize_t) : PChar; + cdecl; external LuaDLL; +function lua_objlen(L : Plua_State; idx : Integer) : size_t; + cdecl; external LuaDLL; +function lua_tocfunction(L : Plua_State; idx : Integer) : lua_CFunction; + cdecl; external LuaDLL; +function lua_touserdata(L : Plua_State; idx : Integer) : Pointer; + cdecl; external LuaDLL; +function lua_tothread(L : Plua_State; idx : Integer) : Plua_State; + cdecl; external LuaDLL; +function lua_topointer(L : Plua_State; idx : Integer) : Pointer; + cdecl; external LuaDLL; + + +(* +** push functions (C -> stack) +*) +procedure lua_pushnil(L : Plua_State); + cdecl; external LuaDLL; +procedure lua_pushnumber(L : Plua_State; n : lua_Number); + cdecl; external LuaDLL; +procedure lua_pushinteger(L : Plua_State; n : lua_Integer); + cdecl; external LuaDLL; +procedure lua_pushlstring(L : Plua_State; const s : PChar; ls : size_t); + cdecl; external LuaDLL; +procedure lua_pushstring(L : Plua_State; const s : PChar); + cdecl; external LuaDLL; +function lua_pushvfstring(L : Plua_State; + const fmt : PChar; argp : Pointer) : PChar; + cdecl; external LuaDLL; +function lua_pushfstring(L : Plua_State; const fmt : PChar) : PChar; varargs; + cdecl; external LuaDLL; +procedure lua_pushcclosure(L : Plua_State; fn : lua_CFunction; n : Integer); + cdecl; external LuaDLL; +procedure lua_pushboolean(L : Plua_State; b : LongBool); + cdecl; external LuaDLL; +procedure lua_pushlightuserdata(L : Plua_State; p : Pointer); + cdecl; external LuaDLL; +function lua_pushthread(L : Plua_state) : Cardinal; + cdecl; external LuaDLL; + + +(* +** get functions (Lua -> stack) +*) +procedure lua_gettable(L : Plua_State ; idx : Integer); + cdecl; external LuaDLL; +procedure lua_getfield(L : Plua_State; idx : Integer; k : PChar); + cdecl; external LuaDLL; +procedure lua_rawget(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_rawgeti(L : Plua_State; idx, n : Integer); + cdecl; external LuaDLL; +procedure lua_createtable(L : Plua_State; narr, nrec : Integer); + cdecl; external LuaDLL; +function lua_newuserdata(L : Plua_State; sz : size_t) : Pointer; + cdecl; external LuaDLL; +function lua_getmetatable(L : Plua_State; objindex : Integer) : LongBool; + cdecl; external LuaDLL; +procedure lua_getfenv(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; + + +(* +** set functions (stack -> Lua) +*) +procedure lua_settable(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_setfield(L : Plua_State; idx : Integer; const k : PChar); + cdecl; external LuaDLL; +procedure lua_rawset(L : Plua_State; idx : Integer); + cdecl; external LuaDLL; +procedure lua_rawseti(L : Plua_State; idx , n: Integer); + cdecl; external LuaDLL; +function lua_setmetatable(L : Plua_State; objindex : Integer): LongBool; + cdecl; external LuaDLL; +function lua_setfenv(L : Plua_State; idx : Integer): LongBool; + cdecl; external LuaDLL; + +(* +** `load' and `call' functions (load and run Lua code) +*) +procedure lua_call(L : Plua_State; nargs, nresults : Integer); + cdecl; external LuaDLL; +function lua_pcall(L : Plua_State; + nargs, nresults, errfunc : Integer) : Integer; + cdecl; external LuaDLL; +function lua_cpcall(L : Plua_State; + func : lua_CFunction; ud : Pointer) : Integer; + cdecl; external LuaDLL; +function lua_load(L : Plua_State; reader : lua_Reader; + dt : Pointer; const chunkname : PChar) : Integer; + cdecl; external LuaDLL; + +function lua_dump(L : Plua_State; writer : lua_Writer; data: Pointer) : Integer; + cdecl; external LuaDLL; + + +(* +** coroutine functions +*) +function lua_yield(L : Plua_State; nresults : Integer) : Integer; + cdecl; external LuaDLL; +function lua_resume(L : Plua_State; narg : Integer) : Integer; + cdecl; external LuaDLL; +function lua_status(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +(* +** garbage-collection functions and options +*) +const + LUA_GCSTOP = 0; + LUA_GCRESTART = 1; + LUA_GCCOLLECT = 2; + LUA_GCCOUNT = 3; + LUA_GCCOUNTB = 4; + LUA_GCSTEP = 5; + LUA_GCSETPAUSE = 6; + LUA_GCSETSTEPMUL = 7; + +function lua_gc(L : Plua_State; what, data : Integer) : Integer; + cdecl; external LuaDLL; + +(* +** miscellaneous functions +*) +function lua_error(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function lua_next(L : Plua_State; idx : Integer) : Integer; + cdecl; external LuaDLL; + +procedure lua_concat(L : Plua_State; n : Integer); + cdecl; external LuaDLL; + +function lua_getallocf(L : Plua_State; ud : PPointer) : lua_Alloc; + cdecl; external LuaDLL; +procedure lua_setallocf(L : Plua_State; f : lua_Alloc; ud : Pointer); + cdecl; external LuaDLL; + +(* +** =============================================================== +** some useful macros +** =============================================================== +*) +procedure lua_pop(L : Plua_State; n : Integer); + +procedure lua_newtable(L : Plua_State); + +procedure lua_register(L : Plua_State; n : PChar; f : lua_CFunction); + +procedure lua_pushcfunction(L : Plua_State; f : lua_CFunction); + +function lua_strlen(L : Plua_State; idx : Integer) : Integer; + +function lua_isfunction(L : Plua_State; n : Integer) : Boolean; +function lua_istable(L : Plua_State; n : Integer) : Boolean; +function lua_islightuserdata(L : Plua_State; n : Integer) : Boolean; +function lua_isnil(L : Plua_State; n : Integer) : Boolean; +function lua_isboolean(L : Plua_State; n : Integer) : Boolean; +function lua_isthread(L : Plua_State; n : Integer) : Boolean; +function lua_isnone(L : Plua_State; n : Integer) : Boolean; +function lua_isnoneornil(L : Plua_State; n : Integer) : Boolean; + +procedure lua_pushliteral(L : Plua_State; s : PChar); + +procedure lua_setglobal(L : Plua_State; s : PChar); +procedure lua_getglobal(L : Plua_State; s : PChar); + +function lua_tostring(L : Plua_State; idx : Integer) : PChar; + + +(* +** compatibility macros and functions +*) +function lua_open : Plua_State; + +procedure lua_getregistry(L : Plua_State); + +function lua_getgccount(L : Plua_State) : Integer; + +type + lua_Chuckreader = type lua_Reader; + lua_Chuckwriter = type lua_Writer; + +(* ====================================================================== *) + +(* +** {====================================================================== +** Debug API +** ======================================================================= +*) + +(* +** Event codes +*) +const + LUA_HOOKCALL = 0; + LUA_HOOKRET = 1; + LUA_HOOKLINE = 2; + LUA_HOOKCOUNT = 3; + LUA_HOOKTAILRET = 4; + + +(* +** Event masks +*) + LUA_MASKCALL = 1 shl LUA_HOOKCALL; + LUA_MASKRET = 1 shl LUA_HOOKRET; + LUA_MASKLINE = 1 shl LUA_HOOKLINE; + LUA_MASKCOUNT = 1 shl LUA_HOOKCOUNT; + +type + lua_Debug = packed record + event : Integer; + name : PChar; (* (n) *) + namewhat : PChar; (* (n) `global', `local', `field', `method' *) + what : PChar; (* (S) `Lua', `C', `main', `tail' *) + source : PChar; (* (S) *) + currentline : Integer; (* (l) *) + nups : Integer; (* (u) number of upvalues *) + linedefined : Integer; (* (S) *) + short_src : array [0..LUA_IDSIZE-1] of Char; (* (S) *) + (* private part *) + i_ci : Integer; (* active function *) + end; + Plua_Debug = ^lua_Debug; + + (* Functions to be called by the debuger in specific events *) + lua_Hook = procedure (L : Plua_State; ar : Plua_Debug); cdecl; + + +function lua_getstack(L : Plua_State; level : Integer; + ar : Plua_Debug) : Integer; + cdecl; external LuaDLL; +function lua_getinfo(L : Plua_State; const what : PChar; + ar: Plua_Debug): Integer; + cdecl; external LuaDLL; +function lua_getlocal(L : Plua_State; + ar : Plua_Debug; n : Integer) : PChar; + cdecl; external LuaDLL; +function lua_setlocal(L : Plua_State; + ar : Plua_Debug; n : Integer) : PChar; + cdecl; external LuaDLL; +function lua_getupvalue(L : Plua_State; funcindex, n : Integer) : PChar; + cdecl; external LuaDLL; +function lua_setupvalue(L : Plua_State; funcindex, n : Integer) : PChar; + cdecl; external LuaDLL; + +function lua_sethook(L : Plua_State; func : lua_Hook; + mask, count: Integer): Integer; + cdecl; external LuaDLL; +{ +function lua_gethook(L : Plua_State) : lua_Hook; + cdecl; external LuaDLL; +} +function lua_gethookmask(L : Plua_State) : Integer; + cdecl; external LuaDLL; +function lua_gethookcount(L : Plua_State) : Integer; + cdecl; external LuaDLL; + + +(*****************************************************************************) +(* lualib.h *) +(*****************************************************************************) + +(* +** $Id: lualib.h,v 1.36 2005/12/27 17:12:00 roberto Exp $ +** Lua standard libraries +** See Copyright Notice at the end of this file +*) + +const + (* Key to file-handle type *) + LUA_FILEHANDLE = 'FILE*'; + + LUA_COLIBNAME = 'coroutine'; + LUA_TABLIBNAME = 'table'; + LUA_IOLIBNAME = 'io'; + LUA_OSLIBNAME = 'os'; + LUA_STRLIBNAME = 'string'; + LUA_MATHLIBNAME = 'math'; + LUA_DBLIBNAME = 'debug'; + LUA_LOADLIBNAME = 'package'; + +function luaopen_base(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_table(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_io(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_os(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_string(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_math(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_debug(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +function luaopen_package(L : Plua_State) : Integer; + cdecl; external LuaDLL; + +procedure luaL_openlibs(L : Plua_State); + cdecl; external LuaDLL; + +procedure lua_assert(x : Boolean); // a macro + + +(*****************************************************************************) +(* lauxlib.h *) +(*****************************************************************************) + +(* +** $Id: lauxlib.h,v 1.87 2005/12/29 15:32:11 roberto Exp $ +** Auxiliary functions for building Lua libraries +** See Copyright Notice at the end of this file. +*) + +// not compatibility with the behavior of setn/getn in Lua 5.0 +function luaL_getn(L : Plua_State; idx : Integer) : Integer; +procedure luaL_setn(L : Plua_State; i, j : Integer); + +const + LUA_ERRFILE = LUA_ERRERR + 1; + +type + luaL_Reg = packed record + name : PChar; + func : lua_CFunction; + end; + PluaL_Reg = ^luaL_Reg; + + +procedure luaL_openlib(L : Plua_State; const libname : PChar; + const lr : PluaL_Reg; nup : Integer); + cdecl; external LuaDLL; +procedure luaL_register(L : Plua_State; const libname : PChar; + const lr : PluaL_Reg); + cdecl; external LuaDLL; +function luaL_getmetafield(L : Plua_State; obj : Integer; + const e : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_callmeta(L : Plua_State; obj : Integer; + const e : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_typerror(L : Plua_State; narg : Integer; + const tname : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_argerror(L : Plua_State; numarg : Integer; + const extramsg : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_checklstring(L : Plua_State; numArg : Integer; + ls : Psize_t) : PChar; + cdecl; external LuaDLL; +function luaL_optlstring(L : Plua_State; numArg : Integer; + const def: PChar; ls: Psize_t) : PChar; + cdecl; external LuaDLL; +function luaL_checknumber(L : Plua_State; numArg : Integer) : lua_Number; + cdecl; external LuaDLL; +function luaL_optnumber(L : Plua_State; nArg : Integer; + def : lua_Number) : lua_Number; + cdecl; external LuaDLL; + +function luaL_checkinteger(L : Plua_State; numArg : Integer) : lua_Integer; + cdecl; external LuaDLL; +function luaL_optinteger(L : Plua_State; nArg : Integer; + def : lua_Integer) : lua_Integer; + cdecl; external LuaDLL; + +procedure luaL_checkstack(L : Plua_State; sz : Integer; const msg : PChar); + cdecl; external LuaDLL; +procedure luaL_checktype(L : Plua_State; narg, t : Integer); + cdecl; external LuaDLL; +procedure luaL_checkany(L : Plua_State; narg : Integer); + cdecl; external LuaDLL; + +function luaL_newmetatable(L : Plua_State; const tname : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_checkudata(L : Plua_State; ud : Integer; + const tname : PChar) : Pointer; + cdecl; external LuaDLL; + +procedure luaL_where(L : Plua_State; lvl : Integer); + cdecl; external LuaDLL; +function luaL_error(L : Plua_State; const fmt : PChar) : Integer; varargs; + cdecl; external LuaDLL; + +function luaL_checkoption(L : Plua_State; narg : Integer; const def : PChar; + const lst : array of PChar) : Integer; + cdecl; external LuaDLL; + +function luaL_ref(L : Plua_State; t : Integer) : Integer; + cdecl; external LuaDLL; +procedure luaL_unref(L : Plua_State; t, ref : Integer); + cdecl; external LuaDLL; + +function luaL_loadfile(L : Plua_State; const filename : PChar) : Integer; + cdecl; external LuaDLL; +function luaL_loadbuffer(L : Plua_State; const buff : PChar; + sz : size_t; const name: PChar) : Integer; + cdecl; external LuaDLL; + +function luaL_loadstring(L : Plua_State; const s : Pchar) : Integer; + cdecl; external LuaDLL; + +function luaL_newstate : Plua_State; + cdecl; external LuaDLL; + +function luaL_gsub(L : Plua_State; const s, p, r : PChar) : PChar; + cdecl; external LuaDLL; + +function luaL_findtable(L : Plua_State; idx : Integer; + const fname : PChar; szhint : Integer) : PChar; + cdecl; external LuaDLL; + + +(* +** =============================================================== +** some useful macros +** =============================================================== +*) + +function luaL_argcheck(L : Plua_State; cond : Boolean; numarg : Integer; + extramsg : PChar): Integer; +function luaL_checkstring(L : Plua_State; n : Integer) : PChar; +function luaL_optstring(L : Plua_State; n : Integer; d : PChar) : PChar; +function luaL_checkint(L : Plua_State; n : Integer) : Integer; +function luaL_optint(L : Plua_State; n, d : Integer): Integer; +function luaL_checklong(L : Plua_State; n : LongInt) : LongInt; +function luaL_optlong(L : Plua_State; n : Integer; d : LongInt) : LongInt; + +function luaL_typename(L : Plua_State; idx : Integer) : PChar; + +function luaL_dofile(L : Plua_State; fn : PChar) : Integer; + +function luaL_dostring(L : Plua_State; s : PChar) : Integer; + +procedure luaL_getmetatable(L : Plua_State; n : PChar); + +(* not implemented yet +#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) +*) + +(* +** {====================================================== +** Generic Buffer manipulation +** ======================================================= +*) + +type + luaL_Buffer = packed record + p : PChar; (* current position in buffer *) + lvl : Integer; (* number of strings in the stack (level) *) + L : Plua_State; + buffer : array [0..LUAL_BUFFERSIZE-1] of Char; + end; + PluaL_Buffer = ^luaL_Buffer; + +procedure luaL_addchar(B : PluaL_Buffer; c : Char); + +(* compatibility only *) +procedure luaL_putchar(B : PluaL_Buffer; c : Char); + +procedure luaL_addsize(B : PluaL_Buffer; n : Integer); + +procedure luaL_buffinit(L : Plua_State; B : PluaL_Buffer); + cdecl; external LuaDLL; +function luaL_prepbuffer(B : PluaL_Buffer) : PChar; + cdecl; external LuaDLL; +procedure luaL_addlstring(B : PluaL_Buffer; const s : PChar; ls : size_t); + cdecl; external LuaDLL; +procedure luaL_addstring(B : PluaL_Buffer; const s : PChar); + cdecl; external LuaDLL; +procedure luaL_addvalue(B : PluaL_Buffer); + cdecl; external LuaDLL; +procedure luaL_pushresult(B : PluaL_Buffer); + cdecl; external LuaDLL; + +(* ====================================================== *) + + +(* compatibility with ref system *) + +(* pre-defined references *) +const + LUA_NOREF = -2; + LUA_REFNIL = -1; + +function lua_ref(L : Plua_State; lock : Boolean) : Integer; + +procedure lua_unref(L : Plua_State; ref : Integer); + +procedure lua_getref(L : Plua_State; ref : Integer); + + +(******************************************************************************) +(******************************************************************************) +(******************************************************************************) + +implementation + +uses + SysUtils; + +(*****************************************************************************) +(* luaconfig.h *) +(*****************************************************************************) + +function lua_readline(L : Plua_State; var b : PChar; p : PChar): Boolean; +var + s : AnsiString; +begin + Write(p); // show prompt + ReadLn(s); // get line + b := PChar(s); // and return it + lua_readline := (b[0] <> #4); // test for ctrl-D +end; + +procedure lua_saveline(L : Plua_State; idx : Integer); +begin +end; + +procedure lua_freeline(L : Plua_State; b : PChar); +begin +end; + + +(*****************************************************************************) +(* lua.h *) +(*****************************************************************************) + +function lua_upvalueindex(idx : Integer) : Integer; +begin + lua_upvalueindex := LUA_GLOBALSINDEX - idx; +end; + +procedure lua_pop(L : Plua_State; n : Integer); +begin + lua_settop(L, -n - 1); +end; + +procedure lua_newtable(L : Plua_State); +begin + lua_createtable(L, 0, 0); +end; + +procedure lua_register(L : Plua_State; n : PChar; f : lua_CFunction); +begin + lua_pushcfunction(L, f); + lua_setglobal(L, n); +end; + +procedure lua_pushcfunction(L : Plua_State; f : lua_CFunction); +begin + lua_pushcclosure(L, f, 0); +end; + +function lua_strlen(L : Plua_State; idx : Integer) : Integer; +begin + lua_strlen := lua_objlen(L, idx); +end; + +function lua_isfunction(L : Plua_State; n : Integer) : Boolean; +begin + lua_isfunction := lua_type(L, n) = LUA_TFUNCTION; +end; + +function lua_istable(L : Plua_State; n : Integer) : Boolean; +begin + lua_istable := lua_type(L, n) = LUA_TTABLE; +end; + +function lua_islightuserdata(L : Plua_State; n : Integer) : Boolean; +begin + lua_islightuserdata := lua_type(L, n) = LUA_TLIGHTUSERDATA; +end; + +function lua_isnil(L : Plua_State; n : Integer) : Boolean; +begin + lua_isnil := lua_type(L, n) = LUA_TNIL; +end; + +function lua_isboolean(L : Plua_State; n : Integer) : Boolean; +begin + lua_isboolean := lua_type(L, n) = LUA_TBOOLEAN; +end; + +function lua_isthread(L : Plua_State; n : Integer) : Boolean; +begin + lua_isthread := lua_type(L, n) = LUA_TTHREAD; +end; + +function lua_isnone(L : Plua_State; n : Integer) : Boolean; +begin + lua_isnone := lua_type(L, n) = LUA_TNONE; +end; + +function lua_isnoneornil(L : Plua_State; n : Integer) : Boolean; +begin + lua_isnoneornil := lua_type(L, n) <= 0; +end; + +procedure lua_pushliteral(L : Plua_State; s : PChar); +begin + lua_pushlstring(L, s, StrLen(s)); +end; + +procedure lua_setglobal(L : Plua_State; s : PChar); +begin + lua_setfield(L, LUA_GLOBALSINDEX, s); +end; + +procedure lua_getglobal(L: Plua_State; s: PChar); +begin + lua_getfield(L, LUA_GLOBALSINDEX, s); +end; + +function lua_tostring(L : Plua_State; idx : Integer) : PChar; +begin + lua_tostring := lua_tolstring(L, idx, nil); +end; + +function lua_open : Plua_State; +begin + lua_open := luaL_newstate; +end; + +procedure lua_getregistry(L : Plua_State); +begin + lua_pushvalue(L, LUA_REGISTRYINDEX); +end; + +function lua_getgccount(L : Plua_State) : Integer; +begin + lua_getgccount := lua_gc(L, LUA_GCCOUNT, 0); +end; + + +(*****************************************************************************) +(* lualib.h *) +(*****************************************************************************) + +procedure lua_assert(x : Boolean); +begin +end; + + +(*****************************************************************************) +(* lauxlib.h n *) +(*****************************************************************************) + +function luaL_getn(L : Plua_State; idx : Integer) : Integer; +begin + luaL_getn := lua_objlen(L, idx); +end; + +procedure luaL_setn(L : plua_State; i, j : Integer); +begin + (* no op *) +end; + +function luaL_argcheck(L : Plua_State; cond : Boolean; numarg : Integer; + extramsg : PChar): Integer; +begin + if not cond then + luaL_argcheck := luaL_argerror(L, numarg, extramsg) + else + luaL_argcheck := 0; +end; + +function luaL_checkstring(L : Plua_State; n : Integer) : PChar; +begin + luaL_checkstring := luaL_checklstring(L, n, nil); +end; + +function luaL_optstring(L : Plua_State; n : Integer; d : PChar) : PChar; +begin + luaL_optstring := luaL_optlstring(L, n, d, nil); +end; + +function luaL_checkint(L : Plua_State; n : Integer) : Integer; +begin + luaL_checkint := luaL_checkinteger(L, n); +end; + +function luaL_optint(L : Plua_State; n, d : Integer): Integer; +begin + luaL_optint := luaL_optinteger(L, n, d); +end; + +function luaL_checklong(L : Plua_State; n : LongInt) : LongInt; +begin + luaL_checklong := luaL_checkinteger(L, n); +end; + +function luaL_optlong(L : Plua_State; n : Integer; d : LongInt) : LongInt; +begin + luaL_optlong := luaL_optinteger(L, n, d); +end; + +function luaL_typename(L : Plua_State; idx : Integer) : PChar; +begin + luaL_typename := lua_typename( L, lua_type(L, idx) ); +end; + +function luaL_dofile(L : Plua_State; fn : PChar) : Integer; +Var + Res : Integer; +begin + // WC 2007\03\22 - Updated for Delphi + Res := luaL_loadfile(L, fn); + if Res = 0 then + Res := lua_pcall(L, 0, LUA_MULTRET, 0); + Result := Res; +end; + +function luaL_dostring(L : Plua_State; s : PChar) : Integer; +Var + Res : Integer; +begin + // WC 2007\03\22 - Updated for Delphi + Res := luaL_loadstring(L, s); + if Res = 0 then + Res := lua_pcall(L, 0, LUA_MULTRET, 0); + Result := Res; +end; + +procedure luaL_getmetatable(L : Plua_State; n : PChar); +begin + lua_getfield(L, LUA_REGISTRYINDEX, n); +end; + +procedure luaL_addchar(B : PluaL_Buffer; c : Char); +begin + if not(B^.p < B^.buffer + LUAL_BUFFERSIZE) then + luaL_prepbuffer(B); + B^.p^ := c; + Inc(B^.p); +end; + +procedure luaL_putchar(B : PluaL_Buffer; c : Char); +begin + luaL_addchar(B, c); +end; + +procedure luaL_addsize(B : PluaL_Buffer; n : Integer); +begin + Inc(B^.p, n); +end; + +function lua_ref(L : Plua_State; lock : Boolean) : Integer; +begin + if lock then + lua_ref := luaL_ref(L, LUA_REGISTRYINDEX) + else begin + lua_pushstring(L, 'unlocked references are obsolete'); + lua_error(L); + lua_ref := 0; + end; +end; + +procedure lua_unref(L : Plua_State; ref : Integer); +begin + luaL_unref(L, LUA_REGISTRYINDEX, ref); +end; + +procedure lua_getref(L : Plua_State; ref : Integer); +begin + lua_rawgeti(L, LUA_REGISTRYINDEX, ref); +end; + + +(****************************************************************************** +* Original copyright for the lua source and headers: +* 1994-2004 Tecgraf, PUC-Rio. +* www.lua.org. +* +* +* Permission is hereby granted, free of charge, to any person obtaining +* a copy of this software and associated documentation files (the +* "Software"), to deal in the Software without restriction, including +* without limitation the rights to use, copy, modify, merge, publish, +* distribute, sublicense, and/or sell copies of the Software, and to +* permit persons to whom the Software is furnished to do so, subject to +* the following conditions: +* +* The above copyright notice and this permission notice shall be +* included in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +******************************************************************************) + +end. + diff --git a/src/lua/ULuaGl.pas b/src/lua/ULuaGl.pas new file mode 100644 index 00000000..74fa1a9e --- /dev/null +++ b/src/lua/ULuaGl.pas @@ -0,0 +1,1427 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + +unit ULuaGl; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SysUtils, + gl, + ULua; + +function luaopen_gl (L: Plua_State): Integer; cdecl; +function ULuaGl_StringToEnum(Str: String): GLenum; + +function ULuaGl_Begin(L: Plua_State): Integer; cdecl; +function ULuaGl_BindTexture(L: Plua_State): Integer; cdecl; +function ULuaGl_BlendFunc(L: Plua_State): Integer; cdecl; +function ULuaGl_Clear(L: Plua_State): Integer; cdecl; +function ULuaGl_ClearColor(L: Plua_State): Integer; cdecl; +function ULuaGl_Color(L: Plua_State): Integer; cdecl; +function ULuaGl_CullFace(L: Plua_State): Integer; cdecl; +function ULuaGl_DepthFunc(L: Plua_State): Integer; cdecl; +function ULuaGl_Disable(L: Plua_State): Integer; cdecl; +function ULuaGl_DisableClientState(L: Plua_State): Integer; cdecl; +function ULuaGl_DrawBuffer(L: Plua_State): Integer; cdecl; +function ULuaGl_Enable(L: Plua_State): Integer; cdecl; +function ULuaGl_EnableClientState(L: Plua_State): Integer; cdecl; +function ULuaGl_End(L: Plua_State): Integer; cdecl; +function ULuaGl_EndList(L: Plua_State): Integer; cdecl; +function ULuaGl_Finish(L: Plua_State): Integer; cdecl; +function ULuaGl_Flush(L: Plua_State): Integer; cdecl; +function ULuaGl_FrontFace(L: Plua_State): Integer; cdecl; +function ULuaGl_InitNames(L: Plua_State): Integer; cdecl; +function ULuaGl_LoadIdentity(L: Plua_State): Integer; cdecl; +function ULuaGl_LogicOp(L: Plua_State): Integer; cdecl; +function ULuaGl_MatrixMode(L: Plua_State): Integer; cdecl; +function ULuaGl_PopAttrib(L: Plua_State): Integer; cdecl; +function ULuaGl_PopClientAttrib(L: Plua_State): Integer; cdecl; +function ULuaGl_PopMatrix(L: Plua_State): Integer; cdecl; +function ULuaGl_PopName(L: Plua_State): Integer; cdecl; +function ULuaGl_PushMatrix(L: Plua_State): Integer; cdecl; +function ULuaGl_RasterPos(L: Plua_State): Integer; cdecl; +function ULuaGl_ReadBuffer(L: Plua_State): Integer; cdecl; +function ULuaGl_Rect(L: Plua_State): Integer; cdecl; +function ULuaGl_ShadeModel(L: Plua_State): Integer; cdecl; +function ULuaGl_TexCoord(L: Plua_State): Integer; cdecl; +function ULuaGl_Vertex(L: Plua_State): Integer; cdecl; +function ULuaGl_Viewport(L: Plua_State): Integer; cdecl; + +function ULuaGl_Dummy(L: Plua_State): Integer; cdecl; + +implementation + +uses + ULog; + +type + TULuaGl_Enums = record + Text: string; + Value: GLenum; + end; +const + ULuaGl_EnumERROR = $fffffffe; + +function ULuaGl_Begin(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.Begin'''); + + glBegin(e); + + result:=0; // number of results +end; + +function ULuaGl_BindTexture(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.BindTexture'''); + + glBindTexture(e,lual_checkinteger(L,2)); + + result:=0; // number of results +end; + +function ULuaGl_BlendFunc(L: Plua_State): Integer; cdecl; +var + e : GLenum; + f : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + f := ULuaGl_StringToEnum(lual_checkstring(L,2)); + + if (e = ULuaGl_EnumERROR) or (f = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.BlendFunc'''); + + glBlendFunc(e,f); + + result:=0; // number of results +end; + +function ULuaGl_Clear(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.Clear'''); + + glClear(e); + + result:=0; // number of results +end; + +function ULuaGl_ClearColor(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) then + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 4)) or (lua_gettop(L) = 4) then + glClearColor(lual_checknumber(L,-4), + lual_checknumber(L,-3), + lual_checknumber(L,-2), + lual_checknumber(L,-1)) + else + luaL_error(L, 'incorrect argument to function ''gl.ClearColor'''); + result:=0; // number of results +end; + +function ULuaGl_Color(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) then + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 3)) or (lua_gettop(L) = 3) then + glColor3d(GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 4)) or (lua_gettop(L) = 4) then + glColor4d(GLdouble(lual_checknumber(L,-4)), + GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else + luaL_error(L, 'incorrect argument to function ''gl.Color'''); + result:=0; // number of results +end; + +function ULuaGl_CullFace(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.CullFace'''); + + glCullFace(e); + + result:=0; // number of results +end; + +function ULuaGl_DepthFunc(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.DepthFunc'''); + + glDepthFunc(e); + + result:=0; // number of results +end; + +function ULuaGl_Disable(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.Disable'''); + + glDisable(e); + + result:=0; // number of results +end; + +function ULuaGl_DisableClientState(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.DisableClientState'''); + + glDisableClientState(e); + + result:=0; // number of results +end; + +function ULuaGl_DrawBuffer(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.DrawBuffer'''); + + glDrawBuffer(e); + + result:=0; // number of results +end; + +function ULuaGl_Enable(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.Enable'''); + + glEnable(e); + result:=0; // number of results +end; + +function ULuaGl_EnableClientState(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.EnableClientState'''); + + glEnableClientState(e); + + result:=0; // number of results +end; + +function ULuaGl_End(L: Plua_State): Integer; cdecl; +begin + glEnd(); + result:=0; // number of results +end; + +function ULuaGl_EndList(L: Plua_State): Integer; cdecl; +begin + glEndList(); + result:=0; // number of results +end; + +function ULuaGl_Finish(L: Plua_State): Integer; cdecl; +begin + glFinish(); + result:=0; // number of results +end; + +function ULuaGl_Flush(L: Plua_State): Integer; cdecl; +begin + glFlush(); + result:=0; // number of results +end; + +function ULuaGl_FrontFace(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.FrontFace'''); + + glFrontFace(e); + + result:=0; // number of results +end; + +function ULuaGl_InitNames(L: Plua_State): Integer; cdecl; +begin + glInitNames(); + result:=0; // number of results +end; + +function ULuaGl_LoadIdentity(L: Plua_State): Integer; cdecl; +begin + glLoadIdentity(); + result:=0; // number of results +end; + +function ULuaGl_LogicOp(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.LogicOp'''); + + glLogicOp(e); + + result:=0; // number of results +end; + +function ULuaGl_PopAttrib(L: Plua_State): Integer; cdecl; +begin + glPopAttrib(); + result:=0; // number of results +end; + +function ULuaGl_PopClientAttrib(L: Plua_State): Integer; cdecl; +begin + glPopClientAttrib(); + result:=0; // number of results +end; + +function ULuaGl_PopMatrix(L: Plua_State): Integer; cdecl; +begin + glPopMatrix(); + result:=0; // number of results +end; + +function ULuaGl_PopName(L: Plua_State): Integer; cdecl; +begin + glPopName(); + result:=0; // number of results +end; + +function ULuaGl_PushMatrix(L: Plua_State): Integer; cdecl; +begin + glPopName(); + result:=0; // number of results +end; + +function ULuaGl_MatrixMode(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.MatrixMode'''); + + glMatrixMode(e); + + result:=0; // number of results +end; + +function ULuaGl_RasterPos(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) then + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 2)) or (lua_gettop(L) = 2) then + glRasterPos2d(GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 3)) or (lua_gettop(L) = 3) then + glRasterPos3d(GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 4)) or (lua_gettop(L) = 4) then + glRasterPos4d(GLdouble(lual_checknumber(L,-4)), + GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else + luaL_error(L, 'incorrect argument to function ''gl.RasterPos'''); + result:=0; // number of results +end; + +function ULuaGl_ReadBuffer(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.ReadBuffer'''); + + glReadBuffer(e); + + result:=0; // number of results +end; + +function ULuaGl_Rect(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) and lua_istable(L, 2) then + begin + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + for i := 1 to lua_objlen(L,2) do + lua_rawgeti(L,2,i); + end; + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 2)) + and (lua_istable(L, 2) and (lua_objlen(L,2) = 2)) + or (lua_gettop(L) = 4) then + glRectD(lual_checknumber(L,-4), + lual_checknumber(L,-3), + lual_checknumber(L,-2), + lual_checknumber(L,-1)) + else + luaL_error(L, 'incorrect argument to function ''gl.Rect'''); + result:=0; // number of results +end; + +function ULuaGl_ShadeModel(L: Plua_State): Integer; cdecl; +var + e : GLenum; +begin + e := ULuaGl_StringToEnum(lual_checkstring(L,1)); + + if (e = ULuaGl_EnumERROR) then + luaL_error(L, 'incorrect string argument to function ''gl.ShadeModel'''); + + glShadeModel(e); + + result:=0; // number of results +end; + +function ULuaGl_TexCoord(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) then + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 1)) or (lua_gettop(L) = 1) then + glTexCoord1d(GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 2)) or (lua_gettop(L) = 2) then + glTexCoord2d(GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 3)) or (lua_gettop(L) = 3) then + glTexCoord3d(GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 4)) or (lua_gettop(L) = 4) then + glTexCoord4d(GLdouble(lual_checknumber(L,-4)), + GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else + luaL_error(L, 'incorrect argument to function ''gl.TexCoord'''); + result:=0; // number of results +end; + +function ULuaGl_Vertex(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) then + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 2)) or (lua_gettop(L) = 2) then + glVertex2d(GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 3)) or (lua_gettop(L) = 3) then + glVertex3d(GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else if (lua_istable(L, 1) and (lua_objlen(L,1) = 4)) or (lua_gettop(L) = 4) then + glVertex4d(GLdouble(lual_checknumber(L,-4)), + GLdouble(lual_checknumber(L,-3)), + GLdouble(lual_checknumber(L,-2)), + GLdouble(lual_checknumber(L,-1))) + else + luaL_error(L, 'incorrect argument to function ''gl.Vertex'''); + result:=0; // number of results +end; + +function ULuaGl_Viewport(L: Plua_State): Integer; cdecl; +var + i: Integer; +begin + if lua_istable(L, 1) and lua_istable(L, 2) then + begin + for i := 1 to lua_objlen(L,1) do + lua_rawgeti(L,1,i); + for i := 1 to lua_objlen(L,2) do + lua_rawgeti(L,2,i); + end; + + if (lua_istable(L, 1) and (lua_objlen(L,1) = 2)) + and (lua_istable(L, 2) and (lua_objlen(L,2) = 2)) + or (lua_gettop(L) = 4) then + glViewport(lual_checkinteger(L,-4), + lual_checkinteger(L,-3), + lual_checkinteger(L,-2), + lual_checkinteger(L,-1)) + else + luaL_error(L, 'incorrect argument to function ''gl.Viewport'''); + result:=0; // number of results +end; + +function ULuaGl_Dummy(L: Plua_State): Integer; cdecl; +begin + result:=0; // number of results +end; + +const + ULuaGl_Lib_f: array [0..34] of lual_reg = ( + (name:'Begin';func:ULuaGl_Begin), + (name:'BindTexture';func:ULuaGl_BindTexture), + (name:'BlendFunc';func:ULuaGl_BlendFunc), + (name:'Clear';func:ULuaGl_Clear), + (name:'ClearColor';func:ULuaGl_ClearColor), + (name:'Color';func:ULuaGl_Color), + (name:'CullFace';func:ULuaGl_CullFace), + (name:'DepthFunc';func:ULuaGl_DepthFunc), + (name:'Disable';func:ULuaGl_Disable), + (name:'DisableClientState';func:ULuaGl_DisableClientState), + (name:'DrawBuffer';func:ULuaGl_DrawBuffer), + (name:'Enable';func:ULuaGl_Enable), + (name:'EnableClientState';func:ULuaGl_EnableClientState), + (name:'End';func:ULuaGl_End), + (name:'EndList';func:ULuaGl_EndList), + (name:'Finish';func:ULuaGl_Finish), + (name:'Flush';func:ULuaGl_Flush), + (name:'FrontFace';func:ULuaGl_FrontFace), + (name:'InitNames';func:ULuaGl_InitNames), + (name:'LoadIdentity';func:ULuaGl_LoadIdentity), + (name:'LogicOp';func:ULuaGl_LogicOp), + (name:'MatrixMode';func:ULuaGl_MatrixMode), + (name:'PopAttrib';func:ULuaGl_PopAttrib), + (name:'PopClientAttrib';func:ULuaGl_PopClientAttrib), + (name:'PopMatrix';func:ULuaGl_PopMatrix), + (name:'PopName';func:ULuaGl_PopName), + (name:'PushMatrix';func:ULuaGl_PushMatrix), + (name:'RasterPos';func:ULuaGl_RasterPos), + (name:'ReadBuffer';func:ULuaGl_ReadBuffer), + (name:'Rect';func:ULuaGl_Rect), + (name:'ShadeModel';func:ULuaGl_ShadeModel), + (name:'TexCoord';func:ULuaGl_TexCoord), + (name:'Vertex';func:ULuaGl_Vertex), + (name:'Viewport';func:ULuaGl_Viewport), + (name:nil;func:nil) + ); + +function luaopen_gl (L: Plua_State): Integer; cdecl; +begin + luaL_register(L,'gl',@ULuaGl_Lib_f[0]); + result:=1; +end; + +(* + glAccum: procedure(op: GLenum; value: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAlphaFunc: procedure(func: GLenum; ref: GLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glAreTexturesResident: function (n: GLsizei; const textures: PGLuint; residences: PGLboolean): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glArrayElement: procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glBitmap: procedure (width, height: GLsizei; xorig, yorig: GLfloat; xmove, ymove: GLfloat; const bitmap: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallList: procedure(list: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCallLists: procedure(n: GLsizei; atype: GLenum; const lists: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearAccum: procedure(red, green, blue, alpha: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearDepth: procedure(depth: GLclampd); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearIndex: procedure(c: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClearStencil: procedure(s: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glClipPlane: procedure(plane: GLenum; const equation: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glColorMask: procedure(red, green, blue, alpha: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorMaterial: procedure(face, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glColorPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyPixels: procedure(x, y: GLint; width, height: GLsizei; atype: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage1D: procedure (target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width: GLsizei; border: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexImage2D: procedure(target: GLenum; level: GLint; internalFormat: GLenum; x, y: GLint; width, height: GLsizei; border: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y: GLint; width: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteLists: procedure(list: GLuint; range: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDeleteTextures: procedure(n: GLsizei; const textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthMask: procedure(flag: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDepthRange: procedure(zNear, zFar: GLclampd); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawArrays: procedure(mode: GLenum; first: GLint; count: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawElements: procedure(mode: GLenum; count: GLsizei; atype: GLenum; const indices: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glDrawPixels: procedure(width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlag: procedure(flag: GLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagPointer: procedure(stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEdgeFlagv: procedure(const flag: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glEvalCoord1d: procedure(u: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1dv: procedure(const u: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1f: procedure(u: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord1fv: procedure(const u: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2d: procedure(u, v: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2dv: procedure(const u: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2f: procedure(u, v: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalCoord2fv: procedure(const u: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glEvalMesh1: procedure(mode: GLenum; i1, i2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint1: procedure(i: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glEvalPoint2: procedure(i, j: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFeedbackBuffer: procedure(size: GLsizei; atype: GLenum; buffer: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogi: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFogiv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glFrustum: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenLists: function(range: GLsizei): GLuint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGenTextures: procedure(n: GLsizei; textures: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetBooleanv: procedure(pname: GLenum; params: PGLboolean); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetClipPlane: procedure(plane: GLenum; equation: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetDoublev: procedure(pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} +// glGetError: function: GLenum; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetFloatv: procedure(pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetIntegerv: procedure(pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightfv: procedure(light, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetLightiv: procedure(light, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapdv: procedure(target, query: GLenum; v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapfv: procedure(target, query: GLenum; v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMapiv: procedure(target, query: GLenum; v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialfv: procedure(face, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetMaterialiv: procedure(face, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapfv: procedure(map: GLenum; values: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapuiv: procedure(map: GLenum; values: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPixelMapusv: procedure(map: GLenum; values: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPointerv: procedure(pname: GLenum; params: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetPolygonStipple: procedure(mask: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} +/ glGetString: function(name: GLenum): PChar; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnvfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexEnviv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGendv: procedure(coord, pname: GLenum; params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGenfv: procedure(coord, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexGeniv: procedure(coord, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexImage: procedure(target: GLenum; level: GLint; format: GLenum; atype: GLenum; pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameterfv: procedure(target: GLenum; level: GLint; pname: GLenum; params: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexLevelParameteriv: procedure(target: GLenum; level: GLint; pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameterfv: procedure(target, pname: GLenum; params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glGetTexParameteriv: procedure(target, pname: GLenum; params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glHint: procedure(target, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexMask: procedure(mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glIndexPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexd: procedure(c: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexdv: procedure(const c: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexf: procedure(c: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexfv: procedure(const c: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexi: procedure(c: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexiv: procedure(const c: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexs: procedure(c: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexsv: procedure(const c: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexub: procedure(c: GLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIndexubv: procedure(const c: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glInterleavedArrays: procedure(format: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} +/ glIsEnabled: function(cap: GLenum): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsList: function(list: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glIsTexture: function(texture: GLuint): GLboolean; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModelfv: procedure(pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeli: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightModeliv: procedure(pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightf: procedure(light, pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightfv: procedure(light, pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLighti: procedure(light, pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLightiv: procedure(light, pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineStipple: procedure(factor: GLint; pattern: GLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLineWidth: procedure(width: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glListBase: procedure(base: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glLoadName: procedure(name: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1d: procedure(target: GLenum; u1, u2: GLdouble; stride, order: GLint; const points: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap1f: procedure(target: GLenum; u1, u2: GLfloat; stride, order: GLint; const points: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2d: procedure(target: GLenum; u1, u2: GLdouble; ustride, uorder: GLint; v1, v2: GLdouble; vstride, vorder: GLint; const points: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMap2f: procedure(target: GLenum; u1, u2: GLfloat; ustride, uorder: GLint; v1, v2: GLfloat; vstride, vorder: GLint; const points: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1d: procedure(un: GLint; u1, u2: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid1f: procedure(un: GLint; u1, u2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2d: procedure(un: GLint; u1, u2: GLdouble; vn: GLint; v1, v2: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMapGrid2f: procedure(un: GLint; u1, u2: GLfloat; vn: GLint; v1, v2: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialf: procedure(face, pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialfv: procedure(face, pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMateriali: procedure(face, pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMaterialiv: procedure(face, pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixd: procedure(const m: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glMultMatrixf: procedure(const m: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNewList: procedure(list: GLuint; mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3b: procedure(nx, ny, nz: GLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3bv: procedure(const v: PGLbyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3d: procedure(nx, ny, nz: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3dv: procedure(const v: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3f: procedure(nx, ny, nz: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3fv: procedure(const v: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3i: procedure(nx, ny, nz: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3iv: procedure(const v: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3s: procedure(nx, ny, nz: GLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormal3sv: procedure(const v: PGLshort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glNormalPointer: procedure(atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glOrtho: procedure(left, right, bottom, top, zNear, zFar: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPassThrough: procedure(token: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapfv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapuiv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelMapusv: procedure(map: GLenum; mapsize: GLsizei; const values: PGLushort); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStoref: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelStorei: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferf: procedure(pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelTransferi: procedure(pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPixelZoom: procedure(xfactor, yfactor: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPointSize: procedure(size: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonMode: procedure(face, mode: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonOffset: procedure(factor, units: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPolygonStipple: procedure(const mask: PGLubyte); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPrioritizeTextures: procedure(n: GLsizei; const textures: PGLuint; const priorities: PGLclampf); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushAttrib: procedure(mask: GLbitfield); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushClientAttrib: procedure(mask: GLbitfield); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glPushName: procedure(name: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glReadPixels: procedure(x, y: GLint; width, height: GLsizei; format, atype: GLenum; pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glRenderMode: function(mode: GLint): GLint; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotated: procedure(angle, x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glRotatef: procedure(angle, x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScaled: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScalef: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glScissor: procedure(x, y: GLint; width, height: GLsizei); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glSelectBuffer: procedure(size: GLsizei; buffer: PGLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilFunc: procedure(func: GLenum; ref: GLint; mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilMask: procedure(mask: GLuint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glStencilOp: procedure(fail, zfail, zpass: GLenum); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + + glTexCoordPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnvi: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexEnviv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGend: procedure(coord: GLenum; pname: GLenum; param: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGendv: procedure(coord: GLenum; pname: GLenum; const params: PGLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenf: procedure(coord: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGenfv: procedure(coord: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeni: procedure(coord: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexGeniv: procedure(coord: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage1D: procedure(target: GLenum; level, internalformat: GLint; width: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexImage2D: procedure(target: GLenum; level, internalformat: GLint; width, height: GLsizei; border: GLint; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterf: procedure(target: GLenum; pname: GLenum; param: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameterfv: procedure(target: GLenum; pname: GLenum; const params: PGLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteri: procedure(target: GLenum; pname: GLenum; param: GLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexParameteriv: procedure(target: GLenum; pname: GLenum; const params: PGLint); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage1D: procedure(target: GLenum; level, xoffset: GLint; width: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset: GLint; width, height: GLsizei; format, atype: GLenum; const pixels: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslated: procedure(x, y, z: GLdouble); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glTranslatef: procedure(x, y, z: GLfloat); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + glVertexPointer: procedure(size: GLint; atype: GLenum; stride: GLsizei; const pointer: Pointer); {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + {$IFDEF WINDOWS} + ChoosePixelFormat: function(DC: HDC; p2: PPixelFormatDescriptor): Integer; {$IFDEF WINDOWS}stdcall;{$ELSE}cdecl;{$ENDIF} + {$ENDIF} + *) + + const + ULuaGl_Enum: array [0..579] of TULuaGl_Enums = ( + (Text:'GL_VERSION_1_1';Value:GL_VERSION_1_1), + (Text:'GL_ACCUM';Value:GL_ACCUM), + (Text:'GL_LOAD';Value:GL_LOAD), + (Text:'GL_RETURN';Value:GL_RETURN), + (Text:'GL_MULT';Value:GL_MULT), + (Text:'GL_ADD';Value:GL_ADD), + (Text:'GL_NEVER';Value:GL_NEVER), + (Text:'GL_LESS';Value:GL_LESS), + (Text:'GL_EQUAL';Value:GL_EQUAL), + (Text:'GL_LEQUAL';Value:GL_LEQUAL), + (Text:'GL_GREATER';Value:GL_GREATER), + (Text:'GL_NOTEQUAL';Value:GL_NOTEQUAL), + (Text:'GL_GEQUAL';Value:GL_GEQUAL), + (Text:'GL_ALWAYS';Value:GL_ALWAYS), + (Text:'GL_CURRENT_BIT';Value:GL_CURRENT_BIT), + (Text:'GL_POINT_BIT';Value:GL_POINT_BIT), + (Text:'GL_LINE_BIT';Value:GL_LINE_BIT), + (Text:'GL_POLYGON_BIT';Value:GL_POLYGON_BIT), + (Text:'GL_POLYGON_STIPPLE_BIT';Value:GL_POLYGON_STIPPLE_BIT), + (Text:'GL_PIXEL_MODE_BIT';Value:GL_PIXEL_MODE_BIT), + (Text:'GL_LIGHTING_BIT';Value:GL_LIGHTING_BIT), + (Text:'GL_FOG_BIT';Value:GL_FOG_BIT), + (Text:'GL_DEPTH_BUFFER_BIT';Value:GL_DEPTH_BUFFER_BIT), + (Text:'GL_ACCUM_BUFFER_BIT';Value:GL_ACCUM_BUFFER_BIT), + (Text:'GL_STENCIL_BUFFER_BIT';Value:GL_STENCIL_BUFFER_BIT), + (Text:'GL_VIEWPORT_BIT';Value:GL_VIEWPORT_BIT), + (Text:'GL_TRANSFORM_BIT';Value:GL_TRANSFORM_BIT), + (Text:'GL_ENABLE_BIT';Value:GL_ENABLE_BIT), + (Text:'GL_COLOR_BUFFER_BIT';Value:GL_COLOR_BUFFER_BIT), + (Text:'GL_HINT_BIT';Value:GL_HINT_BIT), + (Text:'GL_EVAL_BIT';Value:GL_EVAL_BIT), + (Text:'GL_LIST_BIT';Value:GL_LIST_BIT), + (Text:'GL_TEXTURE_BIT';Value:GL_TEXTURE_BIT), + (Text:'GL_SCISSOR_BIT';Value:GL_SCISSOR_BIT), + (Text:'GL_ALL_ATTRIB_BITS';Value:GL_ALL_ATTRIB_BITS), + (Text:'GL_POINTS';Value:GL_POINTS), + (Text:'GL_LINES';Value:GL_LINES), + (Text:'GL_LINE_LOOP';Value:GL_LINE_LOOP), + (Text:'GL_LINE_STRIP';Value:GL_LINE_STRIP), + (Text:'GL_TRIANGLES';Value:GL_TRIANGLES), + (Text:'GL_TRIANGLE_STRIP';Value:GL_TRIANGLE_STRIP), + (Text:'GL_TRIANGLE_FAN';Value:GL_TRIANGLE_FAN), + (Text:'GL_QUADS';Value:GL_QUADS), + (Text:'GL_QUAD_STRIP';Value:GL_QUAD_STRIP), + (Text:'GL_POLYGON';Value:GL_POLYGON), + (Text:'GL_ZERO';Value:GL_ZERO), + (Text:'GL_ONE';Value:GL_ONE), + (Text:'GL_SRC_COLOR';Value:GL_SRC_COLOR), + (Text:'GL_ONE_MINUS_SRC_COLOR';Value:GL_ONE_MINUS_SRC_COLOR), + (Text:'GL_SRC_ALPHA';Value:GL_SRC_ALPHA), + (Text:'GL_ONE_MINUS_SRC_ALPHA';Value:GL_ONE_MINUS_SRC_ALPHA), + (Text:'GL_DST_ALPHA';Value:GL_DST_ALPHA), + (Text:'GL_ONE_MINUS_DST_ALPHA';Value:GL_ONE_MINUS_DST_ALPHA), + (Text:'GL_DST_COLOR';Value:GL_DST_COLOR), + (Text:'GL_ONE_MINUS_DST_COLOR';Value:GL_ONE_MINUS_DST_COLOR), + (Text:'GL_SRC_ALPHA_SATURATE';Value:GL_SRC_ALPHA_SATURATE), + (Text:'GL_TRUE';Value:GL_TRUE), + (Text:'GL_FALSE';Value:GL_FALSE), + (Text:'GL_CLIP_PLANE0';Value:GL_CLIP_PLANE0), + (Text:'GL_CLIP_PLANE1';Value:GL_CLIP_PLANE1), + (Text:'GL_CLIP_PLANE2';Value:GL_CLIP_PLANE2), + (Text:'GL_CLIP_PLANE3';Value:GL_CLIP_PLANE3), + (Text:'GL_CLIP_PLANE4';Value:GL_CLIP_PLANE4), + (Text:'GL_CLIP_PLANE5';Value:GL_CLIP_PLANE5), + (Text:'GL_BYTE';Value:GL_BYTE), + (Text:'GL_UNSIGNED_BYTE';Value:GL_UNSIGNED_BYTE), + (Text:'GL_SHORT';Value:GL_SHORT), + (Text:'GL_UNSIGNED_SHORT';Value:GL_UNSIGNED_SHORT), + (Text:'GL_INT';Value:GL_INT), + (Text:'GL_UNSIGNED_INT';Value:GL_UNSIGNED_INT), + (Text:'GL_FLOAT';Value:GL_FLOAT), + (Text:'GL_2_BYTES';Value:GL_2_BYTES), + (Text:'GL_3_BYTES';Value:GL_3_BYTES), + (Text:'GL_4_BYTES';Value:GL_4_BYTES), + (Text:'GL_DOUBLE';Value:GL_DOUBLE), + (Text:'GL_NONE';Value:GL_NONE), + (Text:'GL_FRONT_LEFT';Value:GL_FRONT_LEFT), + (Text:'GL_FRONT_RIGHT';Value:GL_FRONT_RIGHT), + (Text:'GL_BACK_LEFT';Value:GL_BACK_LEFT), + (Text:'GL_BACK_RIGHT';Value:GL_BACK_RIGHT), + (Text:'GL_FRONT';Value:GL_FRONT), + (Text:'GL_BACK';Value:GL_BACK), + (Text:'GL_LEFT';Value:GL_LEFT), + (Text:'GL_RIGHT';Value:GL_RIGHT), + (Text:'GL_FRONT_AND_BACK';Value:GL_FRONT_AND_BACK), + (Text:'GL_AUX0';Value:GL_AUX0), + (Text:'GL_AUX1';Value:GL_AUX1), + (Text:'GL_AUX2';Value:GL_AUX2), + (Text:'GL_AUX3';Value:GL_AUX3), + (Text:'GL_NO_ERROR';Value:GL_NO_ERROR), + (Text:'GL_INVALID_ENUM';Value:GL_INVALID_ENUM), + (Text:'GL_INVALID_VALUE';Value:GL_INVALID_VALUE), + (Text:'GL_INVALID_OPERATION';Value:GL_INVALID_OPERATION), + (Text:'GL_STACK_OVERFLOW';Value:GL_STACK_OVERFLOW), + (Text:'GL_STACK_UNDERFLOW';Value:GL_STACK_UNDERFLOW), + (Text:'GL_OUT_OF_MEMORY';Value:GL_OUT_OF_MEMORY), + (Text:'GL_2D';Value:GL_2D), + (Text:'GL_3D';Value:GL_3D), + (Text:'GL_3D_COLOR';Value:GL_3D_COLOR), + (Text:'GL_3D_COLOR_TEXTURE';Value:GL_3D_COLOR_TEXTURE), + (Text:'GL_4D_COLOR_TEXTURE';Value:GL_4D_COLOR_TEXTURE), + (Text:'GL_PASS_THROUGH_TOKEN';Value:GL_PASS_THROUGH_TOKEN), + (Text:'GL_POINT_TOKEN';Value:GL_POINT_TOKEN), + (Text:'GL_LINE_TOKEN';Value:GL_LINE_TOKEN), + (Text:'GL_POLYGON_TOKEN';Value:GL_POLYGON_TOKEN), + (Text:'GL_BITMAP_TOKEN';Value:GL_BITMAP_TOKEN), + (Text:'GL_DRAW_PIXEL_TOKEN';Value:GL_DRAW_PIXEL_TOKEN), + (Text:'GL_COPY_PIXEL_TOKEN';Value:GL_COPY_PIXEL_TOKEN), + (Text:'GL_LINE_RESET_TOKEN';Value:GL_LINE_RESET_TOKEN), + (Text:'GL_EXP';Value:GL_EXP), + (Text:'GL_EXP2';Value:GL_EXP2), + (Text:'GL_CW';Value:GL_CW), + (Text:'GL_CCW';Value:GL_CCW), + (Text:'GL_COEFF';Value:GL_COEFF), + (Text:'GL_ORDER';Value:GL_ORDER), + (Text:'GL_DOMAIN';Value:GL_DOMAIN), + (Text:'GL_CURRENT_COLOR';Value:GL_CURRENT_COLOR), + (Text:'GL_CURRENT_INDEX';Value:GL_CURRENT_INDEX), + (Text:'GL_CURRENT_NORMAL';Value:GL_CURRENT_NORMAL), + (Text:'GL_CURRENT_TEXTURE_COORDS';Value:GL_CURRENT_TEXTURE_COORDS), + (Text:'GL_CURRENT_RASTER_COLOR';Value:GL_CURRENT_RASTER_COLOR), + (Text:'GL_CURRENT_RASTER_INDEX';Value:GL_CURRENT_RASTER_INDEX), + (Text:'GL_CURRENT_RASTER_TEXTURE_COORDS';Value:GL_CURRENT_RASTER_TEXTURE_COORDS), + (Text:'GL_CURRENT_RASTER_POSITION';Value:GL_CURRENT_RASTER_POSITION), + (Text:'GL_CURRENT_RASTER_POSITION_VALID';Value:GL_CURRENT_RASTER_POSITION_VALID), + (Text:'GL_CURRENT_RASTER_DISTANCE';Value:GL_CURRENT_RASTER_DISTANCE), + (Text:'GL_POINT_SMOOTH';Value:GL_POINT_SMOOTH), + (Text:'GL_POINT_SIZE';Value:GL_POINT_SIZE), + (Text:'GL_POINT_SIZE_RANGE';Value:GL_POINT_SIZE_RANGE), + (Text:'GL_POINT_SIZE_GRANULARITY';Value:GL_POINT_SIZE_GRANULARITY), + (Text:'GL_LINE_SMOOTH';Value:GL_LINE_SMOOTH), + (Text:'GL_LINE_WIDTH';Value:GL_LINE_WIDTH), + (Text:'GL_LINE_WIDTH_RANGE';Value:GL_LINE_WIDTH_RANGE), + (Text:'GL_LINE_WIDTH_GRANULARITY';Value:GL_LINE_WIDTH_GRANULARITY), + (Text:'GL_LINE_STIPPLE';Value:GL_LINE_STIPPLE), + (Text:'GL_LINE_STIPPLE_PATTERN';Value:GL_LINE_STIPPLE_PATTERN), + (Text:'GL_LINE_STIPPLE_REPEAT';Value:GL_LINE_STIPPLE_REPEAT), + (Text:'GL_LIST_MODE';Value:GL_LIST_MODE), + (Text:'GL_MAX_LIST_NESTING';Value:GL_MAX_LIST_NESTING), + (Text:'GL_LIST_BASE';Value:GL_LIST_BASE), + (Text:'GL_LIST_INDEX';Value:GL_LIST_INDEX), + (Text:'GL_POLYGON_MODE';Value:GL_POLYGON_MODE), + (Text:'GL_POLYGON_SMOOTH';Value:GL_POLYGON_SMOOTH), + (Text:'GL_POLYGON_STIPPLE';Value:GL_POLYGON_STIPPLE), + (Text:'GL_EDGE_FLAG';Value:GL_EDGE_FLAG), + (Text:'GL_CULL_FACE';Value:GL_CULL_FACE), + (Text:'GL_CULL_FACE_MODE';Value:GL_CULL_FACE_MODE), + (Text:'GL_FRONT_FACE';Value:GL_FRONT_FACE), + (Text:'GL_LIGHTING';Value:GL_LIGHTING), + (Text:'GL_LIGHT_MODEL_LOCAL_VIEWER';Value:GL_LIGHT_MODEL_LOCAL_VIEWER), + (Text:'GL_LIGHT_MODEL_TWO_SIDE';Value:GL_LIGHT_MODEL_TWO_SIDE), + (Text:'GL_LIGHT_MODEL_AMBIENT';Value:GL_LIGHT_MODEL_AMBIENT), + (Text:'GL_SHADE_MODEL';Value:GL_SHADE_MODEL), + (Text:'GL_COLOR_MATERIAL_FACE';Value:GL_COLOR_MATERIAL_FACE), + (Text:'GL_COLOR_MATERIAL_PARAMETER';Value:GL_COLOR_MATERIAL_PARAMETER), + (Text:'GL_COLOR_MATERIAL';Value:GL_COLOR_MATERIAL), + (Text:'GL_FOG';Value:GL_FOG), + (Text:'GL_FOG_INDEX';Value:GL_FOG_INDEX), + (Text:'GL_FOG_DENSITY';Value:GL_FOG_DENSITY), + (Text:'GL_FOG_START';Value:GL_FOG_START), + (Text:'GL_FOG_END';Value:GL_FOG_END), + (Text:'GL_FOG_MODE';Value:GL_FOG_MODE), + (Text:'GL_FOG_COLOR';Value:GL_FOG_COLOR), + (Text:'GL_DEPTH_RANGE';Value:GL_DEPTH_RANGE), + (Text:'GL_DEPTH_TEST';Value:GL_DEPTH_TEST), + (Text:'GL_DEPTH_WRITEMASK';Value:GL_DEPTH_WRITEMASK), + (Text:'GL_DEPTH_CLEAR_VALUE';Value:GL_DEPTH_CLEAR_VALUE), + (Text:'GL_DEPTH_FUNC';Value:GL_DEPTH_FUNC), + (Text:'GL_ACCUM_CLEAR_VALUE';Value:GL_ACCUM_CLEAR_VALUE), + (Text:'GL_STENCIL_TEST';Value:GL_STENCIL_TEST), + (Text:'GL_STENCIL_CLEAR_VALUE';Value:GL_STENCIL_CLEAR_VALUE), + (Text:'GL_STENCIL_FUNC';Value:GL_STENCIL_FUNC), + (Text:'GL_STENCIL_VALUE_MASK';Value:GL_STENCIL_VALUE_MASK), + (Text:'GL_STENCIL_FAIL';Value:GL_STENCIL_FAIL), + (Text:'GL_STENCIL_PASS_DEPTH_FAIL';Value:GL_STENCIL_PASS_DEPTH_FAIL), + (Text:'GL_STENCIL_PASS_DEPTH_PASS';Value:GL_STENCIL_PASS_DEPTH_PASS), + (Text:'GL_STENCIL_REF';Value:GL_STENCIL_REF), + (Text:'GL_STENCIL_WRITEMASK';Value:GL_STENCIL_WRITEMASK), + (Text:'GL_MATRIX_MODE';Value:GL_MATRIX_MODE), + (Text:'GL_NORMALIZE';Value:GL_NORMALIZE), + (Text:'GL_VIEWPORT';Value:GL_VIEWPORT), + (Text:'GL_MODELVIEW_STACK_DEPTH';Value:GL_MODELVIEW_STACK_DEPTH), + (Text:'GL_PROJECTION_STACK_DEPTH';Value:GL_PROJECTION_STACK_DEPTH), + (Text:'GL_TEXTURE_STACK_DEPTH';Value:GL_TEXTURE_STACK_DEPTH), + (Text:'GL_MODELVIEW_MATRIX';Value:GL_MODELVIEW_MATRIX), + (Text:'GL_PROJECTION_MATRIX';Value:GL_PROJECTION_MATRIX), + (Text:'GL_TEXTURE_MATRIX';Value:GL_TEXTURE_MATRIX), + (Text:'GL_ATTRIB_STACK_DEPTH';Value:GL_ATTRIB_STACK_DEPTH), + (Text:'GL_CLIENT_ATTRIB_STACK_DEPTH';Value:GL_CLIENT_ATTRIB_STACK_DEPTH), + (Text:'GL_ALPHA_TEST';Value:GL_ALPHA_TEST), + (Text:'GL_ALPHA_TEST_FUNC';Value:GL_ALPHA_TEST_FUNC), + (Text:'GL_ALPHA_TEST_REF';Value:GL_ALPHA_TEST_REF), + (Text:'GL_DITHER';Value:GL_DITHER), + (Text:'GL_BLEND_DST';Value:GL_BLEND_DST), + (Text:'GL_BLEND_SRC';Value:GL_BLEND_SRC), + (Text:'GL_BLEND';Value:GL_BLEND), + (Text:'GL_LOGIC_OP_MODE';Value:GL_LOGIC_OP_MODE), + (Text:'GL_INDEX_LOGIC_OP';Value:GL_INDEX_LOGIC_OP), + (Text:'GL_COLOR_LOGIC_OP';Value:GL_COLOR_LOGIC_OP), + (Text:'GL_AUX_BUFFERS';Value:GL_AUX_BUFFERS), + (Text:'GL_DRAW_BUFFER';Value:GL_DRAW_BUFFER), + (Text:'GL_READ_BUFFER';Value:GL_READ_BUFFER), + (Text:'GL_SCISSOR_BOX';Value:GL_SCISSOR_BOX), + (Text:'GL_SCISSOR_TEST';Value:GL_SCISSOR_TEST), + (Text:'GL_INDEX_CLEAR_VALUE';Value:GL_INDEX_CLEAR_VALUE), + (Text:'GL_INDEX_WRITEMASK';Value:GL_INDEX_WRITEMASK), + (Text:'GL_COLOR_CLEAR_VALUE';Value:GL_COLOR_CLEAR_VALUE), + (Text:'GL_COLOR_WRITEMASK';Value:GL_COLOR_WRITEMASK), + (Text:'GL_INDEX_MODE';Value:GL_INDEX_MODE), + (Text:'GL_RGBA_MODE';Value:GL_RGBA_MODE), + (Text:'GL_DOUBLEBUFFER';Value:GL_DOUBLEBUFFER), + (Text:'GL_STEREO';Value:GL_STEREO), + (Text:'GL_RENDER_MODE';Value:GL_RENDER_MODE), + (Text:'GL_PERSPECTIVE_CORRECTION_HINT';Value:GL_PERSPECTIVE_CORRECTION_HINT), + (Text:'GL_POINT_SMOOTH_HINT';Value:GL_POINT_SMOOTH_HINT), + (Text:'GL_LINE_SMOOTH_HINT';Value:GL_LINE_SMOOTH_HINT), + (Text:'GL_POLYGON_SMOOTH_HINT';Value:GL_POLYGON_SMOOTH_HINT), + (Text:'GL_FOG_HINT';Value:GL_FOG_HINT), + (Text:'GL_TEXTURE_GEN_S';Value:GL_TEXTURE_GEN_S), + (Text:'GL_TEXTURE_GEN_T';Value:GL_TEXTURE_GEN_T), + (Text:'GL_TEXTURE_GEN_R';Value:GL_TEXTURE_GEN_R), + (Text:'GL_TEXTURE_GEN_Q';Value:GL_TEXTURE_GEN_Q), + (Text:'GL_PIXEL_MAP_I_TO_I';Value:GL_PIXEL_MAP_I_TO_I), + (Text:'GL_PIXEL_MAP_S_TO_S';Value:GL_PIXEL_MAP_S_TO_S), + (Text:'GL_PIXEL_MAP_I_TO_R';Value:GL_PIXEL_MAP_I_TO_R), + (Text:'GL_PIXEL_MAP_I_TO_G';Value:GL_PIXEL_MAP_I_TO_G), + (Text:'GL_PIXEL_MAP_I_TO_B';Value:GL_PIXEL_MAP_I_TO_B), + (Text:'GL_PIXEL_MAP_I_TO_A';Value:GL_PIXEL_MAP_I_TO_A), + (Text:'GL_PIXEL_MAP_R_TO_R';Value:GL_PIXEL_MAP_R_TO_R), + (Text:'GL_PIXEL_MAP_G_TO_G';Value:GL_PIXEL_MAP_G_TO_G), + (Text:'GL_PIXEL_MAP_B_TO_B';Value:GL_PIXEL_MAP_B_TO_B), + (Text:'GL_PIXEL_MAP_A_TO_A';Value:GL_PIXEL_MAP_A_TO_A), + (Text:'GL_PIXEL_MAP_I_TO_I_SIZE';Value:GL_PIXEL_MAP_I_TO_I_SIZE), + (Text:'GL_PIXEL_MAP_S_TO_S_SIZE';Value:GL_PIXEL_MAP_S_TO_S_SIZE), + (Text:'GL_PIXEL_MAP_I_TO_R_SIZE';Value:GL_PIXEL_MAP_I_TO_R_SIZE), + (Text:'GL_PIXEL_MAP_I_TO_G_SIZE';Value:GL_PIXEL_MAP_I_TO_G_SIZE), + (Text:'GL_PIXEL_MAP_I_TO_B_SIZE';Value:GL_PIXEL_MAP_I_TO_B_SIZE), + (Text:'GL_PIXEL_MAP_I_TO_A_SIZE';Value:GL_PIXEL_MAP_I_TO_A_SIZE), + (Text:'GL_PIXEL_MAP_R_TO_R_SIZE';Value:GL_PIXEL_MAP_R_TO_R_SIZE), + (Text:'GL_PIXEL_MAP_G_TO_G_SIZE';Value:GL_PIXEL_MAP_G_TO_G_SIZE), + (Text:'GL_PIXEL_MAP_B_TO_B_SIZE';Value:GL_PIXEL_MAP_B_TO_B_SIZE), + (Text:'GL_PIXEL_MAP_A_TO_A_SIZE';Value:GL_PIXEL_MAP_A_TO_A_SIZE), + (Text:'GL_UNPACK_SWAP_BYTES';Value:GL_UNPACK_SWAP_BYTES), + (Text:'GL_UNPACK_LSB_FIRST';Value:GL_UNPACK_LSB_FIRST), + (Text:'GL_UNPACK_ROW_LENGTH';Value:GL_UNPACK_ROW_LENGTH), + (Text:'GL_UNPACK_SKIP_ROWS';Value:GL_UNPACK_SKIP_ROWS), + (Text:'GL_UNPACK_SKIP_PIXELS';Value:GL_UNPACK_SKIP_PIXELS), + (Text:'GL_UNPACK_ALIGNMENT';Value:GL_UNPACK_ALIGNMENT), + (Text:'GL_PACK_SWAP_BYTES';Value:GL_PACK_SWAP_BYTES), + (Text:'GL_PACK_LSB_FIRST';Value:GL_PACK_LSB_FIRST), + (Text:'GL_PACK_ROW_LENGTH';Value:GL_PACK_ROW_LENGTH), + (Text:'GL_PACK_SKIP_ROWS';Value:GL_PACK_SKIP_ROWS), + (Text:'GL_PACK_SKIP_PIXELS';Value:GL_PACK_SKIP_PIXELS), + (Text:'GL_PACK_ALIGNMENT';Value:GL_PACK_ALIGNMENT), + (Text:'GL_MAP_COLOR';Value:GL_MAP_COLOR), + (Text:'GL_MAP_STENCIL';Value:GL_MAP_STENCIL), + (Text:'GL_INDEX_SHIFT';Value:GL_INDEX_SHIFT), + (Text:'GL_INDEX_OFFSET';Value:GL_INDEX_OFFSET), + (Text:'GL_RED_SCALE';Value:GL_RED_SCALE), + (Text:'GL_RED_BIAS';Value:GL_RED_BIAS), + (Text:'GL_ZOOM_X';Value:GL_ZOOM_X), + (Text:'GL_ZOOM_Y';Value:GL_ZOOM_Y), + (Text:'GL_GREEN_SCALE';Value:GL_GREEN_SCALE), + (Text:'GL_GREEN_BIAS';Value:GL_GREEN_BIAS), + (Text:'GL_BLUE_SCALE';Value:GL_BLUE_SCALE), + (Text:'GL_BLUE_BIAS';Value:GL_BLUE_BIAS), + (Text:'GL_ALPHA_SCALE';Value:GL_ALPHA_SCALE), + (Text:'GL_ALPHA_BIAS';Value:GL_ALPHA_BIAS), + (Text:'GL_DEPTH_SCALE';Value:GL_DEPTH_SCALE), + (Text:'GL_DEPTH_BIAS';Value:GL_DEPTH_BIAS), + (Text:'GL_MAX_EVAL_ORDER';Value:GL_MAX_EVAL_ORDER), + (Text:'GL_MAX_LIGHTS';Value:GL_MAX_LIGHTS), + (Text:'GL_MAX_CLIP_PLANES';Value:GL_MAX_CLIP_PLANES), + (Text:'GL_MAX_TEXTURE_SIZE';Value:GL_MAX_TEXTURE_SIZE), + (Text:'GL_MAX_PIXEL_MAP_TABLE';Value:GL_MAX_PIXEL_MAP_TABLE), + (Text:'GL_MAX_ATTRIB_STACK_DEPTH';Value:GL_MAX_ATTRIB_STACK_DEPTH), + (Text:'GL_MAX_MODELVIEW_STACK_DEPTH';Value:GL_MAX_MODELVIEW_STACK_DEPTH), + (Text:'GL_MAX_NAME_STACK_DEPTH';Value:GL_MAX_NAME_STACK_DEPTH), + (Text:'GL_MAX_PROJECTION_STACK_DEPTH';Value:GL_MAX_PROJECTION_STACK_DEPTH), + (Text:'GL_MAX_TEXTURE_STACK_DEPTH';Value:GL_MAX_TEXTURE_STACK_DEPTH), + (Text:'GL_MAX_VIEWPORT_DIMS';Value:GL_MAX_VIEWPORT_DIMS), + (Text:'GL_MAX_CLIENT_ATTRIB_STACK_DEPTH';Value:GL_MAX_CLIENT_ATTRIB_STACK_DEPTH), + (Text:'GL_SUBPIXEL_BITS';Value:GL_SUBPIXEL_BITS), + (Text:'GL_INDEX_BITS';Value:GL_INDEX_BITS), + (Text:'GL_RED_BITS';Value:GL_RED_BITS), + (Text:'GL_GREEN_BITS';Value:GL_GREEN_BITS), + (Text:'GL_BLUE_BITS';Value:GL_BLUE_BITS), + (Text:'GL_ALPHA_BITS';Value:GL_ALPHA_BITS), + (Text:'GL_DEPTH_BITS';Value:GL_DEPTH_BITS), + (Text:'GL_STENCIL_BITS';Value:GL_STENCIL_BITS), + (Text:'GL_ACCUM_RED_BITS';Value:GL_ACCUM_RED_BITS), + (Text:'GL_ACCUM_GREEN_BITS';Value:GL_ACCUM_GREEN_BITS), + (Text:'GL_ACCUM_BLUE_BITS';Value:GL_ACCUM_BLUE_BITS), + (Text:'GL_ACCUM_ALPHA_BITS';Value:GL_ACCUM_ALPHA_BITS), + (Text:'GL_NAME_STACK_DEPTH';Value:GL_NAME_STACK_DEPTH), + (Text:'GL_AUTO_NORMAL';Value:GL_AUTO_NORMAL), + (Text:'GL_MAP1_COLOR_4';Value:GL_MAP1_COLOR_4), + (Text:'GL_MAP1_INDEX';Value:GL_MAP1_INDEX), + (Text:'GL_MAP1_NORMAL';Value:GL_MAP1_NORMAL), + (Text:'GL_MAP1_TEXTURE_COORD_1';Value:GL_MAP1_TEXTURE_COORD_1), + (Text:'GL_MAP1_TEXTURE_COORD_2';Value:GL_MAP1_TEXTURE_COORD_2), + (Text:'GL_MAP1_TEXTURE_COORD_3';Value:GL_MAP1_TEXTURE_COORD_3), + (Text:'GL_MAP1_TEXTURE_COORD_4';Value:GL_MAP1_TEXTURE_COORD_4), + (Text:'GL_MAP1_VERTEX_3';Value:GL_MAP1_VERTEX_3), + (Text:'GL_MAP1_VERTEX_4';Value:GL_MAP1_VERTEX_4), + (Text:'GL_MAP2_COLOR_4';Value:GL_MAP2_COLOR_4), + (Text:'GL_MAP2_INDEX';Value:GL_MAP2_INDEX), + (Text:'GL_MAP2_NORMAL';Value:GL_MAP2_NORMAL), + (Text:'GL_MAP2_TEXTURE_COORD_1';Value:GL_MAP2_TEXTURE_COORD_1), + (Text:'GL_MAP2_TEXTURE_COORD_2';Value:GL_MAP2_TEXTURE_COORD_2), + (Text:'GL_MAP2_TEXTURE_COORD_3';Value:GL_MAP2_TEXTURE_COORD_3), + (Text:'GL_MAP2_TEXTURE_COORD_4';Value:GL_MAP2_TEXTURE_COORD_4), + (Text:'GL_MAP2_VERTEX_3';Value:GL_MAP2_VERTEX_3), + (Text:'GL_MAP2_VERTEX_4';Value:GL_MAP2_VERTEX_4), + (Text:'GL_MAP1_GRID_DOMAIN';Value:GL_MAP1_GRID_DOMAIN), + (Text:'GL_MAP1_GRID_SEGMENTS';Value:GL_MAP1_GRID_SEGMENTS), + (Text:'GL_MAP2_GRID_DOMAIN';Value:GL_MAP2_GRID_DOMAIN), + (Text:'GL_MAP2_GRID_SEGMENTS';Value:GL_MAP2_GRID_SEGMENTS), + (Text:'GL_TEXTURE_1D';Value:GL_TEXTURE_1D), + (Text:'GL_TEXTURE_2D';Value:GL_TEXTURE_2D), + (Text:'GL_FEEDBACK_BUFFER_POINTER';Value:GL_FEEDBACK_BUFFER_POINTER), + (Text:'GL_FEEDBACK_BUFFER_SIZE';Value:GL_FEEDBACK_BUFFER_SIZE), + (Text:'GL_FEEDBACK_BUFFER_TYPE';Value:GL_FEEDBACK_BUFFER_TYPE), + (Text:'GL_SELECTION_BUFFER_POINTER';Value:GL_SELECTION_BUFFER_POINTER), + (Text:'GL_SELECTION_BUFFER_SIZE';Value:GL_SELECTION_BUFFER_SIZE), + (Text:'GL_TEXTURE_WIDTH';Value:GL_TEXTURE_WIDTH), + (Text:'GL_TEXTURE_HEIGHT';Value:GL_TEXTURE_HEIGHT), + (Text:'GL_TEXTURE_INTERNAL_FORMAT';Value:GL_TEXTURE_INTERNAL_FORMAT), + (Text:'GL_TEXTURE_BORDER_COLOR';Value:GL_TEXTURE_BORDER_COLOR), + (Text:'GL_TEXTURE_BORDER';Value:GL_TEXTURE_BORDER), + (Text:'GL_DONT_CARE';Value:GL_DONT_CARE), + (Text:'GL_FASTEST';Value:GL_FASTEST), + (Text:'GL_NICEST';Value:GL_NICEST), + (Text:'GL_LIGHT0';Value:GL_LIGHT0), + (Text:'GL_LIGHT1';Value:GL_LIGHT1), + (Text:'GL_LIGHT2';Value:GL_LIGHT2), + (Text:'GL_LIGHT3';Value:GL_LIGHT3), + (Text:'GL_LIGHT4';Value:GL_LIGHT4), + (Text:'GL_LIGHT5';Value:GL_LIGHT5), + (Text:'GL_LIGHT6';Value:GL_LIGHT6), + (Text:'GL_LIGHT7';Value:GL_LIGHT7), + (Text:'GL_AMBIENT';Value:GL_AMBIENT), + (Text:'GL_DIFFUSE';Value:GL_DIFFUSE), + (Text:'GL_SPECULAR';Value:GL_SPECULAR), + (Text:'GL_POSITION';Value:GL_POSITION), + (Text:'GL_SPOT_DIRECTION';Value:GL_SPOT_DIRECTION), + (Text:'GL_SPOT_EXPONENT';Value:GL_SPOT_EXPONENT), + (Text:'GL_SPOT_CUTOFF';Value:GL_SPOT_CUTOFF), + (Text:'GL_CONSTANT_ATTENUATION';Value:GL_CONSTANT_ATTENUATION), + (Text:'GL_LINEAR_ATTENUATION';Value:GL_LINEAR_ATTENUATION), + (Text:'GL_QUADRATIC_ATTENUATION';Value:GL_QUADRATIC_ATTENUATION), + (Text:'GL_COMPILE';Value:GL_COMPILE), + (Text:'GL_COMPILE_AND_EXECUTE';Value:GL_COMPILE_AND_EXECUTE), + (Text:'GL_CLEAR';Value:GL_CLEAR), + (Text:'GL_AND';Value:GL_AND), + (Text:'GL_AND_REVERSE';Value:GL_AND_REVERSE), + (Text:'GL_COPY';Value:GL_COPY), + (Text:'GL_AND_INVERTED';Value:GL_AND_INVERTED), + (Text:'GL_NOOP';Value:GL_NOOP), + (Text:'GL_XOR';Value:GL_XOR), + (Text:'GL_OR';Value:GL_OR), + (Text:'GL_NOR';Value:GL_NOR), + (Text:'GL_EQUIV';Value:GL_EQUIV), + (Text:'GL_INVERT';Value:GL_INVERT), + (Text:'GL_OR_REVERSE';Value:GL_OR_REVERSE), + (Text:'GL_COPY_INVERTED';Value:GL_COPY_INVERTED), + (Text:'GL_OR_INVERTED';Value:GL_OR_INVERTED), + (Text:'GL_NAND';Value:GL_NAND), + (Text:'GL_SET';Value:GL_SET), + (Text:'GL_EMISSION';Value:GL_EMISSION), + (Text:'GL_SHININESS';Value:GL_SHININESS), + (Text:'GL_AMBIENT_AND_DIFFUSE';Value:GL_AMBIENT_AND_DIFFUSE), + (Text:'GL_COLOR_INDEXES';Value:GL_COLOR_INDEXES), + (Text:'GL_MODELVIEW';Value:GL_MODELVIEW), + (Text:'GL_PROJECTION';Value:GL_PROJECTION), + (Text:'GL_TEXTURE';Value:GL_TEXTURE), + (Text:'GL_COLOR';Value:GL_COLOR), + (Text:'GL_DEPTH';Value:GL_DEPTH), + (Text:'GL_STENCIL';Value:GL_STENCIL), + (Text:'GL_COLOR_INDEX';Value:GL_COLOR_INDEX), + (Text:'GL_STENCIL_INDEX';Value:GL_STENCIL_INDEX), + (Text:'GL_DEPTH_COMPONENT';Value:GL_DEPTH_COMPONENT), + (Text:'GL_RED';Value:GL_RED), + (Text:'GL_GREEN';Value:GL_GREEN), + (Text:'GL_BLUE';Value:GL_BLUE), + (Text:'GL_ALPHA';Value:GL_ALPHA), + (Text:'GL_RGB';Value:GL_RGB), + (Text:'GL_RGBA';Value:GL_RGBA), + (Text:'GL_LUMINANCE';Value:GL_LUMINANCE), + (Text:'GL_LUMINANCE_ALPHA';Value:GL_LUMINANCE_ALPHA), + (Text:'GL_BITMAP';Value:GL_BITMAP), + (Text:'GL_POINT';Value:GL_POINT), + (Text:'GL_LINE';Value:GL_LINE), + (Text:'GL_FILL';Value:GL_FILL), + (Text:'GL_RENDER';Value:GL_RENDER), + (Text:'GL_FEEDBACK';Value:GL_FEEDBACK), + (Text:'GL_SELECT';Value:GL_SELECT), + (Text:'GL_FLAT';Value:GL_FLAT), + (Text:'GL_SMOOTH';Value:GL_SMOOTH), + (Text:'GL_KEEP';Value:GL_KEEP), + (Text:'GL_REPLACE';Value:GL_REPLACE), + (Text:'GL_INCR';Value:GL_INCR), + (Text:'GL_DECR';Value:GL_DECR), + (Text:'GL_VENDOR';Value:GL_VENDOR), + (Text:'GL_RENDERER';Value:GL_RENDERER), + (Text:'GL_VERSION';Value:GL_VERSION), + (Text:'GL_EXTENSIONS';Value:GL_EXTENSIONS), + (Text:'GL_S';Value:GL_S), + (Text:'GL_T';Value:GL_T), + (Text:'GL_R';Value:GL_R), + (Text:'GL_Q';Value:GL_Q), + (Text:'GL_MODULATE';Value:GL_MODULATE), + (Text:'GL_DECAL';Value:GL_DECAL), + (Text:'GL_TEXTURE_ENV_MODE';Value:GL_TEXTURE_ENV_MODE), + (Text:'GL_TEXTURE_ENV_COLOR';Value:GL_TEXTURE_ENV_COLOR), + (Text:'GL_TEXTURE_ENV';Value:GL_TEXTURE_ENV), + (Text:'GL_EYE_LINEAR';Value:GL_EYE_LINEAR), + (Text:'GL_OBJECT_LINEAR';Value:GL_OBJECT_LINEAR), + (Text:'GL_SPHERE_MAP';Value:GL_SPHERE_MAP), + (Text:'GL_TEXTURE_GEN_MODE';Value:GL_TEXTURE_GEN_MODE), + (Text:'GL_OBJECT_PLANE';Value:GL_OBJECT_PLANE), + (Text:'GL_EYE_PLANE';Value:GL_EYE_PLANE), + (Text:'GL_NEAREST';Value:GL_NEAREST), + (Text:'GL_LINEAR';Value:GL_LINEAR), + (Text:'GL_NEAREST_MIPMAP_NEAREST';Value:GL_NEAREST_MIPMAP_NEAREST), + (Text:'GL_LINEAR_MIPMAP_NEAREST';Value:GL_LINEAR_MIPMAP_NEAREST), + (Text:'GL_NEAREST_MIPMAP_LINEAR';Value:GL_NEAREST_MIPMAP_LINEAR), + (Text:'GL_LINEAR_MIPMAP_LINEAR';Value:GL_LINEAR_MIPMAP_LINEAR), + (Text:'GL_TEXTURE_MAG_FILTER';Value:GL_TEXTURE_MAG_FILTER), + (Text:'GL_TEXTURE_MIN_FILTER';Value:GL_TEXTURE_MIN_FILTER), + (Text:'GL_TEXTURE_WRAP_S';Value:GL_TEXTURE_WRAP_S), + (Text:'GL_TEXTURE_WRAP_T';Value:GL_TEXTURE_WRAP_T), + (Text:'GL_CLAMP';Value:GL_CLAMP), + (Text:'GL_REPEAT';Value:GL_REPEAT), + (Text:'GL_CLIENT_PIXEL_STORE_BIT';Value:GL_CLIENT_PIXEL_STORE_BIT), + (Text:'GL_CLIENT_VERTEX_ARRAY_BIT';Value:GL_CLIENT_VERTEX_ARRAY_BIT), + (Text:'GL_CLIENT_ALL_ATTRIB_BITS';Value:GL_CLIENT_ALL_ATTRIB_BITS), + (Text:'GL_POLYGON_OFFSET_FACTOR';Value:GL_POLYGON_OFFSET_FACTOR), + (Text:'GL_POLYGON_OFFSET_UNITS';Value:GL_POLYGON_OFFSET_UNITS), + (Text:'GL_POLYGON_OFFSET_POINT';Value:GL_POLYGON_OFFSET_POINT), + (Text:'GL_POLYGON_OFFSET_LINE';Value:GL_POLYGON_OFFSET_LINE), + (Text:'GL_POLYGON_OFFSET_FILL';Value:GL_POLYGON_OFFSET_FILL), + (Text:'GL_ALPHA4';Value:GL_ALPHA4), + (Text:'GL_ALPHA8';Value:GL_ALPHA8), + (Text:'GL_ALPHA12';Value:GL_ALPHA12), + (Text:'GL_ALPHA16';Value:GL_ALPHA16), + (Text:'GL_LUMINANCE4';Value:GL_LUMINANCE4), + (Text:'GL_LUMINANCE8';Value:GL_LUMINANCE8), + (Text:'GL_LUMINANCE12';Value:GL_LUMINANCE12), + (Text:'GL_LUMINANCE16';Value:GL_LUMINANCE16), + (Text:'GL_LUMINANCE4_ALPHA4';Value:GL_LUMINANCE4_ALPHA4), + (Text:'GL_LUMINANCE6_ALPHA2';Value:GL_LUMINANCE6_ALPHA2), + (Text:'GL_LUMINANCE8_ALPHA8';Value:GL_LUMINANCE8_ALPHA8), + (Text:'GL_LUMINANCE12_ALPHA4';Value:GL_LUMINANCE12_ALPHA4), + (Text:'GL_LUMINANCE12_ALPHA12';Value:GL_LUMINANCE12_ALPHA12), + (Text:'GL_LUMINANCE16_ALPHA16';Value:GL_LUMINANCE16_ALPHA16), + (Text:'GL_INTENSITY';Value:GL_INTENSITY), + (Text:'GL_INTENSITY4';Value:GL_INTENSITY4), + (Text:'GL_INTENSITY8';Value:GL_INTENSITY8), + (Text:'GL_INTENSITY12';Value:GL_INTENSITY12), + (Text:'GL_INTENSITY16';Value:GL_INTENSITY16), + (Text:'GL_R3_G3_B2';Value:GL_R3_G3_B2), + (Text:'GL_RGB4';Value:GL_RGB4), + (Text:'GL_RGB5';Value:GL_RGB5), + (Text:'GL_RGB8';Value:GL_RGB8), + (Text:'GL_RGB10';Value:GL_RGB10), + (Text:'GL_RGB12';Value:GL_RGB12), + (Text:'GL_RGB16';Value:GL_RGB16), + (Text:'GL_RGBA2';Value:GL_RGBA2), + (Text:'GL_RGBA4';Value:GL_RGBA4), + (Text:'GL_RGB5_A1';Value:GL_RGB5_A1), + (Text:'GL_RGBA8';Value:GL_RGBA8), + (Text:'GL_RGB10_A2';Value:GL_RGB10_A2), + (Text:'GL_RGBA12';Value:GL_RGBA12), + (Text:'GL_RGBA16';Value:GL_RGBA16), + (Text:'GL_TEXTURE_RED_SIZE';Value:GL_TEXTURE_RED_SIZE), + (Text:'GL_TEXTURE_GREEN_SIZE';Value:GL_TEXTURE_GREEN_SIZE), + (Text:'GL_TEXTURE_BLUE_SIZE';Value:GL_TEXTURE_BLUE_SIZE), + (Text:'GL_TEXTURE_ALPHA_SIZE';Value:GL_TEXTURE_ALPHA_SIZE), + (Text:'GL_TEXTURE_LUMINANCE_SIZE';Value:GL_TEXTURE_LUMINANCE_SIZE), + (Text:'GL_TEXTURE_INTENSITY_SIZE';Value:GL_TEXTURE_INTENSITY_SIZE), + (Text:'GL_PROXY_TEXTURE_1D';Value:GL_PROXY_TEXTURE_1D), + (Text:'GL_PROXY_TEXTURE_2D';Value:GL_PROXY_TEXTURE_2D), + (Text:'GL_TEXTURE_PRIORITY';Value:GL_TEXTURE_PRIORITY), + (Text:'GL_TEXTURE_RESIDENT';Value:GL_TEXTURE_RESIDENT), + (Text:'GL_TEXTURE_BINDING_1D';Value:GL_TEXTURE_BINDING_1D), + (Text:'GL_TEXTURE_BINDING_2D';Value:GL_TEXTURE_BINDING_2D), + (Text:'GL_VERTEX_ARRAY';Value:GL_VERTEX_ARRAY), + (Text:'GL_NORMAL_ARRAY';Value:GL_NORMAL_ARRAY), + (Text:'GL_COLOR_ARRAY';Value:GL_COLOR_ARRAY), + (Text:'GL_INDEX_ARRAY';Value:GL_INDEX_ARRAY), + (Text:'GL_TEXTURE_COORD_ARRAY';Value:GL_TEXTURE_COORD_ARRAY), + (Text:'GL_EDGE_FLAG_ARRAY';Value:GL_EDGE_FLAG_ARRAY), + (Text:'GL_VERTEX_ARRAY_SIZE';Value:GL_VERTEX_ARRAY_SIZE), + (Text:'GL_VERTEX_ARRAY_TYPE';Value:GL_VERTEX_ARRAY_TYPE), + (Text:'GL_VERTEX_ARRAY_STRIDE';Value:GL_VERTEX_ARRAY_STRIDE), + (Text:'GL_NORMAL_ARRAY_TYPE';Value:GL_NORMAL_ARRAY_TYPE), + (Text:'GL_NORMAL_ARRAY_STRIDE';Value:GL_NORMAL_ARRAY_STRIDE), + (Text:'GL_COLOR_ARRAY_SIZE';Value:GL_COLOR_ARRAY_SIZE), + (Text:'GL_COLOR_ARRAY_TYPE';Value:GL_COLOR_ARRAY_TYPE), + (Text:'GL_COLOR_ARRAY_STRIDE';Value:GL_COLOR_ARRAY_STRIDE), + (Text:'GL_INDEX_ARRAY_TYPE';Value:GL_INDEX_ARRAY_TYPE), + (Text:'GL_INDEX_ARRAY_STRIDE';Value:GL_INDEX_ARRAY_STRIDE), + (Text:'GL_TEXTURE_COORD_ARRAY_SIZE';Value:GL_TEXTURE_COORD_ARRAY_SIZE), + (Text:'GL_TEXTURE_COORD_ARRAY_TYPE';Value:GL_TEXTURE_COORD_ARRAY_TYPE), + (Text:'GL_TEXTURE_COORD_ARRAY_STRIDE';Value:GL_TEXTURE_COORD_ARRAY_STRIDE), + (Text:'GL_EDGE_FLAG_ARRAY_STRIDE';Value:GL_EDGE_FLAG_ARRAY_STRIDE), + (Text:'GL_VERTEX_ARRAY_POINTER';Value:GL_VERTEX_ARRAY_POINTER), + (Text:'GL_NORMAL_ARRAY_POINTER';Value:GL_NORMAL_ARRAY_POINTER), + (Text:'GL_COLOR_ARRAY_POINTER';Value:GL_COLOR_ARRAY_POINTER), + (Text:'GL_INDEX_ARRAY_POINTER';Value:GL_INDEX_ARRAY_POINTER), + (Text:'GL_TEXTURE_COORD_ARRAY_POINTER';Value:GL_TEXTURE_COORD_ARRAY_POINTER), + (Text:'GL_EDGE_FLAG_ARRAY_POINTER';Value:GL_EDGE_FLAG_ARRAY_POINTER), + (Text:'GL_V2F';Value:GL_V2F), + (Text:'GL_V3F';Value:GL_V3F), + (Text:'GL_C4UB_V2F';Value:GL_C4UB_V2F), + (Text:'GL_C4UB_V3F';Value:GL_C4UB_V3F), + (Text:'GL_C3F_V3F';Value:GL_C3F_V3F), + (Text:'GL_N3F_V3F';Value:GL_N3F_V3F), + (Text:'GL_C4F_N3F_V3F';Value:GL_C4F_N3F_V3F), + (Text:'GL_T2F_V3F';Value:GL_T2F_V3F), + (Text:'GL_T4F_V4F';Value:GL_T4F_V4F), + (Text:'GL_T2F_C4UB_V3F';Value:GL_T2F_C4UB_V3F), + (Text:'GL_T2F_C3F_V3F';Value:GL_T2F_C3F_V3F), + (Text:'GL_T2F_N3F_V3F';Value:GL_T2F_N3F_V3F), + (Text:'GL_T2F_C4F_N3F_V3F';Value:GL_T2F_C4F_N3F_V3F), + (Text:'GL_T4F_C4F_N3F_V4F';Value:GL_T4F_C4F_N3F_V4F), + (Text:'GL_EXT_vertex_array';Value:GL_EXT_vertex_array), + (Text:'GL_WIN_swap_hint';Value:GL_WIN_swap_hint), + (Text:'GL_EXT_bgra';Value:GL_EXT_bgra), + (Text:'GL_EXT_paletted_texture';Value:GL_EXT_paletted_texture), + (Text:'GL_VERTEX_ARRAY_EXT';Value:GL_VERTEX_ARRAY_EXT), + (Text:'GL_NORMAL_ARRAY_EXT';Value:GL_NORMAL_ARRAY_EXT), + (Text:'GL_COLOR_ARRAY_EXT';Value:GL_COLOR_ARRAY_EXT), + (Text:'GL_INDEX_ARRAY_EXT';Value:GL_INDEX_ARRAY_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_EXT';Value:GL_TEXTURE_COORD_ARRAY_EXT), + (Text:'GL_EDGE_FLAG_ARRAY_EXT';Value:GL_EDGE_FLAG_ARRAY_EXT), + (Text:'GL_VERTEX_ARRAY_SIZE_EXT';Value:GL_VERTEX_ARRAY_SIZE_EXT), + (Text:'GL_VERTEX_ARRAY_TYPE_EXT';Value:GL_VERTEX_ARRAY_TYPE_EXT), + (Text:'GL_VERTEX_ARRAY_STRIDE_EXT';Value:GL_VERTEX_ARRAY_STRIDE_EXT), + (Text:'GL_VERTEX_ARRAY_COUNT_EXT';Value:GL_VERTEX_ARRAY_COUNT_EXT), + (Text:'GL_NORMAL_ARRAY_TYPE_EXT';Value:GL_NORMAL_ARRAY_TYPE_EXT), + (Text:'GL_NORMAL_ARRAY_STRIDE_EXT';Value:GL_NORMAL_ARRAY_STRIDE_EXT), + (Text:'GL_NORMAL_ARRAY_COUNT_EXT';Value:GL_NORMAL_ARRAY_COUNT_EXT), + (Text:'GL_COLOR_ARRAY_SIZE_EXT';Value:GL_COLOR_ARRAY_SIZE_EXT), + (Text:'GL_COLOR_ARRAY_TYPE_EXT';Value:GL_COLOR_ARRAY_TYPE_EXT), + (Text:'GL_COLOR_ARRAY_STRIDE_EXT';Value:GL_COLOR_ARRAY_STRIDE_EXT), + (Text:'GL_COLOR_ARRAY_COUNT_EXT';Value:GL_COLOR_ARRAY_COUNT_EXT), + (Text:'GL_INDEX_ARRAY_TYPE_EXT';Value:GL_INDEX_ARRAY_TYPE_EXT), + (Text:'GL_INDEX_ARRAY_STRIDE_EXT';Value:GL_INDEX_ARRAY_STRIDE_EXT), + (Text:'GL_INDEX_ARRAY_COUNT_EXT';Value:GL_INDEX_ARRAY_COUNT_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_SIZE_EXT';Value:GL_TEXTURE_COORD_ARRAY_SIZE_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_TYPE_EXT';Value:GL_TEXTURE_COORD_ARRAY_TYPE_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_STRIDE_EXT';Value:GL_TEXTURE_COORD_ARRAY_STRIDE_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_COUNT_EXT';Value:GL_TEXTURE_COORD_ARRAY_COUNT_EXT), + (Text:'GL_EDGE_FLAG_ARRAY_STRIDE_EXT';Value:GL_EDGE_FLAG_ARRAY_STRIDE_EXT), + (Text:'GL_EDGE_FLAG_ARRAY_COUNT_EXT';Value:GL_EDGE_FLAG_ARRAY_COUNT_EXT), + (Text:'GL_VERTEX_ARRAY_POINTER_EXT';Value:GL_VERTEX_ARRAY_POINTER_EXT), + (Text:'GL_NORMAL_ARRAY_POINTER_EXT';Value:GL_NORMAL_ARRAY_POINTER_EXT), + (Text:'GL_COLOR_ARRAY_POINTER_EXT';Value:GL_COLOR_ARRAY_POINTER_EXT), + (Text:'GL_INDEX_ARRAY_POINTER_EXT';Value:GL_INDEX_ARRAY_POINTER_EXT), + (Text:'GL_TEXTURE_COORD_ARRAY_POINTER_EXT';Value:GL_TEXTURE_COORD_ARRAY_POINTER_EXT), + (Text:'GL_EDGE_FLAG_ARRAY_POINTER_EXT';Value:GL_EDGE_FLAG_ARRAY_POINTER_EXT), + (Text:'GL_DOUBLE_EXT';Value:GL_DOUBLE_EXT), + (Text:'GL_BGR_EXT';Value:GL_BGR_EXT), + (Text:'GL_BGRA_EXT';Value:GL_BGRA_EXT), + (Text:'GL_COLOR_TABLE_FORMAT_EXT';Value:GL_COLOR_TABLE_FORMAT_EXT), + (Text:'GL_COLOR_TABLE_WIDTH_EXT';Value:GL_COLOR_TABLE_WIDTH_EXT), + (Text:'GL_COLOR_TABLE_RED_SIZE_EXT';Value:GL_COLOR_TABLE_RED_SIZE_EXT), + (Text:'GL_COLOR_TABLE_GREEN_SIZE_EXT';Value:GL_COLOR_TABLE_GREEN_SIZE_EXT), + (Text:'GL_COLOR_TABLE_BLUE_SIZE_EXT';Value:GL_COLOR_TABLE_BLUE_SIZE_EXT), + (Text:'GL_COLOR_TABLE_ALPHA_SIZE_EXT';Value:GL_COLOR_TABLE_ALPHA_SIZE_EXT), + (Text:'GL_COLOR_TABLE_LUMINANCE_SIZE_EXT';Value:GL_COLOR_TABLE_LUMINANCE_SIZE_EXT), + (Text:'GL_COLOR_TABLE_INTENSITY_SIZE_EXT';Value:GL_COLOR_TABLE_INTENSITY_SIZE_EXT), + (Text:'GL_COLOR_INDEX1_EXT';Value:GL_COLOR_INDEX1_EXT), + (Text:'GL_COLOR_INDEX2_EXT';Value:GL_COLOR_INDEX2_EXT), + (Text:'GL_COLOR_INDEX4_EXT';Value:GL_COLOR_INDEX4_EXT), + (Text:'GL_COLOR_INDEX8_EXT';Value:GL_COLOR_INDEX8_EXT), + (Text:'GL_COLOR_INDEX12_EXT';Value:GL_COLOR_INDEX12_EXT), + (Text:'GL_COLOR_INDEX16_EXT';Value:GL_COLOR_INDEX16_EXT) + ); + +function ULuaGl_StringToEnum(Str: String): GLenum; + function GetEnum(const Str: String): GLenum; + var + i : Integer; + begin + for i := 0 to high(ULuaGl_Enum) do + begin + if 0 = AnsiCompareText(Str, ULuaGl_Enum[i].Text) then + begin + Result := ULuaGl_Enum[i].Value; + Exit; + end; + end; + Result := ULuaGl_EnumERROR; + end; + var + i : Integer; + j : Integer; + temp : GLenum; +begin + Result := 0; + j := 1; + for i := 1 to Length(Str) do + begin + if Str[i] = ',' then + begin + temp := GetEnum(Copy(Str,j,i-j)); + if temp <> ULuaGl_EnumERROR then + Result := Result or temp; + j := i + 1; + end; + end; + + temp := GetEnum(Copy(Str,j,MaxInt)); + if (temp = ULuaGl_EnumERROR) then + begin + if Result = 0 then + Result := ULuaGl_EnumERROR; + exit; + end; + Result := Result or temp; +end; +end. + diff --git a/src/lua/ULuaLog.pas b/src/lua/ULuaLog.pas new file mode 100644 index 00000000..f4673ed9 --- /dev/null +++ b/src/lua/ULuaLog.pas @@ -0,0 +1,166 @@ +{* UltraStar Deluxe - Karaoke Game + * + * UltraStar Deluxe is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * 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; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + *} + +unit ULuaLog; + +interface + +{$IFDEF FPC} + {$MODE Delphi} +{$ENDIF} + +{$I switches.inc} + +uses + SysUtils, + ULog, + ULua; + +function luaopen_Log (L: Plua_State): Integer; cdecl; + +function ULuaLog_LogError(L: Plua_State): Integer; cdecl; +function ULuaLog_LogMsg(L: Plua_State): Integer; cdecl; +function ULuaLog_BenchmarkStart(L: Plua_State): Integer; cdecl; +function ULuaLog_BenchmarkEnd(L: Plua_State): Integer; cdecl; +function ULuaLog_LogBenchmark(L: Plua_State): Integer; cdecl; +function ULuaLog_LogDebug(L: Plua_State): Integer; cdecl; +function ULuaLog_LogInfo(L: Plua_State): Integer; cdecl; +function ULuaLog_LogStatus(L: Plua_State): Integer; cdecl; +function ULuaLog_LogWarn(L: Plua_State): Integer; cdecl; +function ULuaLog_LogCritical(L: Plua_State): Integer; cdecl; +function ULuaLog_CriticalError(L: Plua_State): Integer; cdecl; +function ULuaLog_GetLogLevel(L: Plua_State): Integer; cdecl; +function ULuaLog_SetLogLevel(L: Plua_State): Integer; cdecl; + +implementation + +function ULuaLog_LogError(L: Plua_State): Integer; cdecl; +begin + if (lua_gettop(L) > 1) then + Log.LogError(luaL_checkstring(L,-2),luaL_checkstring(L,-1)) + else + Log.LogError(luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogMsg(L: Plua_State): Integer; cdecl; +begin + if (lua_gettop(L) > 2) then + Log.LogMsg(luaL_checkstring(L,-3),luaL_checkstring(L,-1),luaL_checkinteger(L,-2)) + else + Log.LogMsg(luaL_checkstring(L,-2),luaL_checkinteger(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_BenchmarkStart(L: Plua_State): Integer; cdecl; +begin + Log.BenchmarkStart(luaL_checkinteger(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_BenchmarkEnd(L: Plua_State): Integer; cdecl; +begin + Log.BenchmarkEnd(luaL_checkinteger(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogBenchmark(L: Plua_State): Integer; cdecl; +begin + Log.LogBenchmark(luaL_checkstring(L,-2),luaL_checkinteger(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogDebug(L: Plua_State): Integer; cdecl; +begin + Log.LogDebug(luaL_checkstring(L,-2),luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogInfo(L: Plua_State): Integer; cdecl; +begin + Log.LogInfo(luaL_checkstring(L,-2),luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogStatus(L: Plua_State): Integer; cdecl; +begin + Log.LogStatus(luaL_checkstring(L,-2),luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogWarn(L: Plua_State): Integer; cdecl; +begin + Log.LogWarn(luaL_checkstring(L,-2),luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_LogCritical(L: Plua_State): Integer; cdecl; +begin + Log.LogCritical(luaL_checkstring(L,-2),luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_CriticalError(L: Plua_State): Integer; cdecl; +begin + Log.CriticalError(luaL_checkstring(L,-1)); + result:=0; // number of results +end; + +function ULuaLog_GetLogLevel(L: Plua_State): Integer; cdecl; +begin + lua_pushinteger(L,Log.GetLogLevel()); + result:=1; // number of results +end; + +function ULuaLog_SetLogLevel(L: Plua_State): Integer; cdecl; +begin + Log.SetLogLevel(luaL_checkinteger(L,-1)); + result:=0; // number of results +end; + +const + ULuaLog_Lib_f: array [0..13] of lual_reg = ( + (name:'LogError';func:ULuaLog_LogError), + (name:'LogMsg';func:ULuaLog_LogMsg), + (name:'BenchmarkStart';func:ULuaLog_BenchmarkStart), + (name:'BenchmarkEnd';func:ULuaLog_BenchmarkEnd), + (name:'LogBenchmark';func:ULuaLog_LogBenchmark), + (name:'LogDebug';func:ULuaLog_LogDebug), + (name:'LogInfo';func:ULuaLog_LogInfo), + (name:'LogStatus';func:ULuaLog_LogStatus), + (name:'LogWarn';func:ULuaLog_LogWarn), + (name:'LogCritical';func:ULuaLog_LogCritical), + (name:'CriticalError';func:ULuaLog_CriticalError), + (name:'SetLogLevel';func:ULuaLog_GetLogLevel), + (name:'GetLogLevel';func:ULuaLog_SetLogLevel), + (name:nil;func:nil) + ); + +function luaopen_Log (L: Plua_State): Integer; cdecl; +begin + luaL_register(L,'Log',@ULuaLog_Lib_f[0]); + result:=1; +end; +end. diff --git a/src/ultrastardx.dpr b/src/ultrastardx.dpr index e13bbc13..54dbd58c 100644 --- a/src/ultrastardx.dpr +++ b/src/ultrastardx.dpr @@ -140,6 +140,13 @@ uses SQLiteTable3 in 'lib\SQLite\SQLiteTable3.pas', SQLite3 in 'lib\SQLite\SQLite3.pas', + //------------------------------ + //Includes - Lua Support + //------------------------------ + + ULua in 'lib\Lua\ULua.pas', + ULuaLog in 'lua\ULuaLog.pas', + ULuaGl in 'lua\ULuaGl.pas', //------------------------------ //Includes - Menu System |