Browse Source

universal cross platform unit file generator

alex 25 years ago
parent
commit
13d8d513b0

+ 1168 - 0
packages/opengl/build2/Makefile

@@ -0,0 +1,1168 @@
+#
+# Makefile generated by fpcmake v0.99.13 [2000/02/23]
+#
+
+defaultrule: all_units
+
+#####################################################################
+# Autodetect OS (Linux or Dos or Windows NT)
+# define inlinux when running under linux
+# define inWinNT when running under WinNT
+#####################################################################
+
+# We need only / in the path
+override PATH:=$(subst \,/,$(PATH))
+
+# Search for PWD and determine also if we are under linux
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(subst ;, ,$(PATH)))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(subst :, ,$(PATH)))))
+ifeq ($(PWD),)
+nopwd:
+	@echo You need the GNU utils package to use this Makefile!
+	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
+	@exit
+else
+inlinux=1
+endif
+else
+PWD:=$(firstword $(PWD))
+endif
+
+# Detect NT - NT sets OS to Windows_NT
+ifndef inlinux
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+endif
+endif
+
+# Detect OS/2 - OS/2 has OS2_SHELL defined
+ifndef inlinux
+ifndef inWinNT
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+endif
+
+# The extension of executables
+ifdef inlinux
+EXEEXT=
+else
+EXEEXT=.exe
+endif
+
+# The path which is searched separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+#####################################################################
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+# Compatibility with old makefiles
+ifdef PP
+FPC=$(PP)
+else
+ifdef inOS2
+FPC=ppos2
+else
+FPC=ppc386
+endif
+endif
+endif
+override FPC:=$(subst $(EXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(EXEEXT)
+
+# Target OS
+ifndef OS_TARGET
+OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
+
+#####################################################################
+# FPCDIR Setting
+#####################################################################
+
+# Test FPCDIR to look if the RTL dir exists
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=wrong
+endif
+endif
+else
+override FPCDIR=wrong
+endif
+
+# Default FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR=../../..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=wrong
+endif
+endif
+endif
+
+# Detect FPCDIR
+ifeq ($(FPCDIR),wrong)
+ifdef inlinux
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+endif
+
+ifndef PACKAGESDIR
+PACKAGESDIR=$(FPCDIR)/packages
+endif
+ifndef TOOLKITSDIR
+TOOLKITSDIR=
+endif
+ifndef COMPONENTSDIR
+COMPONENTSDIR=
+endif
+
+# Create units dir
+ifneq ($(FPCDIR),.)
+UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+
+#####################################################################
+# User Settings
+#####################################################################
+
+
+# Targets
+
+override UNITOBJECTS+=buildgl
+override EXEOBJECTS+=c_gen
+
+# Clean
+
+
+# Install
+
+ZIPTARGET=install
+
+# Defaults
+
+
+# Directories
+
+
+# Packages
+
+override PACKAGES+=rtl fcl
+
+# Libraries
+
+
+# Info
+
+INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Shell tools
+#####################################################################
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=echo
+ECHOE:=echo
+else
+ECHO:=$(firstword $(ECHO))
+ECHOE=$(ECHO) -E
+endif
+else
+ECHO:=$(firstword $(ECHO))
+ECHOE=$(ECHO) -E
+endif
+endif
+
+# To copy pograms
+ifndef COPY
+COPY:=cp -fp
+endif
+
+# Copy a whole tree
+ifndef COPYTREE
+COPYTREE:=cp -rfp
+endif
+
+# To move pograms
+ifndef MOVE
+MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+INSTALL:=install -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+INSTALLEXE:=install -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+MKDIR:=install -m 755 -d
+else
+MKDIR:=ginstall -m 755 -d
+endif
+endif
+
+export ECHO ECHOE COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+
+#####################################################################
+# Default Tools
+#####################################################################
+
+# assembler, redefine it if cross compiling
+ifndef AS
+AS=as
+endif
+
+# linker, but probably not used
+ifndef LD
+LD=ld
+endif
+
+# ppas.bat / ppas.sh
+ifdef inlinux
+PPAS=ppas.sh
+else
+ifdef inOS2
+PPAS=ppas.cmd
+else
+PPAS=ppas.bat
+endif
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+export PPUFILES
+
+# Look if UPX is found for go32v2 and win32. We can't use $UPX becuase
+# upx uses that one itself (PFV)
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+
+ZIPOPT=-9
+ZIPEXT=.zip
+
+# Tar
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG=
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+
+ifeq ($(USETAR),bz2)
+TAROPT=vI
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+RSTEXT=.rst
+FPCMADE=fpcmade
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+FPCMADE=fpcmade.v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+FPCMADE=fpcmade.dos
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+FPCMADE=fpcmade.lnx
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.w32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.os2
+endif
+
+# library prefix
+LIBPREFIX=lib
+ifeq ($(OS_TARGET),go32v2)
+LIBPREFIX=
+endif
+ifeq ($(OS_TARGET),go32v1)
+LIBPREFIX=
+endif
+
+# determine which .pas extension is used
+ifndef PASEXT
+ifdef EXEOBJECTS
+override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
+else
+override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
+endif
+ifeq ($(TESTPAS),)
+PASEXT=.pp
+else
+PASEXT=.pas
+endif
+endif
+
+
+# Check if the dirs really exists, else turn it off
+ifeq ($(wildcard $(UNITSDIR)),)
+UNITSDIR=
+endif
+ifeq ($(wildcard $(TOOLKITSDIR)),)
+TOOLKITSDIR=
+endif
+ifeq ($(wildcard $(PACKAGESDIR)),)
+PACKAGESDIR=
+endif
+ifeq ($(wildcard $(COMPONENTSDIR)),)
+COMPONENTSDIR=
+endif
+
+
+# PACKAGESDIR packages
+
+PACKAGERTL=1
+PACKAGEFCL=1
+
+ifdef PACKAGERTL
+ifneq ($(wildcard $(FPCDIR)/rtl),)
+ifneq ($(wildcard $(FPCDIR)/rtl/$(OS_TARGET)),)
+PACKAGEDIR_RTL=$(FPCDIR)/rtl/$(OS_TARGET)
+else
+PACKAGEDIR_RTL=$(FPCDIR)/rtl
+endif
+ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
+override COMPILEPACKAGES+=package_rtl
+package_rtl:
+	$(MAKE) -C $(PACKAGEDIR_RTL) all
+endif
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+else
+PACKAGEDIR_RTL=
+ifneq ($(wildcard $(UNITSDIR)/rtl),)
+ifneq ($(wildcard $(UNITSDIR)/rtl/$(OS_TARGET)),)
+UNITDIR_RTL=$(UNITSDIR)/rtl/$(OS_TARGET)
+else
+UNITDIR_RTL=$(UNITSDIR)/rtl
+endif
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override NEEDUNITDIR+=$(UNITDIR_RTL)
+endif
+endif
+ifdef PACKAGEFCL
+ifneq ($(wildcard $(FPCDIR)/fcl),)
+ifneq ($(wildcard $(FPCDIR)/fcl/$(OS_TARGET)),)
+PACKAGEDIR_FCL=$(FPCDIR)/fcl/$(OS_TARGET)
+else
+PACKAGEDIR_FCL=$(FPCDIR)/fcl
+endif
+ifeq ($(wildcard $(PACKAGEDIR_FCL)/$(FPCMADE)),)
+override COMPILEPACKAGES+=package_fcl
+package_fcl:
+	$(MAKE) -C $(PACKAGEDIR_FCL) all
+endif
+UNITDIR_FCL=$(PACKAGEDIR_FCL)
+else
+PACKAGEDIR_FCL=
+ifneq ($(wildcard $(UNITSDIR)/fcl),)
+ifneq ($(wildcard $(UNITSDIR)/fcl/$(OS_TARGET)),)
+UNITDIR_FCL=$(UNITSDIR)/fcl/$(OS_TARGET)
+else
+UNITDIR_FCL=$(UNITSDIR)/fcl
+endif
+else
+UNITDIR_FCL=
+endif
+endif
+ifdef UNITDIR_FCL
+override NEEDUNITDIR+=$(UNITDIR_FCL)
+endif
+endif
+
+
+#####################################################################
+# Default Directories
+#####################################################################
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+PREFIXINSTALLDIR=/usr
+else
+PREFIXINSTALLDIR=/pp
+endif
+endif
+export PREFIXINSTALLDIR
+
+# Where to place the resulting zip files
+ifndef DESTZIPDIR
+DESTZIPDIR:=$(BASEDIR)
+endif
+export DESTZIPDIR
+
+#####################################################################
+# Install Directories
+#####################################################################
+
+# set the base directory where to install everything
+ifndef BASEINSTALLDIR
+ifdef inlinux
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)/lib/fpc/$(FPC_VERSION)
+else
+BASEINSTALLDIR=$(PREFIXINSTALLDIR)
+endif
+endif
+
+# set the directory where to install the binaries
+ifndef BININSTALLDIR
+ifdef inlinux
+BININSTALLDIR=$(PREFIXINSTALLDIR)/bin
+else
+BININSTALLDIR=$(BASEINSTALLDIR)/bin/$(OS_TARGET)
+endif
+endif
+
+# set the directory where to install the units.
+ifndef UNITINSTALLDIR
+UNITINSTALLDIR=$(BASEINSTALLDIR)/units/$(OS_TARGET)
+ifdef UNITSUBDIR
+UNITINSTALLDIR:=$(UNITINSTALLDIR)/$(UNITSUBDIR)
+endif
+endif
+
+# Where to install shared libraries
+ifndef LIBINSTALLDIR
+ifdef inlinux
+LIBINSTALLDIR=$(PREFIXINSTALLDIR)/lib
+else
+LIBINSTALLDIR=$(UNITINSTALLDIR)
+endif
+endif
+
+# Where the source files will be stored
+ifndef SOURCEINSTALLDIR
+ifdef inlinux
+SOURCEINSTALLDIR=$(PREFIXINSTALLDIR)/src/fpc-$(FPC_VERSION)
+else
+SOURCEINSTALLDIR=$(BASEINSTALLDIR)/source
+endif
+ifdef SOURCESUBDIR
+SOURCEINSTALLDIR:=$(SOURCEINSTALLDIR)/$(SOURCESUBDIR)
+endif
+endif
+
+# Where the doc files will be stored
+ifndef DOCINSTALLDIR
+ifdef inlinux
+DOCINSTALLDIR=$(PREFIXINSTALLDIR)/doc/fpc-$(FPC_VERSION)
+else
+DOCINSTALLDIR=$(BASEINSTALLDIR)/doc
+endif
+endif
+
+# Where the some extra (data)files will be stored
+ifndef DATAINSTALLDIR
+DATAINSTALLDIR=$(BASEINSTALLDIR)
+endif
+
+#####################################################################
+# Redirection
+#####################################################################
+
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override FPCOPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
+
+
+#####################################################################
+# Compiler Command Line
+#####################################################################
+
+# Load commandline OPTDEF and add FPC_CPU define
+override FPCOPTDEF:=-d$(CPU_TARGET)
+
+# Load commandline OPT and add target and unit dir to be sure
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+
+ifdef NEEDUNITDIR
+override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
+endif
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
+endif
+
+# Smartlinking
+ifdef LINKSMART
+override FPCOPT+=-CX
+endif
+
+# Smartlinking
+ifdef CREATESMART
+override FPCOPT+=-XX
+endif
+
+# Debug
+ifdef DEBUG
+override FPCOPT+=-g -dDEBUG
+endif
+
+# Release mode (strip, optimize and don't load ppc386.cfg)
+# 0.99.12b has a bug in the optimizer so don't use it by default
+ifdef RELEASE
+ifeq ($(FPC_VERSION),0.99.12)
+override FPCOPT+=-Xs -OGp3 -n
+else
+override FPCOPT+=-Xs -OG2p3 -n
+endif
+endif
+
+# Strip
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+
+# Optimizer
+ifdef OPTIMIZE
+override FPCOPT+=-OG2p3
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+
+# Add commandline options
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+
+# Add defines from FPCOPTDEF to FPCOPT
+ifdef FPCOPTDEF
+override FPCOPT+=$(FPCOPTDEF)
+endif
+
+# Error file ?
+ifdef ERRORFILE
+override FPCOPT+=-Fr$(ERRORFILE)
+endif
+
+# Was a config file specified ?
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+
+# For win32 the options are passed using the environment FPCEXTCMD
+ifeq ($(OS_SOURCE),win32)
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+
+# Compiler commandline
+override COMPILER:=$(FPC) $(FPCOPT)
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS:=@$(PPAS)
+endif
+
+#####################################################################
+# Standard rules
+#####################################################################
+
+all: fpc_all
+
+debug: fpc_debug
+
+smart: fpc_smart
+
+shared: fpc_shared
+
+showinstall: fpc_showinstall
+
+install: fpc_install
+
+sourceinstall: fpc_sourceinstall
+
+zipinstall: fpc_zipinstall
+
+zipsourceinstall: fpc_zipsourceinstall
+
+clean: fpc_clean
+
+distclean: fpc_distclean
+
+cleanall: fpc_cleanall
+
+info: fpc_info
+
+.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipsourceinstall clean distclean cleanall info
+
+#####################################################################
+# Units
+#####################################################################
+
+.PHONY: fpc_units
+
+override ALLTARGET+=fpc_units
+
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
+override INSTALLPPUFILES+=$(UNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES)
+
+fpc_units: $(UNITPPUFILES)
+
+#####################################################################
+# Exes
+#####################################################################
+
+.PHONY: fpc_exes
+
+override EXEFILES=$(addsuffix $(EXEEXT),$(EXEOBJECTS))
+override EXEOFILES=$(addsuffix $(OEXT),$(EXEOBJECTS))
+
+override ALLTARGET+=fpc_exes
+override INSTALLEXEFILES+=$(EXEFILES)
+override CLEANEXEFILES+=$(EXEFILES) $(EXEOFILES)
+
+fpc_exes: $(EXEFILES)
+
+#####################################################################
+# General compile rules
+#####################################################################
+
+.PHONY: fpc_packages fpc_all fpc_debug
+
+$(FPCMADE): $(ALLTARGET)
+	@$(ECHO) Compiled > $(FPCMADE)
+
+fpc_packages: $(COMPILEPACKAGES)
+
+fpc_all: fpc_packages $(FPCMADE)
+
+fpc_debug:
+	$(MAKE) all DEBUG=1
+
+# General compile rules, available for both possible PASEXT
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPPAS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPPAS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPPAS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPPAS)
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_smart fpc_shared
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS:=$(UNITOBJECTS)
+endif
+
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+
+fpc_shared: all
+ifdef inlinux
+ifndef LIBNAME
+	@$(ECHO) "LIBNAME not set"
+else
+	$(PPUMOVE) $(SHAREDLIBUNITOBJECTS) -o$(LIBNAME)
+endif
+else
+	@$(ECHO) "Shared Libraries not supported"
+endif
+
+#####################################################################
+# Install rules
+#####################################################################
+
+.PHONY: fpc_showinstall fpc_install
+
+ifdef EXTRAINSTALLUNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRAINSTALLUNITS))
+endif
+
+ifdef INSTALLPPUFILES
+ifdef PPUFILES
+ifdef inlinux
+INSTALLPPULINKFILES:=$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES))
+INSTALLPPULIBFILES:=$(shell $(PPUFILES) -L $(INSTALLPPUFILES))
+else
+INSTALLPPULINKFILES:=$(shell $(PPUFILES) $(INSTALLPPUFILES))
+endif
+else
+INSTALLPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)))
+endif
+endif
+
+fpc_showinstall: $(SHOWINSTALLTARGET)
+ifdef INSTALLEXEFILES
+	@$(ECHO) -e $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
+endif
+ifdef INSTALLPPUFILES
+	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+	@$(ECHO) -e $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	@$(ECHO) -e $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) -e $(addprefix "\n"$(DATAINSTALLDIR)/,$(EXTRAINSTALLFILES))
+endif
+
+fpc_install: $(INSTALLTARGET)
+# Create UnitInstallFiles
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(BININSTALLDIR)
+# Compress the exes if upx is defined
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(BININSTALLDIR)
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(UNITINSTALLDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(UNITINSTALLDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(UNITINSTALLDIR)
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	$(MKDIR) $(LIBINSTALLDIR)
+	$(INSTALL) $(INSTALLPPULIBFILES) $(LIBINSTALLDIR)
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	$(MKDIR) $(DATAINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(DATAINSTALLDIR)
+endif
+
+#####################################################################
+# SourceInstall rules
+#####################################################################
+
+.PHONY: fpc_sourceinstall
+
+ifndef SOURCETOPDIR
+SOURCETOPDIR=$(BASEDIR)
+endif
+
+fpc_sourceinstall: clean
+	$(MKDIR) $(SOURCEINSTALLDIR)
+	$(COPYTREE) $(SOURCETOPDIR) $(SOURCEINSTALLDIR)
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall
+
+# Create suffix to add
+ifndef PACKAGESUFFIX
+PACKAGESUFFIX=$(OS_TARGET)
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+ifeq ($(OS_TARGET),win32)
+PACKAGESUFFIX=w32
+endif
+endif
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=$(BASEDIR)/pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Maybe create default zipname from packagename
+ifndef ZIPNAME
+ifdef PACKAGENAME
+ZIPNAME=$(PACKAGEPREFIX)$(PACKAGENAME)$(PACKAGESUFFIX)
+endif
+endif
+
+# Use tar by default under linux
+ifndef USEZIP
+ifdef inlinux
+USETAR=1
+endif
+endif
+
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) "Please specify ZIPNAME!"
+	@exit 1
+else
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef USETAR
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT)
+	cd $(PACKDIR) ; $(TARPROG) c$(TAROPT) --file $(DESTZIPDIR)/$(ZIPNAME)$(TAREXT) * ; cd $(BASEDIR)
+else
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT)
+	cd $(PACKDIR) ; $(ZIPPROG) -Dr $(ZIPOPT) $(DESTZIPDIR)/$(ZIPNAME)$(ZIPEXT) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+.PHONY:  fpc_zipsourceinstall
+
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall PACKAGESUFFIX=src
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+
+ifdef EXTRACLEANUNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
+endif
+
+ifdef CLEANPPUFILES
+ifdef PPUFILES
+CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
+endif
+endif
+
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(CLEANRSTFILES)
+endif
+ifdef EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+
+fpc_distclean: fpc_clean
+
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+
+#####################################################################
+# Info rules
+#####################################################################
+
+.PHONY: fpc_info fpc_cfginfo fpc_objectinfo fpc_toolsinfo fpc_installinfo \
+	fpc_dirinfo
+
+fpc_info: $(INFOTARGET)
+
+fpc_infocfg:
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC....... $(FPC)
+	@$(ECHO)  Version... $(FPC_VERSION)
+	@$(ECHO)  CPU....... $(CPU_TARGET)
+	@$(ECHO)  Source.... $(OS_SOURCE)
+	@$(ECHO)  Target.... $(OS_TARGET)
+	@$(ECHO)
+
+fpc_infoobjects:
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  LoaderObjects..... $(LOADEROBJECTS)
+	@$(ECHO)  UnitObjects....... $(UNITOBJECTS)
+	@$(ECHO)  ExeObjects........ $(EXEOBJECTS)
+	@$(ECHO)
+	@$(ECHO)  ExtraCleanUnits... $(EXTRACLEANUNITS)
+	@$(ECHO)  ExtraCleanFiles... $(EXTRACLEANFILES)
+	@$(ECHO)
+	@$(ECHO)  ExtraInstallUnits. $(EXTRAINSTALLUNITS)
+	@$(ECHO)  ExtraInstallFiles. $(EXTRAINSTALLFILES)
+	@$(ECHO)
+
+fpc_infoinstall:
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+ifdef DATE
+	@$(ECHO)  DateStr.............. $(DATESTR)
+endif
+ifdef PACKAGEPREFIX
+	@$(ECHO)  PackagePrefix........ $(PACKAGEPREFIX)
+endif
+ifdef PACKAGENAME
+	@$(ECHO)  PackageName.......... $(PACKAGENAME)
+endif
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)  DataInstallDir....... $(DATAINSTALLDIR)
+	@$(ECHO)
+	@$(ECHO)  DestZipDir........... $(DESTZIPDIR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)
+
+#####################################################################
+# Local Makefile
+#####################################################################
+
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+
+#####################################################################
+# Users rules
+#####################################################################
+
+.PHONY: all_units linuxd w32d w32s
+
+all_units: linuxd w32d w32s
+
+linuxd: c_gen$(EXEEXT) ogl_lind.gen
+	c_gen ogl_lind.gen
+
+w32d: c_gen$(EXEEXT) ogl_w32d.gen
+	c_gen ogl_w32d.gen
+
+w32s: c_gen$(EXEEXT) ogl_w32s.gen
+	c_gen ogl_w32s.gen

+ 31 - 0
packages/opengl/build2/Makefile.fpc

@@ -0,0 +1,31 @@
+#
+#   Makefile.fpc for auto generation of OpenGL units
+#
+
+[targets]
+units=buildgl
+programs=c_gen
+
+[require]
+packages=fcl
+
+[dirs]
+fpcdir=../../..
+
+[defaults]
+defaultrule=all_units
+
+[rules]
+.PHONY: all_units linuxd w32d w32s
+
+all_units: linuxd w32d w32s
+
+linuxd: c_gen$(EXEEXT) ogl_lind.gen
+	c_gen ogl_lind.gen
+
+w32d: c_gen$(EXEEXT) ogl_w32d.gen
+	c_gen ogl_w32d.gen
+
+w32s: c_gen$(EXEEXT) ogl_w32s.gen
+	c_gen ogl_w32s.gen
+

+ 77 - 0
packages/opengl/build2/buildgl.pp

@@ -0,0 +1,77 @@
+{
+  $Id$
+
+  GL unit creation tool helpers
+  (c) 1999 Sebastian Guenther, [email protected]
+}
+
+{$MODE objfpc}
+{$H+}
+
+unit buildgl;
+
+interface
+uses SysUtils, Classes;
+
+type
+
+  TDefReader = class
+  protected
+    FInterfaceBlock, FProcs: TStringList;
+  public
+    constructor Create(const Filename: String);
+    property InterfaceBlock: TStringList read FInterfaceBlock;
+    property Procs: TStringList read FProcs;
+  end;
+
+
+implementation
+
+
+constructor TDefReader.Create(const Filename: String);
+type
+  TCurState = (stateNothing, stateCopyInterface, stateProcs);
+var
+  f: Text;
+  s: String;
+  state: TCurState;
+begin
+  state := stateNothing;
+  FInterfaceBlock := TStringList.Create;
+  FProcs := TStringList.Create;
+
+  Assign(f, Filename);
+  Reset(f);
+  while not EOF(f) do begin
+    ReadLn(f, s);
+    if Copy(s, 1, 1) = '#' then continue;  // Skip comments
+    if s = '%COPY_INTERFACE' then
+      state := stateCopyInterface
+    else if s = '%PROCS' then
+      state := stateProcs
+    else if s = '%END' then
+      state := stateNothing
+    else
+      case state of
+        stateCopyInterface: InterfaceBlock.Add(s);
+        stateProcs: Procs.Add(s);
+      end;
+  end;
+  Close(f);
+end;
+
+end.
+
+
+{
+  $Log$
+  Revision 1.1  2000-05-26 09:22:39  alex
+  universal cross platform unit file generator
+
+  Revision 1.1  1999/12/23 13:51:50  peter
+    * reorganized, it now doesn't depend on fcl anymore by default
+
+  Revision 1.1  1999/11/28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+}

+ 572 - 0
packages/opengl/build2/c_gen.pp

@@ -0,0 +1,572 @@
+{
+  unit generation tool
+  (C) 2000 Alexander Stohr, [email protected]
+  based upon the linux dynamic tool from Sebastian Guenther
+  with latest version "1.1 1999/12/23 13:51:50 peter"
+}
+
+{$MODE objfpc}
+{$H-}   { use normal strings }
+(* do not enable! fpc bug with H+ *)
+
+program c_gen;
+
+uses
+  SysUtils,
+  Classes,
+  buildgl;
+
+// =====================================================================
+
+type
+  ptDefFile     = ^tDefFile;
+  tDefFile      = record
+                    Name        : String;
+                    DefFile     : TDefReader;
+                    pNext       : ptDefFile;
+                  end;
+
+  ptSectionKey  = ^tSectionKey;
+  tSectionKey   = record
+                    Keyword     : String;
+                    Rule        : DWord;
+                    pDefFile    : ptDefFile;
+                    Option2     : String;
+                    pNext       : ptSectionKey;
+                  end;
+
+// =====================================================================
+
+const
+  verbose       = 0;    // change this for debugging
+
+const
+  ST_NONE       = 0;
+  ST_COMMON     = 1;
+  ST_FILE       = 2;
+
+  RULE_IG       = 0;
+  RULE_TX       = 1;
+  RULE_IF       = 2;
+  RULE_PD       = 3;
+  RULE_PL       = 4;
+  RULE_PS       = 5;
+
+// =====================================================================
+// global vars
+
+var
+  ReturnVal     : Word;
+
+  pSectionKey   : ptSectionKey;
+  pAllDefFile   : ptDefFile;
+
+  ToolName      : String;
+  TargetText    : String;
+  TargetDir     : String;
+
+  SectionType   : DWord;
+  SectionName   : String;
+
+  TemplateName  : String;
+
+// =====================================================================
+
+procedure StripSpaces(var s : String);
+var
+  L : Byte;
+begin
+  // strip leading spaces
+  while (Pos(' ',s)=1) or (Pos(#8,s)=1) do
+    Delete(s,1,1);
+
+  // strip trailing spaces
+  L := Length(s);
+  while L<>0 do
+  begin
+    if (s[L]=' ') or (s[L]=#8) then
+    begin
+      Delete(s,L,1);
+      Dec(L);
+    end
+    else
+      L := 0;
+  end;
+end;
+
+function GetName(var s : String) : String;
+var
+  Name : String;
+  P    : Byte;
+begin
+  Name := s;
+  P := Pos(',',s);
+  if p>0 then
+  begin
+    Delete(s,1,P);
+    Delete(Name,P,255);
+  end
+  else
+    s := '';
+
+  StripSpaces(Name);
+
+{  WriteLn('GetName, reminder = ',Name,',',s); }
+
+  GetName := Name;
+end;
+
+function Name2Rule(Name : String) : DWord;
+begin
+  if Name='IG'
+  then Name2Rule := RULE_IG
+  else
+  if Name='TX'
+  then Name2Rule := RULE_TX
+  else
+  if Name='IF'
+  then Name2Rule := RULE_IF
+  else
+  if Name='PD'
+  then Name2Rule := RULE_PD
+  else
+  if Name='PL'
+  then Name2Rule := RULE_PL
+  else
+  if Name='PS'
+  then Name2Rule := RULE_PS
+  else
+  begin
+    Name2Rule := RULE_IG;
+    WriteLn('error - unknown rule: ',Name);
+    ReturnVal := 1;
+  end;
+end;
+
+function AddDefFile(Name : String) : ptDefFile;
+var
+  pDefFile : ptDefFile;
+  pSearch  : ptDefFile;
+begin
+  pDefFile := NIL;
+
+  // search if file is already loaded
+  if pAllDefFile<>NIL then
+  begin
+    pSearch := pAllDefFile;
+    while pSearch<>NIL do
+    begin
+      if pSearch^.Name = Name then
+      begin
+        pDefFile := pSearch;
+        pSearch := NIL;
+      end
+      else
+        pSearch := pSearch^.pNext;
+    end;
+  end;
+
+  // create new file if its not loaded
+  if pDefFile = NIL then
+  begin
+    New(pDefFile);
+
+    pDefFile^.Name := Name;
+    pDefFile^.DefFile := TDefReader.Create(Name);
+    pDefFile^.pNext := pAllDefFile;     // chain in as first member
+
+    pAllDefFile := pDefFile;
+  end;
+
+  AddDefFile := pDefFile;
+end;
+
+procedure AddSectionKey(s : string);
+var
+  pKey : ptSectionKey;
+  t : string;
+begin
+  New(pKey);
+
+  pKey^.Keyword  := GetName(s);
+  pKey^.Rule     := Name2Rule(GetName(s));
+  pKey^.pDefFile := AddDefFile(GetName(s));
+  t := GetName(s);
+  pKey^.Option2  := t;
+  pKey^.pNext    := pSectionKey; // chain in as first member
+
+  pSectionKey   := pKey;
+end;
+
+function GetSectionKey(s : string) : ptSectionKey;
+var
+  pSearch : ptSectionKey;
+begin
+  GetSectionKey := NIL;
+
+  pSearch := pSectionKey;
+  while pSearch<>NIL do
+  begin
+    if pSearch^.Keyword = s then
+    begin
+      GetSectionKey := pSearch;
+      pSearch := NIL;
+    end
+    else pSearch := pSearch^.pNext;
+  end;
+end;
+
+procedure FreeSectionKeys;
+var
+  pSearch, pNext : ptSectionKey;
+begin
+  pSearch := pSectionKey;
+  while pSearch<>NIL do
+  begin
+    pNext := pSearch^.pNext;
+    Dispose(pSearch);
+    pSearch := pNext;
+  end;
+  pSectionKey := pSearch;
+end;
+
+// =====================================================================
+
+procedure ResetCommonSecData;
+begin
+  ToolName   := 'BuildTool';
+  TargetText := 'unknown';
+  TargetDir  := '.\';
+end;
+
+procedure ResetFileSecData;
+begin
+  FreeSectionKeys;
+  TemplateName := '';
+end;
+
+procedure InitGlobals;
+begin
+  ReturnVal := 0;
+
+  SectionType := ST_NONE;
+  pSectionKey := NIL;
+  pAllDefFile := NIL;
+
+  ResetCommonSecData;
+  ResetFileSecData;
+end;
+
+// =====================================================================
+
+procedure PrintInterface(var dest: Text; lines: TStringList);
+var
+  i: Integer;
+begin
+  for i := 0 to lines.Count - 1 do
+    WriteLn(dest, lines.Strings[i]);
+end;
+
+procedure PrintProcDecls(var dest: Text; procs: TStringList; const Modifier : String);
+var
+  i, j: Integer;
+  s: String;
+begin
+  for i := 0 to procs.Count - 1 do
+  begin
+    s := procs.Strings[i];
+    j := Pos('//', s);
+    if (Length(s) = 0) or ((j > 0) and (Trim(s)[1] = '/')) then
+      WriteLn(dest, s)
+    else if j = 0 then
+      WriteLn(dest, s, ' ',Modifier)
+    else
+      WriteLn(dest, TrimRight(Copy(s, 1, j-1)),
+        ' ',Modifier,' ', Copy(s, j, Length(s)) );
+  end;
+end;
+
+procedure PrintProcLoaders(var dest: Text; procs: TStringList; const libname: String);
+var
+  i, j: Integer;
+  s: String;
+begin
+  for i := 0 to procs.Count - 1 do
+  begin
+    s := Trim(procs.Strings[i]);
+    j := Pos(':', s);
+    s := Trim(Copy(s, 1, j - 1));
+    if (Length(s) = 0) or (Pos('//', s) > 0) then continue;
+    WriteLn(dest, '  ', s, ' := GetProc(', libname, ', ''', s, ''');');
+  end;
+end;
+
+procedure PrintProcStatic(var dest: Text; procs: TStringList; const Modifier: String);
+var
+  i, j: Integer;
+  s: String;
+  t: String;
+begin
+  for i := 0 to procs.Count - 1 do
+  begin
+    s := procs.Strings[i];
+    j := Pos('//', s);
+    if (Length(s) = 0) or ((j > 0) and (Trim(s)[1] = '/')) then
+      WriteLn(dest, s)
+    else
+    begin
+      // swap order of leading symbols and remove ':'
+      t := Trim(procs.Strings[i]);
+      j := Pos(':', s);
+      t := Trim(Copy(t, 1, j - 1));
+
+      Delete(s,1,j);
+      s := Trim(s);
+
+      j := Pos('(', s);
+      Insert(t,s,j);
+      Insert(' ',s,j);
+
+      j := Pos('//', s);
+      if j = 0 then
+        WriteLn(dest, s, ' ',Modifier)
+      else
+        WriteLn(dest, TrimRight(Copy(s, 1, j-1)),
+          ' ',Modifier,' ', Copy(s, j, Length(s)) );
+    end;
+
+  end;
+end;
+
+procedure PrintCVSLogSection(var dest: Text);
+begin
+  WriteLn(dest);
+  WriteLn(dest);
+  WriteLn(dest, '{');
+  WriteLn(dest, '  $', 'Log:$');  // needed because _this_ file might be in CVS, too
+  WriteLn(dest, '}');
+end;
+
+// =====================================================================
+
+procedure ProcessFileSection;
+var
+  f             : Text;
+  tpl           : Text;
+  s             : String;
+{  j             : Integer; }
+  tmp           : String;
+  pKey          : ptSectionKey;
+begin
+  WriteLn('Generating "',TargetDir+SectionName,'" ...');
+
+  Assign(f, TargetDir+SectionName);
+  Rewrite(f);
+
+  Assign(tpl, TemplateName);
+  Reset(tpl);
+
+  while not EOF(tpl) do
+  begin
+    ReadLn(tpl, s);
+    if Copy(s, 1, 1) = '%' then
+    begin
+      tmp := Copy(s,2,255);
+      StripSpaces(tmp);
+
+      pKey := GetSectionKey(tmp);
+
+      if pKey=NIL then
+      begin
+        WriteLn(f, '// ### ',ToolName,': Don''t know what to insert here!: ', s);
+        WriteLn('error - unknown keyword: ',tmp);
+        ReturnVal := 1;
+      end
+      else
+      begin
+        case pKey^.Rule of
+          RULE_IG : { ignore };
+          RULE_TX : { todo };
+          RULE_IF : PrintInterface(f, pKey^.pDefFile^.DefFile.InterfaceBlock);
+          RULE_PD : PrintProcDecls(f, pKey^.pDefFile^.DefFile.Procs,
+                      pKey^.Option2);
+          RULE_PL : PrintProcLoaders(f, pKey^.pDefFile^.DefFile.Procs,
+                      pKey^.Option2);
+          RULE_PS : PrintProcStatic(f, pKey^.pDefFile^.DefFile.Procs,
+                      pKey^.Option2);
+        end;
+      end;
+    end
+    else
+    begin
+      if Copy(s, 1, 1) <> '#'
+      then WriteLn(f, s);
+    end;
+  end;
+  PrintCVSLogSection(f);
+  Close(f);
+
+(*
+    if Copy(s, 1, 1) <> '#' then
+      begin
+      j := Pos('#extdecl', s);
+      if j = 0 then
+        WriteLn(f, s)
+      else
+        WriteLn(f, Copy(s, 1, j - 1), 'cdecl', Copy(s, j + 8, Length(s)));
+    end;
+*)
+
+end;
+
+procedure ProcessCommonSection;
+begin
+  if verbose>0 then
+  begin
+    WriteLn('common section:');
+    WriteLn('  ToolName   = ',ToolName);
+    WriteLn('  TargetText = ',TargetText);
+    WriteLn('  TargetDir  = ',TargetDir);
+  end;
+end;
+
+// =====================================================================
+
+procedure SectionComplete;
+begin
+  if ReturnVal=0 then { if we are error free }
+  case SectionType of
+    ST_NONE :
+      begin
+        // ignore
+      end;
+    ST_COMMON :
+      begin
+        ProcessCommonSection;
+      end;
+    ST_FILE :
+      begin
+        ProcessFileSection();
+      end;
+  end;
+end;
+
+var
+  hFGen         : Text;
+  Line          : String;
+  KeyName       : String;
+  KeyValue      : String;
+
+begin
+  InitGlobals;
+
+  WriteLn('File Generator Tool for OpenGL related Units');
+
+  if ParamCount<>1 then
+  begin
+    WriteLn('specify a generator file as parameter 1');
+    Halt(1);
+  end;
+
+  // Open Generation File
+  Assign(hFGen,ParamStr(1));
+  Reset(hFGen);
+
+  while Not(EOF(hFGen)) do
+  begin
+    ReadLn(hFGen,Line);
+    if Length(Line)>0 then
+    begin
+      if Line[1]='[' then
+      begin
+        // its a new section
+        SectionComplete;        // close previous section
+
+        Delete(Line,Pos(']',Line),255);
+        SectionName := Copy(Line,2,255);
+
+        if verbose>0 then
+          WriteLn('SectionName = ',SectionName);
+
+        if SectionName='common' then
+        begin
+          SectionType := ST_COMMON;
+          ResetCommonSecData;
+        end
+        else
+        begin
+          SectionType := ST_FILE;
+          ResetFileSecData;
+        end;
+      end
+      else
+      if Pos(Line[1],'#*;''')<>0 then
+      begin
+        // just a comment - ignore
+      end
+      else
+      begin
+        // its a key in the section
+        KeyName := Line;
+        KeyValue := Line;
+
+        Delete(KeyName,Pos('=',KeyName),255);
+        Delete(KeyValue,1,Pos('=',KeyValue));
+
+        StripSpaces(KeyName);
+        StripSpaces(KeyValue);
+
+//        WriteLn('KeyName  = ',KeyName);
+//        WriteLn('KeyValue = ',KeyValue);
+
+        case SectionType of
+          ST_COMMON :
+            begin
+              if KeyName='TOOL_NAME'
+              then ToolName := KeyValue
+              else
+              if KeyName='TARGET_TEXT'
+              then TargetText := KeyValue
+              else
+              if KeyName='TARGET_DIR'
+              then TargetDir := KeyValue
+              else
+              begin
+                WriteLn('error in script file - inside common section');
+                WriteLn('key line: ',Line);
+                ReturnVal := 1;
+              end;
+            end;
+          ST_FILE :
+            begin
+              if KeyName='TEMPLATE'
+              then TemplateName := KeyValue
+              else
+              if KeyName='KEY'
+              then AddSectionKey(KeyValue)
+              else
+              begin
+                WriteLn('error in script file - inside file section');
+                WriteLn('key line: ',Line);
+                ReturnVal := 1;
+              end;
+            end;
+          ELSE
+            begin
+              WriteLn('error in script file - not in a section');
+              WriteLn('key line: ',Line);
+              ReturnVal := 1;
+            end;
+        end;
+      end
+    end;
+  end;
+
+  SectionComplete;      // close last section
+
+  Close(hFGen);
+
+  WriteLn('Done...');
+
+  Halt(ReturnVal);
+end.

+ 141 - 0
packages/opengl/build2/gl_linux.tem

@@ -0,0 +1,141 @@
+{
+  $Id$
+  Translation of the Mesa GL, GLU and GLX headers for Free Pascal
+  Linux Version, Copyright (C) 1999 Sebastian Guenther
+
+
+  Mesa 3-D graphics library
+  Version:  3.0
+  Copyright (C) 1995-1998  Brian Paul
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library 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
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+}
+
+{$MODE delphi}  // objfpc would not work because of direct proc var assignments
+
+unit GL;
+
+interface
+uses X,XLib,XUtil;
+
+// ===================================================================
+//   Unit specific extensions
+// ===================================================================
+
+function InitGLFromLibrary(libname: PChar): Boolean;
+function InitGLUFromLibrary(libname: PChar): Boolean;
+// Requires that the GL library has already been initialized:
+function InitGLX: Boolean;
+
+// determines automatically which libraries to use:
+function InitGL: Boolean;
+function InitGLU: Boolean;
+
+
+var
+  GLInitialized, GLUInitialized, GLXInitialized: Boolean;
+
+%GLDeclsIF
+%GLProcsPD
+
+%GLExtDeclsIF
+%GLExtProcsPD
+
+%GLUDeclsIF
+%GLUProcsPD
+
+%GLXDeclsIF
+%GLXProcsPD
+
+
+// ===================================================================
+// ===================================================================
+
+implementation
+
+{$LINKLIB m}
+
+function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlclose(handle: Pointer): LongInt; external 'dl';
+function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+
+function LoadLibrary(name: PChar): Pointer;
+begin
+  Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
+end;
+
+function GetProc(handle: Pointer; name: PChar): Pointer;
+begin
+  Result := dlsym(handle, name);
+  if Result = nil then WriteLn('Unresolved: ', name);
+end;
+
+var
+  libGL, libGLU, libGLX: Pointer;
+
+function InitGLFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGL := LoadLibrary(libname);
+  if not Assigned(libGL) then exit;
+
+%GLProcsPL
+#  // Extensions:
+#%GLExtProcs2
+
+  GLInitialized := True;
+  Result := True;
+end;
+
+function InitGLUFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLU := LoadLibrary(libname);
+  if not Assigned(libGLU) then exit;
+
+%GLUProcsPL
+
+  GLUInitialized := True;
+  Result := True;
+end;
+
+function InitGLX: Boolean;
+begin
+  Result := False;
+  if not Assigned(libGL) then exit;
+
+%GLXProcsPL
+
+  GLXInitialized := True;
+  Result := True;
+end;
+
+function InitGL: Boolean;
+begin
+  Result := InitGLFromLibrary('libGL.so.1') or InitGLFromLibrary('libMesaGL.so.1');
+end;
+
+function InitGLU: Boolean;
+begin
+  Result := InitGLUFromLibrary('libGLU.so.1') or InitGLUFromLibrary('libMesaGLU.so.1');
+end;
+
+
+
+finalization
+  if Assigned(libGL)  then dlclose(libGL);
+  if Assigned(libGLU) then dlclose(libGLU);
+  if Assigned(libGLX) then dlclose(libGLX);
+end.

+ 1810 - 0
packages/opengl/build2/gl_w32d.tem

@@ -0,0 +1,1810 @@
+{
+  $Id$
+
+  Translation of the Mesa GL headers for FreePascal
+  Copyright (C) 1999 Sebastian Guenther
+
+
+  Mesa 3-D graphics library
+  Version:  3.0
+  Copyright (C) 1995-1998  Brian Paul
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+    
+  This library 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
+  Library General Public License for more details.
+    
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+}
+
+{$MODE delphi}	// objfpc would not work because of direct proc var assignments
+
+{You have to enable Macros (compiler switch "-Sm") for compiling this unit!
+ This is necessary for supporting different platforms with different calling
+ conventions via a single unit.}
+
+unit GL;
+
+interface
+
+{x$DEFINE MESA} {enable if you want to use some special mesa extensions}
+
+{$IFDEF Linux}
+  {$DEFINE gldecl := cdecl}
+  uses XLib;
+{$ELSE}
+  {$IFDEF Win32}
+    {$DEFINE ogl_dll := external 'opengl32.dll'}
+    uses Windows;
+  {$ELSE}
+    {$MESSAGE Unsupported platform.}
+  {$ENDIF}
+{$ENDIF}
+
+
+// =======================================================
+//   Unit specific extensions
+// =======================================================
+
+function InitGLFromLibrary(libname: PChar): Boolean;
+
+// determines automatically which libraries to use:
+function InitGL: Boolean;
+
+
+var
+  GLInitialized: Boolean;
+
+
+// =======================================================
+//   GL consts, types and functions
+// =======================================================
+
+
+// -------------------------------------------------------
+//   GL types
+// -------------------------------------------------------
+
+type
+
+  PSingle = ^Single;
+  PDouble = ^Double;
+
+  GLclampf = Single;	// single precision float in [0,1]
+  GLclampd = Double;	// double precision float in [0,1]
+
+  GLenum = Integer;
+
+type
+  GLbitfield = set of (GL_CURRENT_BIT, GL_POINT_BIT, GL_LINE_BIT,
+    GL_POLYGON_BIT, GL_POLYGON_STIPPLE_BIT, GL_PIXEL_MODE_BIT,
+    GL_LIGHTING_BIT, GL_FOG_BIT, GL_DEPTH_BUFFER_BIT, GL_ACCUM_BUFFER_BIT,
+    GL_STENCIL_BUFFER_BIT, GL_VIEWPORT_BIT, GL_TRANSFORM_BIT, GL_ENABLE_BIT,
+    GL_COLOR_BUFFER_BIT, GL_HINT_BIT, GL_EVAL_BIT, GL_LIST_BIT, GL_TEXTURE_BIT,
+    GL_SCISSOR_BIT);
+
+const
+  GL_ALL_ATTRIB_BITS = [Low(GLbitfield)..High(GLbitfield)];
+
+
+// -------------------------------------------------------
+//   GL constants
+// -------------------------------------------------------
+
+const
+  GL_NO_ERROR				= 0;
+
+  // Boolean values
+  GL_FALSE 				= 0;
+  GL_TRUE  				= 1;
+
+  // Data types 
+  GL_BYTE           			= $1400;
+  GL_UNSIGNED_BYTE  			= $1401;
+  GL_SHORT          			= $1402;
+  GL_UNSIGNED_SHORT 			= $1403;
+  GL_INT            			= $1404;
+  GL_UNSIGNED_INT  			= $1405;
+  GL_FLOAT          			= $1406;
+  GL_DOUBLE         			= $140A;
+  GL_2_BYTES       			= $1407;
+  GL_3_BYTES        			= $1408;
+  GL_4_BYTES        			= $1409;
+
+  // Primitives
+  GL_LINES          			= $0001;
+  GL_POINTS         			= $0000;
+  GL_LINE_STRIP     			= $0003;
+  GL_LINE_LOOP      			= $0002;
+  GL_TRIANGLES      			= $0004;
+  GL_TRIANGLE_STRIP 			= $0005;
+  GL_TRIANGLE_FAN   			= $0006;
+  GL_QUADS          			= $0007;
+  GL_QUAD_STRIP     			= $0008;
+  GL_POLYGON        			= $0009;
+  GL_EDGE_FLAG      			= $0B43;
+
+  // Vertex arrays
+  GL_VERTEX_ARRAY			= $8074;
+  GL_NORMAL_ARRAY			= $8075;
+  GL_COLOR_ARRAY			= $8076;
+  GL_INDEX_ARRAY			= $8077;
+  GL_TEXTURE_COORD_ARRAY		= $8078;
+  GL_EDGE_FLAG_ARRAY			= $8079;
+  GL_VERTEX_ARRAY_SIZE			= $807A;
+  GL_VERTEX_ARRAY_TYPE			= $807B;
+  GL_VERTEX_ARRAY_STRIDE		= $807C;
+  GL_NORMAL_ARRAY_TYPE			= $807E;
+  GL_NORMAL_ARRAY_STRIDE		= $807F;
+  GL_COLOR_ARRAY_SIZE			= $8081;
+  GL_COLOR_ARRAY_TYPE			= $8082;
+  GL_COLOR_ARRAY_STRIDE			= $8083;
+  GL_INDEX_ARRAY_TYPE			= $8085;
+  GL_INDEX_ARRAY_STRIDE			= $8086;
+  GL_TEXTURE_COORD_ARRAY_SIZE		= $8088;
+  GL_TEXTURE_COORD_ARRAY_TYPE		= $8089;
+  GL_TEXTURE_COORD_ARRAY_STRIDE		= $808A;
+  GL_EDGE_FLAG_ARRAY_STRIDE		= $808C;
+  GL_VERTEX_ARRAY_POINTER		= $808E;
+  GL_NORMAL_ARRAY_POINTER		= $808F;
+  GL_COLOR_ARRAY_POINTER		= $8090;
+  GL_INDEX_ARRAY_POINTER		= $8091;
+  GL_TEXTURE_COORD_ARRAY_POINTER	= $8092;
+  GL_EDGE_FLAG_ARRAY_POINTER		= $8093;
+  GL_V2F				= $2A20;
+  GL_V3F				= $2A21;
+  GL_C4UB_V2F				= $2A22;
+  GL_C4UB_V3F				= $2A23;
+  GL_C3F_V3F				= $2A24;
+  GL_N3F_V3F				= $2A25;
+  GL_C4F_N3F_V3F			= $2A26;
+  GL_T2F_V3F				= $2A27;
+  GL_T4F_V4F				= $2A28;
+  GL_T2F_C4UB_V3F			= $2A29;
+  GL_T2F_C3F_V3F			= $2A2A;
+  GL_T2F_N3F_V3F			= $2A2B;
+  GL_T2F_C4F_N3F_V3F			= $2A2C;
+  GL_T4F_C4F_N3F_V4F			= $2A2D;
+
+  // Matrix Mode
+  GL_MATRIX_MODE			= $0BA0;
+  GL_MODELVIEW  			= $1700;
+  GL_PROJECTION 			= $1701;
+  GL_TEXTURE    			= $1702;
+
+  // Points
+  GL_POINT_SMOOTH			= $0B10;
+  GL_POINT_SIZE				= $0B11;
+  GL_POINT_SIZE_GRANULARITY 		= $0B13;
+  GL_POINT_SIZE_RANGE			= $0B12;
+
+  // Lines
+  GL_LINE_SMOOTH			= $0B20;
+  GL_LINE_STIPPLE			= $0B24;
+  GL_LINE_STIPPLE_PATTERN		= $0B25;
+  GL_LINE_STIPPLE_REPEAT		= $0B26;
+  GL_LINE_WIDTH				= $0B21;
+  GL_LINE_WIDTH_GRANULARITY		= $0B23;
+  GL_LINE_WIDTH_RANGE			= $0B22;
+
+  // Polygons
+  GL_POINT                 		= $1B00;
+  GL_LINE                  		= $1B01;
+  GL_FILL                  		= $1B02;
+  GL_CCW                   		= $0901;
+  GL_CW                    		= $0900;
+  GL_FRONT                 		= $0404;
+  GL_BACK                  		= $0405;
+  GL_CULL_FACE             		= $0B44;
+  GL_CULL_FACE_MODE        		= $0B45;
+  GL_POLYGON_SMOOTH        		= $0B41;
+  GL_POLYGON_STIPPLE       		= $0B42;
+  GL_FRONT_FACE            		= $0B46;
+  GL_POLYGON_MODE          		= $0B40;
+  GL_POLYGON_OFFSET_FACTOR 		= $8038;
+  GL_POLYGON_OFFSET_UNITS  		= $2A00;
+  GL_POLYGON_OFFSET_POINT  		= $2A01;
+  GL_POLYGON_OFFSET_LINE   		= $2A02;
+  GL_POLYGON_OFFSET_FILL   		= $8037;
+
+  // Display lists
+  GL_COMPILE				= $1300;
+  GL_COMPILE_AND_EXECUTE		= $1301;
+  GL_LIST_BASE				= $0B32;
+  GL_LIST_INDEX				= $0B33;
+  GL_LIST_MODE				= $0B30;
+
+  // Depth buffer
+  GL_NEVER             			= $0200;
+  GL_LESS              			= $0201;
+  GL_GEQUAL            			= $0206;
+  GL_LEQUAL            			= $0203;
+  GL_GREATER           			= $0204;
+  GL_NOTEQUAL          			= $0205;
+  GL_EQUAL             			= $0202;
+  GL_ALWAYS            			= $0207;
+  GL_DEPTH_TEST        			= $0B71;
+  GL_DEPTH_BITS        			= $0D56;
+  GL_DEPTH_CLEAR_VALUE 			= $0B73;
+  GL_DEPTH_FUNC        			= $0B74;
+  GL_DEPTH_RANGE       			= $0B70;
+  GL_DEPTH_WRITEMASK   			= $0B72;
+  GL_DEPTH_COMPONENT   			= $1902;
+
+  // Lighting
+  GL_LIGHTING				= $0B50;
+  GL_LIGHT0				= $4000;
+  GL_LIGHT1				= $4001;
+  GL_LIGHT2				= $4002;
+  GL_LIGHT3				= $4003;
+  GL_LIGHT4				= $4004;
+  GL_LIGHT5				= $4005;
+  GL_LIGHT6				= $4006;
+  GL_LIGHT7				= $4007;
+  GL_SPOT_EXPONENT			= $1205;
+  GL_SPOT_CUTOFF			= $1206;
+  GL_CONSTANT_ATTENUATION		= $1207;
+  GL_LINEAR_ATTENUATION			= $1208;
+  GL_QUADRATIC_ATTENUATION		= $1209;
+  GL_AMBIENT				= $1200;
+  GL_DIFFUSE				= $1201;
+  GL_SPECULAR				= $1202;
+  GL_SHININESS				= $1601;
+  GL_EMISSION				= $1600;
+  GL_POSITION				= $1203;
+  GL_SPOT_DIRECTION			= $1204;
+  GL_AMBIENT_AND_DIFFUSE		= $1602;
+  GL_COLOR_INDEXES			= $1603;
+  GL_LIGHT_MODEL_TWO_SIDE		= $0B52;
+  GL_LIGHT_MODEL_LOCAL_VIEWER		= $0B51;
+  GL_LIGHT_MODEL_AMBIENT		= $0B53;
+  GL_FRONT_AND_BACK			= $0408;
+  GL_SHADE_MODEL			= $0B54;
+  GL_FLAT				= $1D00;
+  GL_SMOOTH				= $1D01;
+  GL_COLOR_MATERIAL			= $0B57;
+  GL_COLOR_MATERIAL_FACE		= $0B55;
+  GL_COLOR_MATERIAL_PARAMETER		= $0B56;
+  GL_NORMALIZE				= $0BA1;
+
+  // User clipping planes
+  GL_CLIP_PLANE0			= $3000;
+  GL_CLIP_PLANE1			= $3001;
+  GL_CLIP_PLANE2			= $3002;
+  GL_CLIP_PLANE3			= $3003;
+  GL_CLIP_PLANE4			= $3004;
+  GL_CLIP_PLANE5			= $3005;
+
+  // Accumulation buffer
+  GL_ACCUM_RED_BITS			= $0D58;
+  GL_ACCUM_GREEN_BITS			= $0D59;
+  GL_ACCUM_BLUE_BITS			= $0D5A;
+  GL_ACCUM_ALPHA_BITS			= $0D5B;
+  GL_ACCUM_CLEAR_VALUE			= $0B80;
+  GL_ACCUM				= $0100;
+  GL_ADD				= $0104;
+  GL_LOAD				= $0101;
+  GL_MULT				= $0103;
+  GL_RETURN				= $0102;
+
+  // Alpha testing
+  GL_ALPHA_TEST				= $0BC0;
+  GL_ALPHA_TEST_REF			= $0BC2;
+  GL_ALPHA_TEST_FUNC			= $0BC1;
+
+  // Blending
+  GL_BLEND				= $0BE2;
+  GL_BLEND_SRC				= $0BE1;
+  GL_BLEND_DST				= $0BE0;
+  GL_ZERO				= 0;
+  GL_ONE				= 1;
+  GL_SRC_COLOR				= $0300;
+  GL_ONE_MINUS_SRC_COLOR		= $0301;
+  GL_DST_COLOR				= $0306;
+  GL_ONE_MINUS_DST_COLOR		= $0307;
+  GL_SRC_ALPHA				= $0302;
+  GL_ONE_MINUS_SRC_ALPHA		= $0303;
+  GL_DST_ALPHA				= $0304;
+  GL_ONE_MINUS_DST_ALPHA		= $0305;
+  GL_SRC_ALPHA_SATURATE			= $0308;
+  GL_CONSTANT_COLOR			= $8001;
+  GL_ONE_MINUS_CONSTANT_COLOR		= $8002;
+  GL_CONSTANT_ALPHA			= $8003;
+  GL_ONE_MINUS_CONSTANT_ALPHA		= $8004;
+
+  // Render mode
+  GL_FEEDBACK				= $1C01;
+  GL_RENDER				= $1C00;
+  GL_SELECT				= $1C02;
+
+  // Feedback
+  GL_2D					= $0600;
+  GL_3D					= $0601;
+  GL_3D_COLOR				= $0602;
+  GL_3D_COLOR_TEXTURE			= $0603;
+  GL_4D_COLOR_TEXTURE			= $0604;
+  GL_POINT_TOKEN			= $0701;
+  GL_LINE_TOKEN				= $0702;
+  GL_LINE_RESET_TOKEN			= $0707;
+  GL_POLYGON_TOKEN			= $0703;
+  GL_BITMAP_TOKEN			= $0704;
+  GL_DRAW_PIXEL_TOKEN			= $0705;
+  GL_COPY_PIXEL_TOKEN			= $0706;
+  GL_PASS_THROUGH_TOKEN			= $0700;
+  GL_FEEDBACK_BUFFER_POINTER		= $0DF0;
+  GL_FEEDBACK_BUFFER_SIZE		= $0DF1;
+  GL_FEEDBACK_BUFFER_TYPE		= $0DF2;
+
+  // Selection
+  GL_SELECTION_BUFFER_POINTER		= $0DF3;
+  GL_SELECTION_BUFFER_SIZE		= $0DF4;
+
+  // Fog
+  GL_FOG				= $0B60;
+  GL_FOG_MODE				= $0B65;
+  GL_FOG_DENSITY			= $0B62;
+  GL_FOG_COLOR				= $0B66;
+  GL_FOG_INDEX				= $0B61;
+  GL_FOG_START				= $0B63;
+  GL_FOG_END				= $0B64;
+  GL_LINEAR				= $2601;
+  GL_EXP				= $0800;
+  GL_EXP2				= $0801;
+
+  // Logic ops
+  GL_LOGIC_OP				= $0BF1;
+  GL_INDEX_LOGIC_OP			= $0BF1;
+  GL_COLOR_LOGIC_OP			= $0BF2;
+  GL_LOGIC_OP_MODE			= $0BF0;
+  GL_CLEAR				= $1500;
+  GL_SET				= $150F;
+  GL_COPY				= $1503;
+  GL_COPY_INVERTED			= $150C;
+  GL_NOOP				= $1505;
+  GL_INVERT				= $150A;
+  GL_AND				= $1501;
+  GL_NAND				= $150E;
+  GL_OR					= $1507;
+  GL_NOR				= $1508;
+  GL_XOR				= $1506;
+  GL_EQUIV				= $1509;
+  GL_AND_REVERSE			= $1502;
+  GL_AND_INVERTED			= $1504;
+  GL_OR_REVERSE				= $150B;
+  GL_OR_INVERTED			= $150D;
+
+  // Stencil
+  GL_STENCIL_TEST			= $0B90;
+  GL_STENCIL_WRITEMASK			= $0B98;
+  GL_STENCIL_BITS			= $0D57;
+  GL_STENCIL_FUNC			= $0B92;
+  GL_STENCIL_VALUE_MASK			= $0B93;
+  GL_STENCIL_REF			= $0B97;
+  GL_STENCIL_FAIL			= $0B94;
+  GL_STENCIL_PASS_DEPTH_PASS		= $0B96;
+  GL_STENCIL_PASS_DEPTH_FAIL		= $0B95;
+  GL_STENCIL_CLEAR_VALUE		= $0B91;
+  GL_STENCIL_INDEX			= $1901;
+  GL_KEEP				= $1E00;
+  GL_REPLACE				= $1E01;
+  GL_INCR				= $1E02;
+  GL_DECR				= $1E03;
+
+  // Buffers, Pixel Drawing/Reading
+  GL_NONE				= 0;
+  GL_LEFT				= $0406;
+  GL_RIGHT				= $0407;
+  //GL_FRONT				= $0404;
+  //GL_BACK				= $0405;
+  //GL_FRONT_AND_BACK			= $0408;
+  GL_FRONT_LEFT				= $0400;
+  GL_FRONT_RIGHT			= $0401;
+  GL_BACK_LEFT				= $0402;
+  GL_BACK_RIGHT				= $0403;
+  GL_AUX0				= $0409;
+  GL_AUX1				= $040A;
+  GL_AUX2				= $040B;
+  GL_AUX3				= $040C;
+  GL_COLOR_INDEX			= $1900;
+  GL_RED				= $1903;
+  GL_GREEN				= $1904;
+  GL_BLUE				= $1905;
+  GL_ALPHA				= $1906;
+  GL_LUMINANCE				= $1909;
+  GL_LUMINANCE_ALPHA			= $190A;
+  GL_ALPHA_BITS				= $0D55;
+  GL_RED_BITS				= $0D52;
+  GL_GREEN_BITS				= $0D53;
+  GL_BLUE_BITS				= $0D54;
+  GL_INDEX_BITS				= $0D51;
+  GL_SUBPIXEL_BITS			= $0D50;
+  GL_AUX_BUFFERS			= $0C00;
+  GL_READ_BUFFER			= $0C02;
+  GL_DRAW_BUFFER			= $0C01;
+  GL_DOUBLEBUFFER			= $0C32;
+  GL_STEREO				= $0C33;
+  GL_BITMAP				= $1A00;
+  GL_COLOR				= $1800;
+  GL_DEPTH				= $1801;
+  GL_STENCIL				= $1802;
+  GL_DITHER				= $0BD0;
+  GL_RGB				= $1907;
+  GL_RGBA				= $1908;
+
+  // Implementation limits
+  GL_MAX_LIST_NESTING			= $0B31;
+  GL_MAX_ATTRIB_STACK_DEPTH		= $0D35;
+  GL_MAX_MODELVIEW_STACK_DEPTH		= $0D36;
+  GL_MAX_NAME_STACK_DEPTH		= $0D37;
+  GL_MAX_PROJECTION_STACK_DEPTH		= $0D38;
+  GL_MAX_TEXTURE_STACK_DEPTH		= $0D39;
+  GL_MAX_EVAL_ORDER			= $0D30;
+  GL_MAX_LIGHTS				= $0D31;
+  GL_MAX_CLIP_PLANES			= $0D32;
+  GL_MAX_TEXTURE_SIZE			= $0D33;
+  GL_MAX_PIXEL_MAP_TABLE		= $0D34;
+  GL_MAX_VIEWPORT_DIMS			= $0D3A;
+  GL_MAX_CLIENT_ATTRIB_STACK_DEPTH	= $0D3B;
+
+  // Gets
+  GL_ATTRIB_STACK_DEPTH			= $0BB0;
+  GL_CLIENT_ATTRIB_STACK_DEPTH		= $0BB1;
+  GL_COLOR_CLEAR_VALUE			= $0C22;
+  GL_COLOR_WRITEMASK			= $0C23;
+  GL_CURRENT_INDEX			= $0B01;
+  GL_CURRENT_COLOR			= $0B00;
+  GL_CURRENT_NORMAL			= $0B02;
+  GL_CURRENT_RASTER_COLOR		= $0B04;
+  GL_CURRENT_RASTER_DISTANCE		= $0B09;
+  GL_CURRENT_RASTER_INDEX		= $0B05;
+  GL_CURRENT_RASTER_POSITION		= $0B07;
+  GL_CURRENT_RASTER_TEXTURE_COORDS 	= $0B06;
+  GL_CURRENT_RASTER_POSITION_VALID 	= $0B08;
+  GL_CURRENT_TEXTURE_COORDS		= $0B03;
+  GL_INDEX_CLEAR_VALUE			= $0C20;
+  GL_INDEX_MODE				= $0C30;
+  GL_INDEX_WRITEMASK			= $0C21;
+  GL_MODELVIEW_MATRIX			= $0BA6;
+  GL_MODELVIEW_STACK_DEPTH		= $0BA3;
+  GL_NAME_STACK_DEPTH			= $0D70;
+  GL_PROJECTION_MATRIX			= $0BA7;
+  GL_PROJECTION_STACK_DEPTH		= $0BA4;
+  GL_RENDER_MODE			= $0C40;
+  GL_RGBA_MODE				= $0C31;
+  GL_TEXTURE_MATRIX			= $0BA8;
+  GL_TEXTURE_STACK_DEPTH		= $0BA5;
+  GL_VIEWPORT				= $0BA2;
+
+  // Evaluators
+  GL_AUTO_NORMAL			= $0D80;
+  GL_MAP1_COLOR_4			= $0D90;
+  GL_MAP1_GRID_DOMAIN			= $0DD0;
+  GL_MAP1_GRID_SEGMENTS			= $0DD1;
+  GL_MAP1_INDEX				= $0D91;
+  GL_MAP1_NORMAL			= $0D92;
+  GL_MAP1_TEXTURE_COORD_1		= $0D93;
+  GL_MAP1_TEXTURE_COORD_2		= $0D94;
+  GL_MAP1_TEXTURE_COORD_3		= $0D95;
+  GL_MAP1_TEXTURE_COORD_4		= $0D96;
+  GL_MAP1_VERTEX_3			= $0D97;
+  GL_MAP1_VERTEX_4			= $0D98;
+  GL_MAP2_COLOR_4			= $0DB0;
+  GL_MAP2_GRID_DOMAIN			= $0DD2;
+  GL_MAP2_GRID_SEGMENTS			= $0DD3;
+  GL_MAP2_INDEX				= $0DB1;
+  GL_MAP2_NORMAL			= $0DB2;
+  GL_MAP2_TEXTURE_COORD_1		= $0DB3;
+  GL_MAP2_TEXTURE_COORD_2		= $0DB4;
+  GL_MAP2_TEXTURE_COORD_3		= $0DB5;
+  GL_MAP2_TEXTURE_COORD_4		= $0DB6;
+  GL_MAP2_VERTEX_3			= $0DB7;
+  GL_MAP2_VERTEX_4			= $0DB8;
+  GL_COEFF				= $0A00;
+  GL_DOMAIN				= $0A02;
+  GL_ORDER				= $0A01;
+
+  // Hints
+  GL_FOG_HINT				= $0C54;
+  GL_LINE_SMOOTH_HINT			= $0C52;
+  GL_PERSPECTIVE_CORRECTION_HINT	= $0C50;
+  GL_POINT_SMOOTH_HINT			= $0C51;
+  GL_POLYGON_SMOOTH_HINT		= $0C53;
+  GL_DONT_CARE				= $1100;
+  GL_FASTEST				= $1101;
+  GL_NICEST				= $1102;
+
+  // Scissor box
+  GL_SCISSOR_TEST			= $0C11;
+  GL_SCISSOR_BOX			= $0C10;
+
+  // Pixel Mode / Transfer
+  GL_MAP_COLOR				= $0D10;
+  GL_MAP_STENCIL			= $0D11;
+  GL_INDEX_SHIFT			= $0D12;
+  GL_INDEX_OFFSET			= $0D13;
+  GL_RED_SCALE				= $0D14;
+  GL_RED_BIAS				= $0D15;
+  GL_GREEN_SCALE			= $0D18;
+  GL_GREEN_BIAS				= $0D19;
+  GL_BLUE_SCALE				= $0D1A;
+  GL_BLUE_BIAS				= $0D1B;
+  GL_ALPHA_SCALE			= $0D1C;
+  GL_ALPHA_BIAS				= $0D1D;
+  GL_DEPTH_SCALE			= $0D1E;
+  GL_DEPTH_BIAS				= $0D1F;
+  GL_PIXEL_MAP_S_TO_S_SIZE		= $0CB1;
+  GL_PIXEL_MAP_I_TO_I_SIZE		= $0CB0;
+  GL_PIXEL_MAP_I_TO_R_SIZE		= $0CB2;
+  GL_PIXEL_MAP_I_TO_G_SIZE		= $0CB3;
+  GL_PIXEL_MAP_I_TO_B_SIZE		= $0CB4;
+  GL_PIXEL_MAP_I_TO_A_SIZE		= $0CB5;
+  GL_PIXEL_MAP_R_TO_R_SIZE		= $0CB6;
+  GL_PIXEL_MAP_G_TO_G_SIZE		= $0CB7;
+  GL_PIXEL_MAP_B_TO_B_SIZE		= $0CB8;
+  GL_PIXEL_MAP_A_TO_A_SIZE		= $0CB9;
+  GL_PIXEL_MAP_S_TO_S			= $0C71;
+  GL_PIXEL_MAP_I_TO_I			= $0C70;
+  GL_PIXEL_MAP_I_TO_R			= $0C72;
+  GL_PIXEL_MAP_I_TO_G			= $0C73;
+  GL_PIXEL_MAP_I_TO_B			= $0C74;
+  GL_PIXEL_MAP_I_TO_A			= $0C75;
+  GL_PIXEL_MAP_R_TO_R			= $0C76;
+  GL_PIXEL_MAP_G_TO_G			= $0C77;
+  GL_PIXEL_MAP_B_TO_B			= $0C78;
+  GL_PIXEL_MAP_A_TO_A			= $0C79;
+  GL_PACK_ALIGNMENT			= $0D05;
+  GL_PACK_LSB_FIRST			= $0D01;
+  GL_PACK_ROW_LENGTH			= $0D02;
+  GL_PACK_SKIP_PIXELS			= $0D04;
+  GL_PACK_SKIP_ROWS			= $0D03;
+  GL_PACK_SWAP_BYTES			= $0D00;
+  GL_UNPACK_ALIGNMENT			= $0CF5;
+  GL_UNPACK_LSB_FIRST			= $0CF1;
+  GL_UNPACK_ROW_LENGTH			= $0CF2;
+  GL_UNPACK_SKIP_PIXELS			= $0CF4;
+  GL_UNPACK_SKIP_ROWS			= $0CF3;
+  GL_UNPACK_SWAP_BYTES			= $0CF0;
+  GL_ZOOM_X				= $0D16;
+  GL_ZOOM_Y				= $0D17;
+
+  // Texture mapping
+  GL_TEXTURE_ENV                  	= $2300;
+  GL_TEXTURE_ENV_MODE             	= $2200;
+  GL_TEXTURE_1D                   	= $0DE0;
+  GL_TEXTURE_2D                   	= $0DE1;
+  GL_TEXTURE_WRAP_S			= $2802;
+  GL_TEXTURE_WRAP_T			= $2803;
+  GL_TEXTURE_MAG_FILTER			= $2800;
+  GL_TEXTURE_MIN_FILTER			= $2801;
+  GL_TEXTURE_ENV_COLOR			= $2201;
+  GL_TEXTURE_GEN_S			= $0C60;
+  GL_TEXTURE_GEN_T			= $0C61;
+  GL_TEXTURE_GEN_MODE			= $2500;
+  GL_TEXTURE_BORDER_COLOR		= $1004;
+  GL_TEXTURE_WIDTH			= $1000;
+  GL_TEXTURE_HEIGHT			= $1001;
+  GL_TEXTURE_BORDER			= $1005;
+  GL_TEXTURE_COMPONENTS			= $1003;
+  GL_TEXTURE_RED_SIZE			= $805C;
+  GL_TEXTURE_GREEN_SIZE			= $805D;
+  GL_TEXTURE_BLUE_SIZE			= $805E;
+  GL_TEXTURE_ALPHA_SIZE			= $805F;
+  GL_TEXTURE_LUMINANCE_SIZE		= $8060;
+  GL_TEXTURE_INTENSITY_SIZE		= $8061;
+  GL_NEAREST_MIPMAP_NEAREST		= $2700;
+  GL_NEAREST_MIPMAP_LINEAR		= $2702;
+  GL_LINEAR_MIPMAP_NEAREST		= $2701;
+  GL_LINEAR_MIPMAP_LINEAR		= $2703;
+  GL_OBJECT_LINEAR			= $2401;
+  GL_OBJECT_PLANE			= $2501;
+  GL_EYE_LINEAR				= $2400;
+  GL_EYE_PLANE				= $2502;
+  GL_SPHERE_MAP				= $2402;
+  GL_DECAL				= $2101;
+  GL_MODULATE				= $2100;
+  GL_NEAREST				= $2600;
+  GL_REPEAT				= $2901;
+  GL_CLAMP				= $2900;
+  GL_S					= $2000;
+  GL_T					= $2001;
+  GL_R					= $2002;
+  GL_Q					= $2003;
+  GL_TEXTURE_GEN_R			= $0C62;
+  GL_TEXTURE_GEN_Q			= $0C63;
+
+  // GL 1.1 texturing
+  GL_PROXY_TEXTURE_1D			= $8063;
+  GL_PROXY_TEXTURE_2D			= $8064;
+  GL_TEXTURE_PRIORITY			= $8066;
+  GL_TEXTURE_RESIDENT			= $8067;
+  GL_TEXTURE_BINDING_1D			= $8068;
+  GL_TEXTURE_BINDING_2D			= $8069;
+  GL_TEXTURE_INTERNAL_FORMAT		= $1003;
+
+
+  // GL 1.2 texturing
+  GL_PACK_SKIP_IMAGES			= $806B;
+  GL_PACK_IMAGE_HEIGHT			= $806C;
+  GL_UNPACK_SKIP_IMAGES			= $806D;
+  GL_UNPACK_IMAGE_HEIGHT		= $806E;
+  GL_TEXTURE_3D				= $806F;
+  GL_PROXY_TEXTURE_3D			= $8070;
+  GL_TEXTURE_DEPTH			= $8071;
+  GL_TEXTURE_WRAP_R			= $8072;
+  GL_MAX_3D_TEXTURE_SIZE		= $8073;
+  GL_TEXTURE_BINDING_3D			= $806A;
+
+  // Internal texture formats (GL 1.1)
+  GL_ALPHA4				= $803B;
+  GL_ALPHA8				= $803C;
+  GL_ALPHA12				= $803D;
+  GL_ALPHA16				= $803E;
+  GL_LUMINANCE4				= $803F;
+  GL_LUMINANCE8				= $8040;
+  GL_LUMINANCE12			= $8041;
+  GL_LUMINANCE16			= $8042;
+  GL_LUMINANCE4_ALPHA4			= $8043;
+  GL_LUMINANCE6_ALPHA2			= $8044;
+  GL_LUMINANCE8_ALPHA8			= $8045;
+  GL_LUMINANCE12_ALPHA4			= $8046;
+  GL_LUMINANCE12_ALPHA12		= $8047;
+  GL_LUMINANCE16_ALPHA16		= $8048;
+  GL_INTENSITY				= $8049;
+  GL_INTENSITY4				= $804A;
+  GL_INTENSITY8				= $804B;
+  GL_INTENSITY12			= $804C;
+  GL_INTENSITY16			= $804D;
+  GL_R3_G3_B2				= $2A10;
+  GL_RGB4				= $804F;
+  GL_RGB5				= $8050;
+  GL_RGB8				= $8051;
+  GL_RGB10				= $8052;
+  GL_RGB12				= $8053;
+  GL_RGB16				= $8054;
+  GL_RGBA2				= $8055;
+  GL_RGBA4				= $8056;
+  GL_RGB5_A1				= $8057;
+  GL_RGBA8				= $8058;
+  GL_RGB10_A2				= $8059;
+  GL_RGBA12				= $805A;
+  GL_RGBA16				= $805B;
+
+  // Utility
+  GL_VENDOR				= $1F00;
+  GL_RENDERER				= $1F01;
+  GL_VERSION				= $1F02;
+  GL_EXTENSIONS				= $1F03;
+
+  // Errors
+  GL_INVALID_VALUE			= $0501;
+  GL_INVALID_ENUM			= $0500;
+  GL_INVALID_OPERATION			= $0502;
+  GL_STACK_OVERFLOW			= $0503;
+  GL_STACK_UNDERFLOW			= $0504;
+  GL_OUT_OF_MEMORY			= $0505;
+
+
+// -------------------------------------------------------
+//   GL extensions constants
+// -------------------------------------------------------
+
+  // GL_EXT_blend_minmax and GL_EXT_blend_color
+  GL_CONSTANT_COLOR_EXT			= $8001;
+  GL_ONE_MINUS_CONSTANT_COLOR_EXT	= $8002;
+  GL_CONSTANT_ALPHA_EXT			= $8003;
+  GL_ONE_MINUS_CONSTANT_ALPHA_EXT	= $8004;
+  GL_BLEND_EQUATION_EXT			= $8009;
+  GL_MIN_EXT				= $8007;
+  GL_MAX_EXT				= $8008;
+  GL_FUNC_ADD_EXT			= $8006;
+  GL_FUNC_SUBTRACT_EXT			= $800A;
+  GL_FUNC_REVERSE_SUBTRACT_EXT		= $800B;
+  GL_BLEND_COLOR_EXT			= $8005;
+
+  // GL_EXT_polygon_offset
+  GL_POLYGON_OFFSET_EXT			= $8037;
+  GL_POLYGON_OFFSET_FACTOR_EXT		= $8038;
+  GL_POLYGON_OFFSET_BIAS_EXT		= $8039;
+
+  // GL_EXT_vertex_array
+  GL_VERTEX_ARRAY_EXT			= $8074;
+  GL_NORMAL_ARRAY_EXT			= $8075;
+  GL_COLOR_ARRAY_EXT			= $8076;
+  GL_INDEX_ARRAY_EXT			= $8077;
+  GL_TEXTURE_COORD_ARRAY_EXT		= $8078;
+  GL_EDGE_FLAG_ARRAY_EXT		= $8079;
+  GL_VERTEX_ARRAY_SIZE_EXT		= $807A;
+  GL_VERTEX_ARRAY_TYPE_EXT		= $807B;
+  GL_VERTEX_ARRAY_STRIDE_EXT		= $807C;
+  GL_VERTEX_ARRAY_COUNT_EXT		= $807D;
+  GL_NORMAL_ARRAY_TYPE_EXT		= $807E;
+  GL_NORMAL_ARRAY_STRIDE_EXT		= $807F;
+  GL_NORMAL_ARRAY_COUNT_EXT		= $8080;
+  GL_COLOR_ARRAY_SIZE_EXT		= $8081;
+  GL_COLOR_ARRAY_TYPE_EXT		= $8082;
+  GL_COLOR_ARRAY_STRIDE_EXT		= $8083;
+  GL_COLOR_ARRAY_COUNT_EXT		= $8084;
+  GL_INDEX_ARRAY_TYPE_EXT		= $8085;
+  GL_INDEX_ARRAY_STRIDE_EXT		= $8086;
+  GL_INDEX_ARRAY_COUNT_EXT		= $8087;
+  GL_TEXTURE_COORD_ARRAY_SIZE_EXT	= $8088;
+  GL_TEXTURE_COORD_ARRAY_TYPE_EXT	= $8089;
+  GL_TEXTURE_COORD_ARRAY_STRIDE_EXT	= $808A;
+  GL_TEXTURE_COORD_ARRAY_COUNT_EXT	= $808B;
+  GL_EDGE_FLAG_ARRAY_STRIDE_EXT		= $808C;
+  GL_EDGE_FLAG_ARRAY_COUNT_EXT		= $808D;
+  GL_VERTEX_ARRAY_POINTER_EXT		= $808E;
+  GL_NORMAL_ARRAY_POINTER_EXT		= $808F;
+  GL_COLOR_ARRAY_POINTER_EXT		= $8090;
+  GL_INDEX_ARRAY_POINTER_EXT		= $8091;
+  GL_TEXTURE_COORD_ARRAY_POINTER_EXT	= $8092;
+  GL_EDGE_FLAG_ARRAY_POINTER_EXT	= $8093;
+
+  // GL_EXT_texture_object
+  GL_TEXTURE_PRIORITY_EXT		= $8066;
+  GL_TEXTURE_RESIDENT_EXT		= $8067;
+  GL_TEXTURE_1D_BINDING_EXT		= $8068;
+  GL_TEXTURE_2D_BINDING_EXT		= $8069;
+
+  // GL_EXT_texture3D
+  GL_PACK_SKIP_IMAGES_EXT		= $806B;
+  GL_PACK_IMAGE_HEIGHT_EXT		= $806C;
+  GL_UNPACK_SKIP_IMAGES_EXT		= $806D;
+  GL_UNPACK_IMAGE_HEIGHT_EXT		= $806E;
+  GL_TEXTURE_3D_EXT			= $806F;
+  GL_PROXY_TEXTURE_3D_EXT		= $8070;
+  GL_TEXTURE_DEPTH_EXT			= $8071;
+  GL_TEXTURE_WRAP_R_EXT			= $8072;
+  GL_MAX_3D_TEXTURE_SIZE_EXT		= $8073;
+  GL_TEXTURE_3D_BINDING_EXT		= $806A;
+
+  // GL_EXT_paletted_texture
+  GL_TABLE_TOO_LARGE_EXT		= $8031;
+  GL_COLOR_TABLE_FORMAT_EXT		= $80D8;
+  GL_COLOR_TABLE_WIDTH_EXT		= $80D9;
+  GL_COLOR_TABLE_RED_SIZE_EXT		= $80DA;
+  GL_COLOR_TABLE_GREEN_SIZE_EXT		= $80DB;
+  GL_COLOR_TABLE_BLUE_SIZE_EXT		= $80DC;
+  GL_COLOR_TABLE_ALPHA_SIZE_EXT	 	= $80DD;
+  GL_COLOR_TABLE_LUMINANCE_SIZE_EXT	= $80DE;
+  GL_COLOR_TABLE_INTENSITY_SIZE_EXT	= $80DF;
+  GL_TEXTURE_INDEX_SIZE_EXT		= $80ED;
+  GL_COLOR_INDEX1_EXT			= $80E2;
+  GL_COLOR_INDEX2_EXT			= $80E3;
+  GL_COLOR_INDEX4_EXT			= $80E4;
+  GL_COLOR_INDEX8_EXT			= $80E5;
+  GL_COLOR_INDEX12_EXT			= $80E6;
+  GL_COLOR_INDEX16_EXT			= $80E7;
+
+  // GL_EXT_shared_texture_palette
+  GL_SHARED_TEXTURE_PALETTE_EXT		= $81FB;
+
+  // GL_EXT_point_parameters
+  GL_POINT_SIZE_MIN_EXT			= $8126;
+  GL_POINT_SIZE_MAX_EXT			= $8127;
+  GL_POINT_FADE_THRESHOLD_SIZE_EXT	= $8128;
+  GL_DISTANCE_ATTENUATION_EXT		= $8129;
+
+  // GL_EXT_rescale_normal
+  GL_RESCALE_NORMAL_EXT			= $803A;
+
+  // GL_EXT_abgr
+  GL_ABGR_EXT				= $8000;
+
+  // GL_SGIS_multitexture
+  GL_SELECTED_TEXTURE_SGIS		= $835C;
+  GL_SELECTED_TEXTURE_COORD_SET_SGIS	= $835D;
+  GL_MAX_TEXTURES_SGIS			= $835E;
+  GL_TEXTURE0_SGIS			= $835F;
+  GL_TEXTURE1_SGIS			= $8360;
+  GL_TEXTURE2_SGIS			= $8361;
+  GL_TEXTURE3_SGIS			= $8362;
+  GL_TEXTURE_COORD_SET_SOURCE_SGIS	= $8363;
+
+  // GL_EXT_multitexture
+  GL_SELECTED_TEXTURE_EXT		= $83C0;
+  GL_SELECTED_TEXTURE_COORD_SET_EXT	= $83C1;
+  GL_SELECTED_TEXTURE_TRANSFORM_EXT	= $83C2;
+  GL_MAX_TEXTURES_EXT			= $83C3;
+  GL_MAX_TEXTURE_COORD_SETS_EXT		= $83C4;
+  GL_TEXTURE_ENV_COORD_SET_EXT		= $83C5;
+  GL_TEXTURE0_EXT			= $83C6;
+  GL_TEXTURE1_EXT			= $83C7;
+  GL_TEXTURE2_EXT			= $83C8;
+  GL_TEXTURE3_EXT			= $83C9;
+
+  // GL_SGIS_texture_edge_clamp
+  GL_CLAMP_TO_EDGE_SGIS			= $812F;
+
+  // OpenGL 1.2
+  GL_RESCALE_NORMAL			= $803A;
+  GL_CLAMP_TO_EDGE			= $812F;
+  GL_MAX_ELEMENTS_VERTICES		= $F0E8;
+  GL_MAX_ELEMENTS_INDICES		= $F0E9;
+  GL_BGR				= $80E0;
+  GL_BGRA				= $80E1;
+  GL_UNSIGNED_BYTE_3_3_2		= $8032;
+  GL_UNSIGNED_BYTE_2_3_3_REV		= $8362;
+  GL_UNSIGNED_SHORT_5_6_5		= $8363;
+  GL_UNSIGNED_SHORT_5_6_5_REV		= $8364;
+  GL_UNSIGNED_SHORT_4_4_4_4		= $8033;
+  GL_UNSIGNED_SHORT_4_4_4_4_REV		= $8365;
+  GL_UNSIGNED_SHORT_5_5_5_1		= $8034;
+  GL_UNSIGNED_SHORT_1_5_5_5_REV		= $8366;
+  GL_UNSIGNED_INT_8_8_8_8		= $8035;
+  GL_UNSIGNED_INT_8_8_8_8_REV		= $8367;
+  GL_UNSIGNED_INT_10_10_10_2		= $8036;
+  GL_UNSIGNED_INT_2_10_10_10_REV	= $8368;
+  GL_LIGHT_MODEL_COLOR_CONTROL		= $81F8;
+  GL_SINGLE_COLOR			= $81F9;
+  GL_SEPARATE_SPECULAR_COLOR		= $81FA;
+  GL_TEXTURE_MIN_LOD			= $813A;
+  GL_TEXTURE_MAX_LOD			= $813B;
+  GL_TEXTURE_BASE_LEVEL			= $813C;
+  GL_TEXTURE_MAX_LEVEL			= $813D;
+
+
+// -------------------------------------------------------
+//   GL procedures and functions
+// -------------------------------------------------------
+
+  // Miscellaneous
+  procedure glClearIndex(c: Single); ogl_dll;
+  procedure glClearColor(red, green, blue, alpha: GLclampf); ogl_dll;
+  procedure glClear(mask: GLbitfield); ogl_dll;
+  glIndexMask: procedure(mask: LongWord); ogl_dll;
+  glColorMask: procedure(red, green, blue, alpha: Boolean); ogl_dll;
+  glAlphaFunc: procedure(func: GLenum; ref: GLclampf); ogl_dll;
+  glBlendFunc: procedure(sfactor, dfactor: GLenum); ogl_dll;
+  glLogicOp: procedure(opcode: GLenum); ogl_dll;
+  glCullFace: procedure(mode: GLenum); ogl_dll;
+  glFrontFace: procedure(mode: GLenum); ogl_dll;
+  glPointSize: procedure(size: Single); ogl_dll;
+  glLineWidth: procedure(width: Single); ogl_dll;
+  glLineStipple: procedure(factor: LongInt; pattern: Word); ogl_dll;
+  glPolygonMode: procedure(face, mode: GLenum); ogl_dll;
+  glPolygonOffset: procedure(factor, units: Single); ogl_dll;
+  glPolygonStipple: procedure(var mask: Byte); ogl_dll;
+  glGetPolygonStipple: procedure(var mask: Byte); ogl_dll;
+  glEdgeFlag: procedure(flag: Boolean); ogl_dll;
+  glEdgeFlagv: procedure(var flag: Boolean); ogl_dll;
+  glScissor: procedure(x, y, width, height: LongInt); ogl_dll;
+  glClipPlane: procedure(plane: GLenum; var equation: Double); ogl_dll;
+  glGetClipPlane: procedure(plane: GLenum; var equation: Double); ogl_dll;
+  glDrawBuffer: procedure(mode: GLenum); ogl_dll;
+  glReadBuffer: procedure(mode: GLenum); ogl_dll;
+  glEnable: procedure(cap: LongInt); ogl_dll;
+  glDisable: procedure(cap: LongInt); ogl_dll;
+  glIsEnabled: function(cap: GLenum): Boolean; ogl_dll;
+  glEnableClientState: procedure(cap: GLenum); ogl_dll;  // 1.1
+  glDisableClientState: procedure(cap: GLenum); ogl_dll;  // 1.1
+  glGetBooleanv: procedure(pname: GLenum; var params: Boolean); ogl_dll;
+  glGetDoublev: procedure(pname: GLenum; var params: Double); ogl_dll;
+  glGetFloatv: procedure(pname: GLenum; var params: Single); ogl_dll;
+  glGetIntegerv: procedure(pname: GLenum; var params: LongInt); ogl_dll;
+  glPushAttrib: procedure(mask: GLbitfield); ogl_dll;
+  glPopAttrib: procedure; ogl_dll;
+  glPushClientAttrib: procedure(mask: GLbitfield); ogl_dll;  // 1.1
+  glPopClientAttrib: procedure; ogl_dll;  // 1.1
+  glRenderMode: function(mode: GLenum): LongInt; ogl_dll;
+  glGetError: function: GLenum; ogl_dll;
+  glGetString: function(name: GLenum): PChar; ogl_dll;
+  glFinish: procedure; ogl_dll;
+  glFlush: procedure; ogl_dll;
+  glHint: procedure(target, mode: GLenum); ogl_dll;
+
+
+  // Depth Buffer
+  glClearDepth: procedure(depth: GLclampd); ogl_dll;
+  glDepthFunc: procedure(func: LongInt); ogl_dll;
+  glDepthMask: procedure(flag: Boolean); ogl_dll;
+  glDepthRange: procedure(near_val, far_val: GLclampd); ogl_dll;
+
+  // Accumulation Buffer
+  glClearAccum: procedure(red, green, blue, alpha: Single); ogl_dll;
+  glAccum: procedure(op: GLenum; value: Single); ogl_dll;
+
+  // Tranformation
+  glMatrixMode: procedure(mode: GLenum); ogl_dll;
+  glOrtho: procedure(left, right, bottom, top, near_val, far_val: Double); ogl_dll;
+  glFrustum: procedure(left, right, bottom, top, near_val, far_val: Double); ogl_dll;
+  glViewport: procedure(x, y, width, height: LongInt); ogl_dll;
+  glPushMatrix: procedure; ogl_dll;
+  glPopMatrix: procedure; ogl_dll;
+  glLoadIdentity: procedure; ogl_dll;
+  glLoadMatrixd: procedure(var m: Double); ogl_dll;
+  glLoadMatrixf: procedure(var m: PSingle); ogl_dll;
+  glMultMatrixd: procedure(var m: Double); ogl_dll;
+  glMultMatrixf: procedure(var m: Single); ogl_dll;
+  glRotated: procedure(angle, x, y, z: Double); ogl_dll;
+  glRotatef: procedure(angle, x, y, z: Single); ogl_dll;
+  glScaled: procedure(x, y, z: Double); ogl_dll;
+  glScalef: procedure(x, y, z: Single); ogl_dll;
+  glTranslated: procedure(x, y, z: Double); ogl_dll;
+  glTranslatef: procedure(x, y, z: Single); ogl_dll;
+
+  // Display Lists
+  glIsList: function(list: LongWord): Boolean; ogl_dll;
+  glDeleteLists: procedure(list: LongWord; range: LongInt); ogl_dll;
+  glGenLists: function(range: LongInt): LongWord; ogl_dll;
+  glNewList: procedure(list: LongWord; mode: GLenum); ogl_dll;
+  glEndList: procedure; ogl_dll;
+  glCallList: procedure(list: LongWord); ogl_dll;
+  glCallLists: procedure(n: LongInt; AType: GLenum; var lists); ogl_dll;
+  glListBase: procedure(base: LongWord); ogl_dll;
+
+  // Drawing Functions
+  glBegin: procedure(mode: GLenum); ogl_dll;
+  glEnd: procedure; ogl_dll;
+  glVertex2d: procedure(x, y: Double); ogl_dll;
+  glVertex2f: procedure(x, y: Single); ogl_dll;
+  glVertex2i: procedure(x, y: LongInt); ogl_dll;
+  glVertex2s: procedure(x, y: SmallInt); ogl_dll;
+  glVertex3d: procedure(x, y, z: Double); ogl_dll;
+  glVertex3f: procedure(x, y, z: Single); ogl_dll;
+  glVertex3i: procedure(x, y, z: LongInt); ogl_dll;
+  glVertex3s: procedure(x, y, z: SmallInt); ogl_dll;
+  glVertex4d: procedure(x, y, z, w: Double); ogl_dll;
+  glVertex4f: procedure(x, y, z, w: Single); ogl_dll;
+  glVertex4i: procedure(x, y, z, w: LongInt); ogl_dll;
+  glVertex4s: procedure(x, y, z, w: SmallInt); ogl_dll;
+  glVertex2dv: procedure(var v: Double); ogl_dll;
+  glVertex2fv: procedure(var v: Single); ogl_dll;
+  glVertex2iv: procedure(var v: LongInt); ogl_dll;
+  glVertex2sv: procedure(var v: SmallInt); ogl_dll;
+  glVertex3dv: procedure(var v: Double); ogl_dll;
+  glVertex3fv: procedure(var v: Single); ogl_dll;
+  glVertex3iv: procedure(var v: LongInt); ogl_dll;
+  glVertex3sv: procedure(var v: SmallInt); ogl_dll;
+  glVertex4dv: procedure(var v: Double); ogl_dll;
+  glVertex4fv: procedure(var v: Single); ogl_dll;
+  glVertex4iv: procedure(var v: LongInt); ogl_dll;
+  glVertex4sv: procedure(var v: SmallInt); ogl_dll;
+  glNormal3b: procedure(nx, ny, nz: Byte); ogl_dll;
+  glNormal3d: procedure(nx, ny, nz: Double); ogl_dll;
+  glNormal3f: procedure(nx, ny, nz: Single); ogl_dll;
+  glNormal3i: procedure(nx, ny, nz: LongInt); ogl_dll;
+  glNormal3s: procedure(nx, ny, nz: SmallInt); ogl_dll;
+  glNormal3bv: procedure(var v: ShortInt); ogl_dll;
+  glNormal3dv: procedure(var v: Double); ogl_dll;
+  glNormal3fv: procedure(var v: Single); ogl_dll;
+  glNormal3iv: procedure(var v: LongInt); ogl_dll;
+  glNormal3sv: procedure(var v: SmallInt); ogl_dll;
+  glIndexd: procedure(c: Double); ogl_dll;
+  glIndexf: procedure(c: Single); ogl_dll;
+  glIndexi: procedure(c: LongInt); ogl_dll;
+  glIndexs: procedure(c: SmallInt); ogl_dll;
+  glIndexub: procedure(c: Byte); ogl_dll;  // 1.1
+  glIndexdv: procedure(var c: Double); ogl_dll;
+  glIndexfv: procedure(var c: Single); ogl_dll;
+  glIndexiv: procedure(var c: LongInt); ogl_dll;
+  glIndexsv: procedure(var c: SmallInt); ogl_dll;
+  glIndexubv: procedure(var c: Byte); ogl_dll;  // 1.1
+  glColor3b : procedure(red, green, blue: ShortInt); ogl_dll;
+  glColor3d : procedure(red, green, blue: Double); ogl_dll;
+  glColor3f : procedure(red, green, blue: Single); ogl_dll;
+  glColor3i : procedure(red, green, blue: LongInt); ogl_dll;
+  glColor3s : procedure(red, green, blue: SmallInt); ogl_dll;
+  glColor3ub: procedure(red, green, blue: Byte); ogl_dll;
+  glColor3ui: procedure(red, green, blue: LongWord); ogl_dll;
+  glColor3us: procedure(red, green, blue: Word); ogl_dll;
+  glColor4b : procedure(red, green, blue, alpha: ShortInt); ogl_dll;
+  glColor4d : procedure(red, green, blue, alpha: Double); ogl_dll;
+  glColor4f : procedure(red, green, blue, alpha: Single); ogl_dll;
+  glColor4i : procedure(red, green, blue, alpha: LongInt); ogl_dll;
+  glColor4s : procedure(red, green, blue, alpha: SmallInt); ogl_dll;
+  glColor4ub: procedure(red, green, blue, alpha: Byte); ogl_dll;
+  glColor4ui: procedure(red, green, blue, alpha: LongWord); ogl_dll;
+  glColor4us: procedure(red, green, blue, alpha: Word); ogl_dll;
+  glColor3bv : procedure(var v: ShortInt); ogl_dll;
+  glColor3dv : procedure(var v: Double); ogl_dll;
+  glColor3fv : procedure(var v: Single); ogl_dll;
+  glColor3iv : procedure(var v: LongInt); ogl_dll;
+  glColor3sv : procedure(var v: SmallInt); ogl_dll;
+  glColor3ubv: procedure(var v: Byte); ogl_dll;
+  glColor3uiv: procedure(var v: LongWord); ogl_dll;
+  glColor3usv: procedure(var v: Word); ogl_dll;
+  glColor4bv : procedure(var v: ShortInt); ogl_dll;
+  glColor4dv : procedure(var v: Double); ogl_dll;
+  glColor4fv : procedure(var v: Single); ogl_dll;
+  glColor4iv : procedure(var v: LongInt); ogl_dll;
+  glColor4sv : procedure(var v: SmallInt); ogl_dll;
+  glColor4ubv: procedure(var v: Byte); ogl_dll;
+  glColor4uiv: procedure(var v: LongWord); ogl_dll;
+  glColor4usv: procedure(var v: Word); ogl_dll;
+  glTexCoord1d: procedure(s: Double); ogl_dll;
+  glTexCoord1f: procedure(s: Single); ogl_dll;
+  glTexCoord1i: procedure(s: LongInt); ogl_dll;
+  glTexCoord1s: procedure(s: SmallInt); ogl_dll;
+  glTexCoord2d: procedure(s, t: Double); ogl_dll;
+  glTexCoord2f: procedure(s, t: Single); ogl_dll;
+  glTexCoord2i: procedure(s, t: LongInt); ogl_dll;
+  glTexCoord2s: procedure(s, t: SmallInt); ogl_dll;
+  glTexCoord3d: procedure(s, t, r: Double); ogl_dll;
+  glTexCoord3f: procedure(s, t, r: Single); ogl_dll;
+  glTexCoord3i: procedure(s, t, r: LongInt); ogl_dll;
+  glTexCoord3s: procedure(s, t, r: SmallInt); ogl_dll;
+  glTexCoord4d: procedure(s, t, r, q: Double); ogl_dll;
+  glTexCoord4f: procedure(s, t, r, q: Single); ogl_dll;
+  glTexCoord4i: procedure(s, t, r, q: LongInt); ogl_dll;
+  glTexCoord4s: procedure(s, t, r, q: SmallInt); ogl_dll;
+  glTexCoord1dv: procedure(var v: Double); ogl_dll;
+  glTexCoord1fv: procedure(var v: Single); ogl_dll;
+  glTexCoord1iv: procedure(var v: LongInt); ogl_dll;
+  glTexCoord1sv: procedure(var v: SmallInt); ogl_dll;
+  glTexCoord2dv: procedure(var v: Double); ogl_dll;
+  glTexCoord2fv: procedure(var v: Single); ogl_dll;
+  glTexCoord2iv: procedure(var v: LongInt); ogl_dll;
+  glTexCoord2sv: procedure(var v: SmallInt); ogl_dll;
+  glTexCoord3dv: procedure(var v: Double); ogl_dll;
+  glTexCoord3fv: procedure(var v: Single); ogl_dll;
+  glTexCoord3iv: procedure(var v: LongInt); ogl_dll;
+  glTexCoord3sv: procedure(var v: SmallInt); ogl_dll;
+  glTexCoord4dv: procedure(var v: Double); ogl_dll;
+  glTexCoord4fv: procedure(var v: Single); ogl_dll;
+  glTexCoord4iv: procedure(var v: LongInt); ogl_dll;
+  glTexCoord4sv: procedure(var v: SmallInt); ogl_dll;
+  glRasterPos2d: procedure(x, y: Double); ogl_dll;
+  glRasterPos2f: procedure(x, y: Single); ogl_dll;
+  glRasterPos2i: procedure(x, y: LongInt); ogl_dll;
+  glRasterPos2s: procedure(x, y: SmallInt); ogl_dll;
+  glRasterPos3d: procedure(x, y, z: Double); ogl_dll;
+  glRasterPos3f: procedure(x, y, z: Single); ogl_dll;
+  glRasterPos3i: procedure(x, y, z: LongInt); ogl_dll;
+  glRasterPos3s: procedure(x, y, z: SmallInt); ogl_dll;
+  glRasterPos4d: procedure(x, y, z, w: Double); ogl_dll;
+  glRasterPos4f: procedure(x, y, z, w: Single); ogl_dll;
+  glRasterPos4i: procedure(x, y, z, w: LongInt); ogl_dll;
+  glRasterPos4s: procedure(x, y, z, w: SmallInt); ogl_dll;
+  glRasterPos2dv: procedure(var v: Double); ogl_dll;
+  glRasterPos2fv: procedure(var v: Single); ogl_dll;
+  glRasterPos2iv: procedure(var v: LongInt); ogl_dll;
+  glRasterPos2sv: procedure(var v: SmallInt); ogl_dll;
+  glRasterPos3dv: procedure(var v: Double); ogl_dll;
+  glRasterPos3fv: procedure(var v: Single); ogl_dll;
+  glRasterPos3iv: procedure(var v: LongInt); ogl_dll;
+  glRasterPos3sv: procedure(var v: SmallInt); ogl_dll;
+  glRasterPos4dv: procedure(var v: Double); ogl_dll;
+  glRasterPos4fv: procedure(var v: Single); ogl_dll;
+  glRasterPos4iv: procedure(var v: LongInt); ogl_dll;
+  glRasterPos4sv: procedure(var v: SmallInt); ogl_dll;
+  glRectd: procedure(x1, y1, x2, y2: Double); ogl_dll;
+  glRectf: procedure(x1, y1, x2, y2: Single); ogl_dll;
+  glRecti: procedure(x1, y1, x2, y2: LongInt); ogl_dll;
+  glRects: procedure(x1, y1, x2, y2: SmallInt); ogl_dll;
+  glRectdv: procedure(var v1, v2: Double); ogl_dll;
+  glRectfv: procedure(var v1, v2: Single); ogl_dll;
+  glRectiv: procedure(var v1, v2: LongInt); ogl_dll;
+  glRectsv: procedure(var v1, v2: SmallInt); ogl_dll;
+
+  // Vertex Arrays (1.1)
+  glVertexPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); ogl_dll;
+  glNormalPointer: procedure(AType: GLenum; stride: LongInt; var ptr); ogl_dll;
+  glColorPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); ogl_dll;
+  glIndexPointer: procedure(AType: GLenum; stride: LongInt; var ptr); ogl_dll;
+  glTexCoordPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); ogl_dll;
+  glEdgeFlagPointer: procedure(stride: LongInt; var ptr); ogl_dll;
+  glGetPointerv: procedure(pname: GLenum; var params: Pointer); ogl_dll;
+  glArrayElement: procedure(i: LongInt); ogl_dll;
+  glDrawArrays: procedure(mode: GLenum; first, count: LongInt); ogl_dll;
+  glDrawElements: procedure(mode: GLenum; count: Integer; AType: GLenum; var indices); ogl_dll;
+  glInterleavedArrays: procedure(format: GLenum; stride: LongInt; var pointer); ogl_dll;
+
+  // Lighting
+  glShadeModel: procedure(mode: GLenum); ogl_dll;
+  glLightf: procedure(light, pname: GLenum; param: Single); ogl_dll;
+  glLighti: procedure(light, pname: GLenum; param: LongInt); ogl_dll;
+  glLightfv: procedure(light, pname: GLenum; var params: Single); ogl_dll;
+  glLightiv: procedure(light, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetLightfv: procedure(light, pname: GLenum; var params: Single); ogl_dll;
+  glGetLightiv: procedure(light, pname: GLenum; var params: LongInt); ogl_dll;
+  glLightModelf: procedure(pname: GLenum; param: Single); ogl_dll;
+  glLightModeli: procedure(pname: GLenum; param: LongInt); ogl_dll;
+  glLightModelfv: procedure(pname: GLenum; var params: Single); ogl_dll;
+  glLightModeliv: procedure(pname: GLenum; var param: LongInt); ogl_dll;
+  glMaterialf: procedure(face, pname: GLenum; param: Single); ogl_dll;
+  glMateriali: procedure(face, pname: GLenum; param: LongInt); ogl_dll;
+  glMaterialfv: procedure(face, pname: GLenum; var params: Single); ogl_dll;
+  glMaterialiv: procedure(face, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetMaterialfv: procedure(face, pname: GLenum; var params: Single); ogl_dll;
+  glGetMaterialiv: procedure(face, pname: GLenum; var params: LongInt); ogl_dll;
+  glColorMaterial: procedure(face, mode: GLenum); ogl_dll;
+
+  // Raster Functions
+  glPixelZoom: procedure(xfactor, yfactor: Single); ogl_dll;
+  glPixelStoref: procedure(pname: GLenum; param: Single); ogl_dll;
+  glPixelStorei: procedure(pname: GLenum; param: LongInt); ogl_dll;
+  glPixelTransferf: procedure(pname: GLenum; param: Single); ogl_dll;
+  glPixelTransferi: procedure(pname: GLenum; param: LongInt); ogl_dll;
+  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: Single); ogl_dll;
+  glPixelMapuiv: procedure(map: GLenum; mapsize: LongInt; var values: LongWord); ogl_dll;
+  glPixelMapusv: procedure(map: GLenum; mapsize: LongInt; var values: Word); ogl_dll;
+  glGetPixelMapfv: procedure(map: GLenum; var values: Single); ogl_dll;
+  glGetPixelMapuiv: procedure(map: GLenum; var values: LongWord); ogl_dll;
+  glGetPixelMapusv: procedure(map: GLenum; var values: Word); ogl_dll;
+  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: Single; var bitmap); ogl_dll;
+  glReadPixels: procedure(x, y, width, height: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glDrawPixels: procedure(width, height: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glCopyPixels: procedure(x, y, width, height: LongInt; AType: GLenum); ogl_dll;
+
+  // Stenciling
+  glStencilFunc: procedure(func: GLenum; ref: LongInt; mask: LongWord); ogl_dll;
+  glStencilMask: procedure(mask: LongWord); ogl_dll;
+  glStencilOp: procedure(fail, zfail, zpass: GLenum); ogl_dll;
+  glClearStencil: procedure(s: LongInt); ogl_dll;
+
+  // Texture Mapping
+  glTexGend: procedure(cord, pname: GLenum; param: Double); ogl_dll;
+  glTexGenf: procedure(cord, pname: GLenum; param: Single); ogl_dll;
+  glTexGeni: procedure(cord, pname: GLenum; param: LongInt); ogl_dll;
+  glTexGendv: procedure(cord, pname: GLenum; var params: Double); ogl_dll;
+  glTexGenfv: procedure(cord, pname: GLenum; var params: Single); ogl_dll;
+  glTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetTexGendv: procedure(cord, pname: GLenum; var params: Double); ogl_dll;
+  glGetTexGenfv: procedure(cord, pname: GLenum; var params: Single); ogl_dll;
+  glGetTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); ogl_dll;
+  glTexEnvf: procedure(target, pname: GLenum; param: Single); ogl_dll;
+  glTexEnvi: procedure(target, pname: GLenum; param: LongInt); ogl_dll;
+  glTexEnvfv: procedure(target, pname: GLenum; var params: Single); ogl_dll;
+  glTexEnviv: procedure(target, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetTexEnvfv: procedure(target, pname: GLenum; var params: Single); ogl_dll;
+  glGetTexEnviv: procedure(target, pname: GLenum; var params: LongInt); ogl_dll;
+  glTexParameterf: procedure(target, pname: GLenum; param: Single); ogl_dll;
+  glTexParameteri: procedure(target, pname: GLenum; param: LongInt); ogl_dll;
+  glTexParameterfv: procedure(target, pname: GLenum; var params: Single); ogl_dll;
+  glTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetTexParameterfv: procedure(target, pname: GLenum; var params: Single); ogl_dll;
+  glGetTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); ogl_dll;
+  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: Single); ogl_dll;
+  glGetTexLevelParameteriv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: LongInt); ogl_dll;
+  glTexImage1D: procedure(target: GLenum; level, internalFormat, width, border: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glTexImage2D: procedure(target: GLenum; level, internalFormat, width, height, border: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glGetTexImage: procedure(target: GLenum; level: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  // 1.1 functions:
+  glGenTextures: procedure(n: LongInt; var textures: LongWord); ogl_dll;
+  glDeleteTextures: procedure(n: LongInt; var textures: LongWord); ogl_dll;
+  glBindTexture: procedure(target: GLenum; texture: LongWord); ogl_dll;
+  glPrioritizeTextures: procedure(n: LongInt; var textures: LongWord; var priorities: GLclampf); ogl_dll;
+  glAreTexturesResident: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; ogl_dll;
+  glIsTexture: function(texture: LongWord): Boolean; ogl_dll;
+  glTexSubImage1D: procedure(target: GLenum; level, xoffset, width: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, width, height: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glCopyTexImage1D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, border: LongInt); ogl_dll;
+  glCopyTexImage2D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, height, border: LongInt); ogl_dll;
+  glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y, width: LongInt); ogl_dll;
+  glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y, width, height: LongInt); ogl_dll;
+
+  // Evaluators
+  glMap1d: procedure(target: GLenum; u1, u2: Double; stride, order: LongInt; var points: Double); ogl_dll;
+  glMap1f: procedure(target: GLenum; u1, u2: Single; stride, order: LongInt; var points: Single); ogl_dll;
+  glMap2d: procedure(target: GLenum; u1, u2: Double; ustride, uorder: LongInt; v1, v2: Double; vstride, vorder: LongInt; var points: Double); ogl_dll;
+  glMap2f: procedure(target: GLenum; u1, u2: Single; ustride, uorder: LongInt; v1, v2: Single; vstride, vorder: LongInt; var points: Single); ogl_dll;
+  glGetMapdv: procedure(target, query: GLenum; var v: Double); ogl_dll;
+  glGetMapfv: procedure(target, query: GLenum; var v: Single); ogl_dll;
+  glGetMapiv: procedure(target, query: GLenum; var v: LongInt); ogl_dll;
+  glEvalCoord1d: procedure(u: Double); ogl_dll;
+  glEvalCoord1f: procedure(u: Single); ogl_dll;
+  glEvalCoord1dv: procedure(var u: Double); ogl_dll;
+  glEvalCoord1fv: procedure(var u: Single); ogl_dll;
+  glEvalCoord2d: procedure(u, v: Double); ogl_dll;
+  glEvalCoord2f: procedure(u, v: Single); ogl_dll;
+  glEvalCoord2dv: procedure(var u, v: Double); ogl_dll;
+  glEvalCoord2fv: procedure(var u, v: Single); ogl_dll;
+  glMapGrid1d: procedure(un: LongInt; u1, u2: Double); ogl_dll;
+  glMapGrid1f: procedure(un: LongInt; u1, u2: Single); ogl_dll;
+  glMapGrid2d: procedure(un: LongInt; u1, u2: Double; vn: LongInt; v1, v2: Double); ogl_dll;
+  glMapGrid2f: procedure(un: LongInt; u1, u2: Single; vn: LongInt; v1, v2: Single); ogl_dll;
+  glEvalPoint1: procedure(i: LongInt); ogl_dll;
+  glEvalPoint2: procedure(i, j: LongInt); ogl_dll;
+  glEvalMesh1: procedure(mode: GLenum; i1, i2: LongInt); ogl_dll;
+  glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: LongInt); ogl_dll;
+
+  // Fog
+  glFogf: procedure(pname: GLenum; param: Single); ogl_dll;
+  glFogi: procedure(pname: GLenum; param: LongInt); ogl_dll;
+  glFogfv: procedure(pname: GLenum; var params: Single); ogl_dll;
+  glFogiv: procedure(pname: GLenum; var params: LongInt); ogl_dll;
+
+  // Selection and Feedback
+  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: Single); ogl_dll;
+  glPassThrough: procedure(token: Single); ogl_dll;
+  glSelectBuffer: procedure(size: LongInt; var buffer: LongWord); ogl_dll;
+  glInitNames: procedure; ogl_dll;
+  glLoadName: procedure(name: LongWord); ogl_dll;
+  glPushName: procedure(name: LongWord); ogl_dll;
+  glPopName: procedure; ogl_dll;
+
+
+// -------------------------------------------------------
+//   GL Extensions
+// -------------------------------------------------------
+
+var
+  // === 1.0 Extensions ===
+
+  // GL_EXT_blend_minmax
+  glBlendEquationEXT: procedure(mode: GLenum); ogl_dll;
+
+  // GL_EXT_blend_color
+  glBlendColorEXT: procedure(red, green, blue, alpha: GLclampf); ogl_dll;
+
+  // GL_EXT_polygon_offset
+  glPolygonOffsetEXT: procedure(factor, bias: Single); ogl_dll;
+
+  // GL_EXT_vertex_array
+  glVertexPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); ogl_dll;
+  glNormalPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); ogl_dll;
+  glColorPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); ogl_dll;
+  glIndexPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); ogl_dll;
+  glTexCoordPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); ogl_dll;
+  glEdgeFlagPointerEXT: procedure(stride, count: LongInt; var ptr: Boolean); ogl_dll;
+  glGetPointervEXT: procedure(pname: GLenum; var params: Pointer); ogl_dll;
+  glArrayElementEXT: procedure(i: LongInt); ogl_dll;
+  glDrawArraysEXT: procedure(mode: GLEnum; first, count: LongInt); ogl_dll;
+
+  // GL_EXT_texture_object
+  glGenTexturesEXT: procedure(n: LongInt; var textures: LongWord); ogl_dll;
+  glDeleteTexturesEXT: procedure(n: LongInt; var textures: LongWord); ogl_dll;
+  glBindTextureEXT: procedure(target: GLenum; texture: LongWord); ogl_dll;
+  glPrioritizeTexturesEXT: procedure(n: LongInt; var textures: LongWord; var priorities: GLClampf); ogl_dll;
+  glAreTexturesResidentEXT: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; ogl_dll;
+  glIsTextureEXT: function(texture: LongWord): Boolean; ogl_dll;
+
+  // GL_EXT_texture3D
+  glTexImage3DEXT: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLenum; var pixels); ogl_dll;
+  glCopyTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, x, y, width, height: LongInt); ogl_dll;
+
+  // GL_EXT_color_table
+  glColorTableEXT: procedure(target, internalformat: GLenum; width: LongInt; format, AType: GLenum; var table); ogl_dll;
+  glColorSubTableEXT: procedure(target: GLenum; start, count: LongInt; format, AType: GLEnum; var data); ogl_dll;
+  glGetColorTableEXT: procedure(target, format, AType: GLenum; var table); ogl_dll;
+  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: Single); ogl_dll;
+  glGetColorTableParameterivEXT: procedure(target, pname: GLenum; var params: LongInt); ogl_dll;
+
+  // GL_SGIS_multitexture
+  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: Double); ogl_dll;
+  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: Single); ogl_dll;
+  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord1iSGIS: procedure(target: GLenum; s: LongInt); ogl_dll;
+  glMultiTexCoord1ivSGIS: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord1sSGIS: procedure(target: GLenum; s: ShortInt); ogl_dll;
+  glMultiTexCoord1svSGIS: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: Double); ogl_dll;
+  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: Single); ogl_dll;
+  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord2iSGIS: procedure(target: GLenum; s, t: LongInt); ogl_dll;
+  glMultiTexCoord2ivSGIS: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord2sSGIS: procedure(target: GLenum; s, t: ShortInt); ogl_dll;
+  glMultiTexCoord2svSGIS: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: Double); ogl_dll;
+  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: Single); ogl_dll;
+  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord3iSGIS: procedure(target: GLenum; s, t, r: LongInt); ogl_dll;
+  glMultiTexCoord3ivSGIS: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord3sSGIS: procedure(target: GLenum; s, t, r: ShortInt); ogl_dll;
+  glMultiTexCoord3svSGIS: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: Double); ogl_dll;
+  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: Single); ogl_dll;
+  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord4iSGIS: procedure(target: GLenum; s, t, r, q: LongInt); ogl_dll;
+  glMultiTexCoord4ivSGIS: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord4sSGIS: procedure(target: GLenum; s, t, r, q: ShortInt); ogl_dll;
+  glMultiTexCoord4svSGIS: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoordPointerSGIS: procedure(target: GLenum; size: LongInt; AType: GLEnum; stride: LongInt; var APointer); ogl_dll;
+  glSelectTextureSGIS: procedure(target: GLenum); ogl_dll;
+  glSelectTextureCoordSetSGIS: procedure(target: GLenum); ogl_dll;
+
+  // GL_EXT_multitexture
+  glMultiTexCoord1dEXT: procedure(target: GLenum; s: Double); ogl_dll;
+  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord1fEXT: procedure(target: GLenum; s: Single); ogl_dll;
+  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord1iEXT: procedure(target: GLenum; s: LongInt); ogl_dll;
+  glMultiTexCoord1ivEXT: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord1sEXT: procedure(target: GLenum; s: ShortInt); ogl_dll;
+  glMultiTexCoord1svEXT: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: Double); ogl_dll;
+  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: Single); ogl_dll;
+  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord2iEXT: procedure(target: GLenum; s, t: LongInt); ogl_dll;
+  glMultiTexCoord2ivEXT: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord2sEXT: procedure(target: GLenum; s, t: ShortInt); ogl_dll;
+  glMultiTexCoord2svEXT: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: Double); ogl_dll;
+  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: Single); ogl_dll;
+  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord3iEXT: procedure(target: GLenum; s, t, r: LongInt); ogl_dll;
+  glMultiTexCoord3ivEXT: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord3sEXT: procedure(target: GLenum; s, t, r: ShortInt); ogl_dll;
+  glMultiTexCoord3svEXT: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: Double); ogl_dll;
+  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: Double); ogl_dll;
+  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: Single); ogl_dll;
+  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: Single); ogl_dll;
+  glMultiTexCoord4iEXT: procedure(target: GLenum; s, t, r, q: LongInt); ogl_dll;
+  glMultiTexCoord4ivEXT: procedure(target: GLenum; var v: LongInt); ogl_dll;
+  glMultiTexCoord4sEXT: procedure(target: GLenum; s, t, r, q: ShortInt); ogl_dll;
+  glMultiTexCoord4svEXT: procedure(target: GLenum; var v: ShortInt); ogl_dll;
+  glInterleavedTextureCoordSetsEXT: procedure(factor: LongInt); ogl_dll;
+  glSelectTextureEXT: procedure(target: GLenum); ogl_dll;
+  glSelectTextureCoordSetEXT: procedure(target: GLenum); ogl_dll;
+  glSelectTextureTransformEXT: procedure(target: GLenum); ogl_dll;
+
+  // GL_EXT_point_parameters
+  glPointParameterfEXT: procedure(pname: GLenum; param: Single); ogl_dll;
+  glPointParameterfvEXT: procedure(pname: GLenum; var params: Single); ogl_dll;
+
+{$ifdef MESA}
+  // GL_MESA_window_pos
+  glWindowPos2iMESA: procedure(x, y: LongInt); ogl_dll;
+  glWindowPos2sMESA: procedure(x, y: ShortInt); ogl_dll;
+  glWindowPos2fMESA: procedure(x, y: Single); ogl_dll;
+  glWindowPos2dMESA: procedure(x, y: Double); ogl_dll;
+  glWindowPos2ivMESA: procedure(var p: LongInt); ogl_dll;
+  glWindowPos2svMESA: procedure(var p: ShortInt); ogl_dll;
+  glWindowPos2fvMESA: procedure(var p: Single); ogl_dll;
+  glWindowPos2dvMESA: procedure(var p: Double); ogl_dll;
+  glWindowPos3iMESA: procedure(x, y, z: LongInt); ogl_dll;
+  glWindowPos3sMESA: procedure(x, y, z: ShortInt); ogl_dll;
+  glWindowPos3fMESA: procedure(x, y, z: Single); ogl_dll;
+  glWindowPos3dMESA: procedure(x, y, z: Double); ogl_dll;
+  glWindowPos3ivMESA: procedure(var p: LongInt); ogl_dll;
+  glWindowPos3svMESA: procedure(var p: ShortInt); ogl_dll;
+  glWindowPos3fvMESA: procedure(var p: Single); ogl_dll;
+  glWindowPos3dvMESA: procedure(var p: Double); ogl_dll;
+  glWindowPos4iMESA: procedure(x, y, z, w: LongInt); ogl_dll;
+  glWindowPos4sMESA: procedure(x, y, z, w: ShortInt); ogl_dll;
+  glWindowPos4fMESA: procedure(x, y, z, w: Single); ogl_dll;
+  glWindowPos4dMESA: procedure(x, y, z, w: Double); ogl_dll;
+  glWindowPos4ivMESA: procedure(var p: LongInt); ogl_dll;
+  glWindowPos4svMESA: procedure(var p: ShortInt); ogl_dll;
+  glWindowPos4fvMESA: procedure(var p: Single); ogl_dll;
+  glWindowPos4dvMESA: procedure(var p: Double); ogl_dll;
+
+  // GL_MESA_resize_buffers
+  glResizeBuffersMESA: procedure; ogl_dll;
+{$endif MESA}
+
+// -------------------------------------------------------
+//   GL 1.2 Functions
+// -------------------------------------------------------
+
+  glDrawRangeElements: procedure(mode: GLenum; AStart, AEnd: LongWord; count: LongInt; AType: GLenum; var indices); ogl_dll;
+  glTexImage3D: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLEnum; var pixels); ogl_dll;
+  glTexSubImage3D: procedure(target: GLenum; level: LongInt; xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLEnum; var pixels); ogl_dll;
+  glCopyTexSubImage3D: procedure(target: GLenum; level: LongInt; xoffset, yoffset, zoffset, x, y, width, height: LongInt); ogl_dll;
+
+
+
+// =======================================================
+// =======================================================
+
+implementation
+
+
+{$IFDEF Linux}
+{$LINKLIB m}
+type
+  HInstance = LongWord;
+
+function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlclose(handle: Pointer): LongInt; external 'dl';
+function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+
+function LoadLibrary(name: PChar): HInstance;
+begin
+  Result := LongWord(dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY}));
+end;
+
+procedure FreeLibrary(handle: HInstance);
+begin
+  dlclose(Pointer(handle));
+end;
+
+function GetProcAddress(handle: HInstance; name: PChar): Pointer;
+begin
+  Result := dlsym(Pointer(handle), name);
+  // if Result = nil then WriteLn('Unresolved: ', name);
+end;
+
+{$ENDIF}
+
+{$IFDEF Win32}
+type
+  HInstance = LongWord;
+{$ENDIF}
+
+var
+  libGL : HInstance;
+
+function InitGLFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGL := LoadLibrary(libname);
+  if libGL = 0 then exit;
+
+  glClearIndex := GetProcAddress(libGL, 'glClearIndex');
+  glClearColor := GetProcAddress(libGL, 'glClearColor');
+  glClear := GetProcAddress(libGL, 'glClear');
+  glIndexMask := GetProcAddress(libGL, 'glIndexMask');
+  glColorMask := GetProcAddress(libGL, 'glColorMask');
+  glAlphaFunc := GetProcAddress(libGL, 'glAlphaFunc');
+  glBlendFunc := GetProcAddress(libGL, 'glBlendFunc');
+  glLogicOp := GetProcAddress(libGL, 'glLogicOp');
+  glCullFace := GetProcAddress(libGL, 'glCullFace');
+  glFrontFace := GetProcAddress(libGL, 'glFrontFace');
+  glPointSize := GetProcAddress(libGL, 'glPointSize');
+  glLineWidth := GetProcAddress(libGL, 'glLineWidth');
+  glLineStipple := GetProcAddress(libGL, 'glLineStipple');
+  glPolygonMode := GetProcAddress(libGL, 'glPolygonMode');
+  glPolygonOffset := GetProcAddress(libGL, 'glPolygonOffset');
+  glPolygonStipple := GetProcAddress(libGL, 'glPolygonStipple');
+  glGetPolygonStipple := GetProcAddress(libGL, 'glGetPolygonStipple');
+  glEdgeFlag := GetProcAddress(libGL, 'glEdgeFlag');
+  glEdgeFlagv := GetProcAddress(libGL, 'glEdgeFlagv');
+  glScissor := GetProcAddress(libGL, 'glScissor');
+  glClipPlane := GetProcAddress(libGL, 'glClipPlane');
+  glGetClipPlane := GetProcAddress(libGL, 'glGetClipPlane');
+  glDrawBuffer := GetProcAddress(libGL, 'glDrawBuffer');
+  glReadBuffer := GetProcAddress(libGL, 'glReadBuffer');
+  glEnable := GetProcAddress(libGL, 'glEnable');
+  glDisable := GetProcAddress(libGL, 'glDisable');
+  glIsEnabled := GetProcAddress(libGL, 'glIsEnabled');
+  glEnableClientState := GetProcAddress(libGL, 'glEnableClientState');
+  glDisableClientState := GetProcAddress(libGL, 'glDisableClientState');
+  glGetBooleanv := GetProcAddress(libGL, 'glGetBooleanv');
+  glGetDoublev := GetProcAddress(libGL, 'glGetDoublev');
+  glGetFloatv := GetProcAddress(libGL, 'glGetFloatv');
+  glGetIntegerv := GetProcAddress(libGL, 'glGetIntegerv');
+  glPushAttrib := GetProcAddress(libGL, 'glPushAttrib');
+  glPopAttrib := GetProcAddress(libGL, 'glPopAttrib');
+  glPushClientAttrib := GetProcAddress(libGL, 'glPushClientAttrib');
+  glPopClientAttrib := GetProcAddress(libGL, 'glPopClientAttrib');
+  glRenderMode := GetProcAddress(libGL, 'glRenderMode');
+  glGetError := GetProcAddress(libGL, 'glGetError');
+  glGetString := GetProcAddress(libGL, 'glGetString');
+  glFinish := GetProcAddress(libGL, 'glFinish');
+  glFlush := GetProcAddress(libGL, 'glFlush');
+  glHint := GetProcAddress(libGL, 'glHint');
+  glClearDepth := GetProcAddress(libGL, 'glClearDepth');
+  glDepthFunc := GetProcAddress(libGL, 'glDepthFunc');
+  glDepthMask := GetProcAddress(libGL, 'glDepthMask');
+  glDepthRange := GetProcAddress(libGL, 'glDepthRange');
+  glClearAccum := GetProcAddress(libGL, 'glClearAccum');
+  glAccum := GetProcAddress(libGL, 'glAccum');
+  glMatrixMode := GetProcAddress(libGL, 'glMatrixMode');
+  glOrtho := GetProcAddress(libGL, 'glOrtho');
+  glFrustum := GetProcAddress(libGL, 'glFrustum');
+  glViewport := GetProcAddress(libGL, 'glViewport');
+  glPushMatrix := GetProcAddress(libGL, 'glPushMatrix');
+  glPopMatrix := GetProcAddress(libGL, 'glPopMatrix');
+  glLoadIdentity := GetProcAddress(libGL, 'glLoadIdentity');
+  glLoadMatrixd := GetProcAddress(libGL, 'glLoadMatrixd');
+  glLoadMatrixf := GetProcAddress(libGL, 'glLoadMatrixf');
+  glMultMatrixd := GetProcAddress(libGL, 'glMultMatrixd');
+  glMultMatrixf := GetProcAddress(libGL, 'glMultMatrixf');
+  glRotated := GetProcAddress(libGL, 'glRotated');
+  glRotatef := GetProcAddress(libGL, 'glRotatef');
+  glScaled := GetProcAddress(libGL, 'glScaled');
+  glScalef := GetProcAddress(libGL, 'glScalef');
+  glTranslated := GetProcAddress(libGL, 'glTranslated');
+  glTranslatef := GetProcAddress(libGL, 'glTranslatef');
+  glIsList := GetProcAddress(libGL, 'glIsList');
+  glDeleteLists := GetProcAddress(libGL, 'glDeleteLists');
+  glGenLists := GetProcAddress(libGL, 'glGenLists');
+  glNewList := GetProcAddress(libGL, 'glNewList');
+  glEndList := GetProcAddress(libGL, 'glEndList');
+  glCallList := GetProcAddress(libGL, 'glCallList');
+  glCallLists := GetProcAddress(libGL, 'glCallLists');
+  glListBase := GetProcAddress(libGL, 'glListBase');
+  glBegin := GetProcAddress(libGL, 'glBegin');
+  glEnd := GetProcAddress(libGL, 'glEnd');
+  glVertex2d := GetProcAddress(libGL, 'glVertex2d');
+  glVertex2f := GetProcAddress(libGL, 'glVertex2f');
+  glVertex2i := GetProcAddress(libGL, 'glVertex2i');
+  glVertex2s := GetProcAddress(libGL, 'glVertex2s');
+  glVertex3d := GetProcAddress(libGL, 'glVertex3d');
+  glVertex3f := GetProcAddress(libGL, 'glVertex3f');
+  glVertex3i := GetProcAddress(libGL, 'glVertex3i');
+  glVertex3s := GetProcAddress(libGL, 'glVertex3s');
+  glVertex4d := GetProcAddress(libGL, 'glVertex4d');
+  glVertex4f := GetProcAddress(libGL, 'glVertex4f');
+  glVertex4i := GetProcAddress(libGL, 'glVertex4i');
+  glVertex4s := GetProcAddress(libGL, 'glVertex4s');
+  glVertex2dv := GetProcAddress(libGL, 'glVertex2dv');
+  glVertex2fv := GetProcAddress(libGL, 'glVertex2fv');
+  glVertex2iv := GetProcAddress(libGL, 'glVertex2iv');
+  glVertex2sv := GetProcAddress(libGL, 'glVertex2sv');
+  glVertex3dv := GetProcAddress(libGL, 'glVertex3dv');
+  glVertex3fv := GetProcAddress(libGL, 'glVertex3fv');
+  glVertex3iv := GetProcAddress(libGL, 'glVertex3iv');
+  glVertex3sv := GetProcAddress(libGL, 'glVertex3sv');
+  glVertex4dv := GetProcAddress(libGL, 'glVertex4dv');
+  glVertex4fv := GetProcAddress(libGL, 'glVertex4fv');
+  glVertex4iv := GetProcAddress(libGL, 'glVertex4iv');
+  glVertex4sv := GetProcAddress(libGL, 'glVertex4sv');
+  glNormal3b := GetProcAddress(libGL, 'glNormal3b');
+  glNormal3d := GetProcAddress(libGL, 'glNormal3d');
+  glNormal3f := GetProcAddress(libGL, 'glNormal3f');
+  glNormal3i := GetProcAddress(libGL, 'glNormal3i');
+  glNormal3s := GetProcAddress(libGL, 'glNormal3s');
+  glNormal3bv := GetProcAddress(libGL, 'glNormal3bv');
+  glNormal3dv := GetProcAddress(libGL, 'glNormal3dv');
+  glNormal3fv := GetProcAddress(libGL, 'glNormal3fv');
+  glNormal3iv := GetProcAddress(libGL, 'glNormal3iv');
+  glNormal3sv := GetProcAddress(libGL, 'glNormal3sv');
+  glIndexd := GetProcAddress(libGL, 'glIndexd');
+  glIndexf := GetProcAddress(libGL, 'glIndexf');
+  glIndexi := GetProcAddress(libGL, 'glIndexi');
+  glIndexs := GetProcAddress(libGL, 'glIndexs');
+  glIndexub := GetProcAddress(libGL, 'glIndexub');
+  glIndexdv := GetProcAddress(libGL, 'glIndexdv');
+  glIndexfv := GetProcAddress(libGL, 'glIndexfv');
+  glIndexiv := GetProcAddress(libGL, 'glIndexiv');
+  glIndexsv := GetProcAddress(libGL, 'glIndexsv');
+  glIndexubv := GetProcAddress(libGL, 'glIndexubv');
+  glColor3b := GetProcAddress(libGL, 'glColor3b');
+  glColor3d := GetProcAddress(libGL, 'glColor3d');
+  glColor3f := GetProcAddress(libGL, 'glColor3f');
+  glColor3i := GetProcAddress(libGL, 'glColor3i');
+  glColor3s := GetProcAddress(libGL, 'glColor3s');
+  glColor3ub := GetProcAddress(libGL, 'glColor3ub');
+  glColor3ui := GetProcAddress(libGL, 'glColor3ui');
+  glColor3us := GetProcAddress(libGL, 'glColor3us');
+  glColor4b := GetProcAddress(libGL, 'glColor4b');
+  glColor4d := GetProcAddress(libGL, 'glColor4d');
+  glColor4f := GetProcAddress(libGL, 'glColor4f');
+  glColor4i := GetProcAddress(libGL, 'glColor4i');
+  glColor4s := GetProcAddress(libGL, 'glColor4s');
+  glColor4ub := GetProcAddress(libGL, 'glColor4ub');
+  glColor4ui := GetProcAddress(libGL, 'glColor4ui');
+  glColor4us := GetProcAddress(libGL, 'glColor4us');
+  glColor3bv := GetProcAddress(libGL, 'glColor3bv');
+  glColor3dv := GetProcAddress(libGL, 'glColor3dv');
+  glColor3fv := GetProcAddress(libGL, 'glColor3fv');
+  glColor3iv := GetProcAddress(libGL, 'glColor3iv');
+  glColor3sv := GetProcAddress(libGL, 'glColor3sv');
+  glColor3ubv := GetProcAddress(libGL, 'glColor3ubv');
+  glColor3uiv := GetProcAddress(libGL, 'glColor3uiv');
+  glColor3usv := GetProcAddress(libGL, 'glColor3usv');
+  glColor4bv := GetProcAddress(libGL, 'glColor4bv');
+  glColor4dv := GetProcAddress(libGL, 'glColor4dv');
+  glColor4fv := GetProcAddress(libGL, 'glColor4fv');
+  glColor4iv := GetProcAddress(libGL, 'glColor4iv');
+  glColor4sv := GetProcAddress(libGL, 'glColor4sv');
+  glColor4ubv := GetProcAddress(libGL, 'glColor4ubv');
+  glColor4uiv := GetProcAddress(libGL, 'glColor4uiv');
+  glColor4usv := GetProcAddress(libGL, 'glColor4usv');
+  glTexCoord1d := GetProcAddress(libGL, 'glTexCoord1d');
+  glTexCoord1f := GetProcAddress(libGL, 'glTexCoord1f');
+  glTexCoord1i := GetProcAddress(libGL, 'glTexCoord1i');
+  glTexCoord1s := GetProcAddress(libGL, 'glTexCoord1s');
+  glTexCoord2d := GetProcAddress(libGL, 'glTexCoord2d');
+  glTexCoord2f := GetProcAddress(libGL, 'glTexCoord2f');
+  glTexCoord2i := GetProcAddress(libGL, 'glTexCoord2i');
+  glTexCoord2s := GetProcAddress(libGL, 'glTexCoord2s');
+  glTexCoord3d := GetProcAddress(libGL, 'glTexCoord3d');
+  glTexCoord3f := GetProcAddress(libGL, 'glTexCoord3f');
+  glTexCoord3i := GetProcAddress(libGL, 'glTexCoord3i');
+  glTexCoord3s := GetProcAddress(libGL, 'glTexCoord3s');
+  glTexCoord4d := GetProcAddress(libGL, 'glTexCoord4d');
+  glTexCoord4f := GetProcAddress(libGL, 'glTexCoord4f');
+  glTexCoord4i := GetProcAddress(libGL, 'glTexCoord4i');
+  glTexCoord4s := GetProcAddress(libGL, 'glTexCoord4s');
+  glTexCoord1dv := GetProcAddress(libGL, 'glTexCoord1dv');
+  glTexCoord1fv := GetProcAddress(libGL, 'glTexCoord1fv');
+  glTexCoord1iv := GetProcAddress(libGL, 'glTexCoord1iv');
+  glTexCoord1sv := GetProcAddress(libGL, 'glTexCoord1sv');
+  glTexCoord2dv := GetProcAddress(libGL, 'glTexCoord2dv');
+  glTexCoord2fv := GetProcAddress(libGL, 'glTexCoord2fv');
+  glTexCoord2iv := GetProcAddress(libGL, 'glTexCoord2iv');
+  glTexCoord2sv := GetProcAddress(libGL, 'glTexCoord2sv');
+  glTexCoord3dv := GetProcAddress(libGL, 'glTexCoord3dv');
+  glTexCoord3fv := GetProcAddress(libGL, 'glTexCoord3fv');
+  glTexCoord3iv := GetProcAddress(libGL, 'glTexCoord3iv');
+  glTexCoord3sv := GetProcAddress(libGL, 'glTexCoord3sv');
+  glTexCoord4dv := GetProcAddress(libGL, 'glTexCoord4dv');
+  glTexCoord4fv := GetProcAddress(libGL, 'glTexCoord4fv');
+  glTexCoord4iv := GetProcAddress(libGL, 'glTexCoord4iv');
+  glTexCoord4sv := GetProcAddress(libGL, 'glTexCoord4sv');
+  glRasterPos2d := GetProcAddress(libGL, 'glRasterPos2d');
+  glRasterPos2f := GetProcAddress(libGL, 'glRasterPos2f');
+  glRasterPos2i := GetProcAddress(libGL, 'glRasterPos2i');
+  glRasterPos2s := GetProcAddress(libGL, 'glRasterPos2s');
+  glRasterPos3d := GetProcAddress(libGL, 'glRasterPos3d');
+  glRasterPos3f := GetProcAddress(libGL, 'glRasterPos3f');
+  glRasterPos3i := GetProcAddress(libGL, 'glRasterPos3i');
+  glRasterPos3s := GetProcAddress(libGL, 'glRasterPos3s');
+  glRasterPos4d := GetProcAddress(libGL, 'glRasterPos4d');
+  glRasterPos4f := GetProcAddress(libGL, 'glRasterPos4f');
+  glRasterPos4i := GetProcAddress(libGL, 'glRasterPos4i');
+  glRasterPos4s := GetProcAddress(libGL, 'glRasterPos4s');
+  glRasterPos2dv := GetProcAddress(libGL, 'glRasterPos2dv');
+  glRasterPos2fv := GetProcAddress(libGL, 'glRasterPos2fv');
+  glRasterPos2iv := GetProcAddress(libGL, 'glRasterPos2iv');
+  glRasterPos2sv := GetProcAddress(libGL, 'glRasterPos2sv');
+  glRasterPos3dv := GetProcAddress(libGL, 'glRasterPos3dv');
+  glRasterPos3fv := GetProcAddress(libGL, 'glRasterPos3fv');
+  glRasterPos3iv := GetProcAddress(libGL, 'glRasterPos3iv');
+  glRasterPos3sv := GetProcAddress(libGL, 'glRasterPos3sv');
+  glRasterPos4dv := GetProcAddress(libGL, 'glRasterPos4dv');
+  glRasterPos4fv := GetProcAddress(libGL, 'glRasterPos4fv');
+  glRasterPos4iv := GetProcAddress(libGL, 'glRasterPos4iv');
+  glRasterPos4sv := GetProcAddress(libGL, 'glRasterPos4sv');
+  glRectd := GetProcAddress(libGL, 'glRectd');
+  glRectf := GetProcAddress(libGL, 'glRectf');
+  glRecti := GetProcAddress(libGL, 'glRecti');
+  glRects := GetProcAddress(libGL, 'glRects');
+  glRectdv := GetProcAddress(libGL, 'glRectdv');
+  glRectfv := GetProcAddress(libGL, 'glRectfv');
+  glRectiv := GetProcAddress(libGL, 'glRectiv');
+  glRectsv := GetProcAddress(libGL, 'glRectsv');
+  glVertexPointer := GetProcAddress(libGL, 'glVertexPointer');
+  glNormalPointer := GetProcAddress(libGL, 'glNormalPointer');
+  glColorPointer := GetProcAddress(libGL, 'glColorPointer');
+  glIndexPointer := GetProcAddress(libGL, 'glIndexPointer');
+  glTexCoordPointer := GetProcAddress(libGL, 'glTexCoordPointer');
+  glEdgeFlagPointer := GetProcAddress(libGL, 'glEdgeFlagPointer');
+  glGetPointerv := GetProcAddress(libGL, 'glGetPointerv');
+  glArrayElement := GetProcAddress(libGL, 'glArrayElement');
+  glDrawArrays := GetProcAddress(libGL, 'glDrawArrays');
+  glDrawElements := GetProcAddress(libGL, 'glDrawElements');
+  glInterleavedArrays := GetProcAddress(libGL, 'glInterleavedArrays');
+  glShadeModel := GetProcAddress(libGL, 'glShadeModel');
+  glLightf := GetProcAddress(libGL, 'glLightf');
+  glLighti := GetProcAddress(libGL, 'glLighti');
+  glLightfv := GetProcAddress(libGL, 'glLightfv');
+  glLightiv := GetProcAddress(libGL, 'glLightiv');
+  glGetLightfv := GetProcAddress(libGL, 'glGetLightfv');
+  glGetLightiv := GetProcAddress(libGL, 'glGetLightiv');
+  glLightModelf := GetProcAddress(libGL, 'glLightModelf');
+  glLightModeli := GetProcAddress(libGL, 'glLightModeli');
+  glLightModelfv := GetProcAddress(libGL, 'glLightModelfv');
+  glLightModeliv := GetProcAddress(libGL, 'glLightModeliv');
+  glMaterialf := GetProcAddress(libGL, 'glMaterialf');
+  glMateriali := GetProcAddress(libGL, 'glMateriali');
+  glMaterialfv := GetProcAddress(libGL, 'glMaterialfv');
+  glMaterialiv := GetProcAddress(libGL, 'glMaterialiv');
+  glGetMaterialfv := GetProcAddress(libGL, 'glGetMaterialfv');
+  glGetMaterialiv := GetProcAddress(libGL, 'glGetMaterialiv');
+  glColorMaterial := GetProcAddress(libGL, 'glColorMaterial');
+  glPixelZoom := GetProcAddress(libGL, 'glPixelZoom');
+  glPixelStoref := GetProcAddress(libGL, 'glPixelStoref');
+  glPixelStorei := GetProcAddress(libGL, 'glPixelStorei');
+  glPixelTransferf := GetProcAddress(libGL, 'glPixelTransferf');
+  glPixelTransferi := GetProcAddress(libGL, 'glPixelTransferi');
+  glPixelMapfv := GetProcAddress(libGL, 'glPixelMapfv');
+  glPixelMapuiv := GetProcAddress(libGL, 'glPixelMapuiv');
+  glPixelMapusv := GetProcAddress(libGL, 'glPixelMapusv');
+  glGetPixelMapfv := GetProcAddress(libGL, 'glGetPixelMapfv');
+  glGetPixelMapuiv := GetProcAddress(libGL, 'glGetPixelMapuiv');
+  glGetPixelMapusv := GetProcAddress(libGL, 'glGetPixelMapusv');
+  glBitmap := GetProcAddress(libGL, 'glBitmap');
+  glReadPixels := GetProcAddress(libGL, 'glReadPixels');
+  glDrawPixels := GetProcAddress(libGL, 'glDrawPixels');
+  glCopyPixels := GetProcAddress(libGL, 'glCopyPixels');
+  glStencilFunc := GetProcAddress(libGL, 'glStencilFunc');
+  glStencilMask := GetProcAddress(libGL, 'glStencilMask');
+  glStencilOp := GetProcAddress(libGL, 'glStencilOp');
+  glClearStencil := GetProcAddress(libGL, 'glClearStencil');
+  glTexGend := GetProcAddress(libGL, 'glTexGend');
+  glTexGenf := GetProcAddress(libGL, 'glTexGenf');
+  glTexGeni := GetProcAddress(libGL, 'glTexGeni');
+  glTexGendv := GetProcAddress(libGL, 'glTexGendv');
+  glTexGenfv := GetProcAddress(libGL, 'glTexGenfv');
+  glTexGeniv := GetProcAddress(libGL, 'glTexGeniv');
+  glGetTexGendv := GetProcAddress(libGL, 'glGetTexGendv');
+  glGetTexGenfv := GetProcAddress(libGL, 'glGetTexGenfv');
+  glGetTexGeniv := GetProcAddress(libGL, 'glGetTexGeniv');
+  glTexEnvf := GetProcAddress(libGL, 'glTexEnvf');
+  glTexEnvi := GetProcAddress(libGL, 'glTexEnvi');
+  glTexEnvfv := GetProcAddress(libGL, 'glTexEnvfv');
+  glTexEnviv := GetProcAddress(libGL, 'glTexEnviv');
+  glGetTexEnvfv := GetProcAddress(libGL, 'glGetTexEnvfv');
+  glGetTexEnviv := GetProcAddress(libGL, 'glGetTexEnviv');
+  glTexParameterf := GetProcAddress(libGL, 'glTexParameterf');
+  glTexParameteri := GetProcAddress(libGL, 'glTexParameteri');
+  glTexParameterfv := GetProcAddress(libGL, 'glTexParameterfv');
+  glTexParameteriv := GetProcAddress(libGL, 'glTexParameteriv');
+  glGetTexParameterfv := GetProcAddress(libGL, 'glGetTexParameterfv');
+  glGetTexParameteriv := GetProcAddress(libGL, 'glGetTexParameteriv');
+  glGetTexLevelParameterfv := GetProcAddress(libGL, 'glGetTexLevelParameterfv');
+  glGetTexLevelParameteriv := GetProcAddress(libGL, 'glGetTexLevelParameteriv');
+  glTexImage1D := GetProcAddress(libGL, 'glTexImage1D');
+  glTexImage2D := GetProcAddress(libGL, 'glTexImage2D');
+  glGetTexImage := GetProcAddress(libGL, 'glGetTexImage');
+  glGenTextures := GetProcAddress(libGL, 'glGenTextures');
+  glDeleteTextures := GetProcAddress(libGL, 'glDeleteTextures');
+  glBindTexture := GetProcAddress(libGL, 'glBindTexture');
+  glPrioritizeTextures := GetProcAddress(libGL, 'glPrioritizeTextures');
+  glAreTexturesResident := GetProcAddress(libGL, 'glAreTexturesResident');
+  glIsTexture := GetProcAddress(libGL, 'glIsTexture');
+  glTexSubImage1D := GetProcAddress(libGL, 'glTexSubImage1D');
+  glTexSubImage2D := GetProcAddress(libGL, 'glTexSubImage2D');
+  glCopyTexImage1D := GetProcAddress(libGL, 'glCopyTexImage1D');
+  glCopyTexImage2D := GetProcAddress(libGL, 'glCopyTexImage2D');
+  glCopyTexSubImage1D := GetProcAddress(libGL, 'glCopyTexSubImage1D');
+  glCopyTexSubImage2D := GetProcAddress(libGL, 'glCopyTexSubImage2D');
+  glMap1d := GetProcAddress(libGL, 'glMap1d');
+  glMap1f := GetProcAddress(libGL, 'glMap1f');
+  glMap2d := GetProcAddress(libGL, 'glMap2d');
+  glMap2f := GetProcAddress(libGL, 'glMap2f');
+  glGetMapdv := GetProcAddress(libGL, 'glGetMapdv');
+  glGetMapfv := GetProcAddress(libGL, 'glGetMapfv');
+  glGetMapiv := GetProcAddress(libGL, 'glGetMapiv');
+  glEvalCoord1d := GetProcAddress(libGL, 'glEvalCoord1d');
+  glEvalCoord1f := GetProcAddress(libGL, 'glEvalCoord1f');
+  glEvalCoord1dv := GetProcAddress(libGL, 'glEvalCoord1dv');
+  glEvalCoord1fv := GetProcAddress(libGL, 'glEvalCoord1fv');
+  glEvalCoord2d := GetProcAddress(libGL, 'glEvalCoord2d');
+  glEvalCoord2f := GetProcAddress(libGL, 'glEvalCoord2f');
+  glEvalCoord2dv := GetProcAddress(libGL, 'glEvalCoord2dv');
+  glEvalCoord2fv := GetProcAddress(libGL, 'glEvalCoord2fv');
+  glMapGrid1d := GetProcAddress(libGL, 'glMapGrid1d');
+  glMapGrid1f := GetProcAddress(libGL, 'glMapGrid1f');
+  glMapGrid2d := GetProcAddress(libGL, 'glMapGrid2d');
+  glMapGrid2f := GetProcAddress(libGL, 'glMapGrid2f');
+  glEvalPoint1 := GetProcAddress(libGL, 'glEvalPoint1');
+  glEvalPoint2 := GetProcAddress(libGL, 'glEvalPoint2');
+  glEvalMesh1 := GetProcAddress(libGL, 'glEvalMesh1');
+  glEvalMesh2 := GetProcAddress(libGL, 'glEvalMesh2');
+  glFogf := GetProcAddress(libGL, 'glFogf');
+  glFogi := GetProcAddress(libGL, 'glFogi');
+  glFogfv := GetProcAddress(libGL, 'glFogfv');
+  glFogiv := GetProcAddress(libGL, 'glFogiv');
+  glFeedbackBuffer := GetProcAddress(libGL, 'glFeedbackBuffer');
+  glPassThrough := GetProcAddress(libGL, 'glPassThrough');
+  glSelectBuffer := GetProcAddress(libGL, 'glSelectBuffer');
+  glInitNames := GetProcAddress(libGL, 'glInitNames');
+  glLoadName := GetProcAddress(libGL, 'glLoadName');
+  glPushName := GetProcAddress(libGL, 'glPushName');
+  glPopName := GetProcAddress(libGL, 'glPopName');
+
+{$ifdef MESA}
+  {TODO !!!}
+{$endif MESA}
+
+  GLInitialized := True;
+  Result := True;
+end;
+
+
+function InitGL: Boolean;
+begin
+{$IFDEF Win32}
+  Result := InitGLFromLibrary('opengl32.dll');
+{$ELSE}
+  {$IFDEF Linux}
+  Result := InitGLFromLibrary('libGL.so') or InitGLFromLibrary('libMesaGL.so');
+  {$ELSE}
+    {$ERROR Unsupported platform}
+  {$ENDIF}
+{$ENDIF}
+end;
+
+
+finalization
+  if libGL <> 0 then FreeLibrary(libGL);
+end.
+
+
+{
+  $Log$
+  Revision 1.1  2000-05-26 09:22:39  alex
+  universal cross platform unit file generator
+
+}

+ 225 - 0
packages/opengl/build2/gl_w32s.tem

@@ -0,0 +1,225 @@
+{
+  Translation of the Mesa GL headers for FreePascal
+  Copyright (C) 1999 Sebastian Guenther
+  Template for static linking in Win32 environment by Alexander Stohr.
+
+  Original copyright notice:
+
+  Mesa 3-D graphics library
+  Version:  3.0
+  Copyright (C) 1995-1998  Brian Paul
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library 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
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+}
+
+{
+  You have to enable Macros (compiler switch "-Sm") for compiling this unit!
+  This is necessary for supporting different platforms with different calling
+  conventions via a single unit.
+}
+
+unit GL;
+
+
+interface
+
+{$DEFINE GL1_0}
+{x$DEFINE GL1_1}
+{x$DEFINE GL1_2}
+{x$DEFINE MESA}                 {enable if you want to use some special mesa extensions}
+{x$DEFINE EXTENSIONS}           {enable if you need one/all of extensions}
+{x$DEFINE SGI_EXTENSIONS}       {enable if you need one/all of extensions}
+
+{
+  *** Note: ***
+  There is currently one importants side effect when doing static linking.
+
+  If you include a function statically than its required to be present
+  in the supplied DLLs of your OS and Hardware.
+  This means if the DLL is not present your program will not run.
+  In Win95 it appears that you will be informined you about
+  the name of the first missing symbol while loading the executable.
+}
+
+{$IFDEF Win32}
+  {$DEFINE ogl_dll := external 'opengl32.dll'}
+  uses Windows;
+{$ELSE}
+  {$MESSAGE Unsupported platform.}
+{$ENDIF}
+
+
+// =======================================================
+//   Unit specific extensions
+// =======================================================
+
+// none - no special init required
+
+
+// =======================================================
+//   GL consts, types and functions
+// =======================================================
+
+
+// -------------------------------------------------------
+//   GL types
+// -------------------------------------------------------
+
+type
+  PSingle   = ^Single;
+  PDouble   = ^Double;
+
+  GLvoid    = Pointer;
+  GLboolean = Byte;
+
+  GLbyte    = ShortInt; // 1-byte signed
+  GLshort   = Integer;  // 2-byte signed
+  GLint     = LongInt;  // 4-byte signed
+
+  GLubyte   = Byte;     // 1-byte unsigned
+  GLushort  = Word;     // 2-byte unsigned
+  GLuint    = DWord;    // 4-byte signed
+
+  GLsizei   = LongInt;  // 4-byte signed
+
+  GLfloat   = Single;   // single precision float
+  GLclampf  = Single;	// single precision float in [0,1]
+  GLdouble  = Double;   // double precision float
+  GLclampd  = Double;	// double precision float in [0,1]
+
+  GLenum    = DWord;
+
+type
+  GLbitfield = DWord;  { was an enum - no corresponding thing in pascal }
+const
+  GL_CURRENT_BIT        = $00000001;
+  GL_POINT_BIT          = $00000002;
+  GL_LINE_BIT           = $00000004;
+  GL_POLYGON_BIT        = $00000008;
+  GL_POLYGON_STIPPLE_BIT= $00000010;
+  GL_PIXEL_MODE_BIT     = $00000020;
+  GL_LIGHTING_BIT       = $00000040;
+  GL_FOG_BIT            = $00000080;
+  GL_DEPTH_BUFFER_BIT   = $00000100;
+  GL_ACCUM_BUFFER_BIT   = $00000200;
+  GL_STENCIL_BUFFER_BIT = $00000400;
+  GL_VIEWPORT_BIT       = $00000800;
+  GL_TRANSFORM_BIT      = $00001000;
+  GL_ENABLE_BIT         = $00002000;
+  GL_COLOR_BUFFER_BIT   = $00004000;
+  GL_HINT_BIT           = $00008000;
+  GL_EVAL_BIT           = $00010000;
+  GL_LIST_BIT           = $00020000;
+  GL_TEXTURE_BIT        = $00040000;
+  GL_SCISSOR_BIT        = $00080000;
+  GL_ALL_ATTRIB_BITS    = $000fffff;
+
+
+// -------------------------------------------------------
+//   GL constants
+// -------------------------------------------------------
+
+{$IFDEF GL1_0}
+%GLDeclsIF10
+{$ENDIF GL1_0}
+
+{$IFDEF GL1_1}
+%GLDeclsIF11
+{$ENDIF GL1_1}
+
+{$IFDEF GL1_2}
+%GLDeclsIF12
+{$ENDIF GL1_2}
+
+const
+  // Utility
+  GL_VENDOR				= $1F00;
+  GL_RENDERER				= $1F01;
+  GL_VERSION				= $1F02;
+  GL_EXTENSIONS				= $1F03;
+
+  // Errors
+  GL_INVALID_VALUE			= $0501;
+  GL_INVALID_ENUM			= $0500;
+  GL_INVALID_OPERATION			= $0502;
+  GL_STACK_OVERFLOW			= $0503;
+  GL_STACK_UNDERFLOW			= $0504;
+  GL_OUT_OF_MEMORY			= $0505;
+
+
+// -------------------------------------------------------
+//   GL extensions constants
+// -------------------------------------------------------
+
+{$IFDEF EXTENSIONS}
+%GLDeclsIF10Ext
+{$ENDIF EXTENSIONS}
+
+{$IFDEF SGI_EXTENSIONS}
+%GLDeclsIF10SGI
+{$ENDIF SGI_EXTENSIONS}
+
+{$IFDEF MESA}
+%GLDeclsIF10Mesa
+{$ENDIF MESA}
+
+
+// -------------------------------------------------------
+//   GL procedures and functions
+// -------------------------------------------------------
+
+{$IFDEF GL1_0}
+%GLProcsPS10
+{$ENDIF GL1_0}
+
+{$IFDEF GL1_1}
+%GLProcsPS11
+{$ENDIF GL1_1}
+
+// -------------------------------------------------------
+//   GL Extensions
+// -------------------------------------------------------
+
+{$IFDEF EXTENSIONS}
+%GLProcsPS10Ext
+{$ENDIF EXTENSIONS}
+
+// library dependent extensions
+
+{$IFDEF SGI_EXTENSIONS}
+%GLProcsPS10SGI
+{$ENDIF SGI_EXTENSIONS}
+
+{$ifdef MESA}
+%GLProcsPS10Mesa
+{$endif MESA}
+
+
+// -------------------------------------------------------
+//   GL 1.2 Functions
+// -------------------------------------------------------
+
+{$IFDEF GL1_2}
+%GLProcsPS12
+{$ENDIF GL1_2}
+
+
+// =======================================================
+// =======================================================
+
+implementation
+
+{BEGIN}{OF INIT}
+END.

+ 99 - 0
packages/opengl/build2/glut_linux.tem

@@ -0,0 +1,99 @@
+{
+  $Id$
+
+  Translation of the Mesa GLUT headers for FreePascal
+  Linux Version, Copyright (C) 1999 Sebastian Guenther
+
+
+  Mesa 3-D graphics library
+  Version:  3.0
+  Copyright (C) 1995-1998  Brian Paul
+
+  This library is free software; you can redistribute it and/or
+  modify it under the terms of the GNU Library General Public
+  License as published by the Free Software Foundation; either
+  version 2 of the License, or (at your option) any later version.
+
+  This library 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
+  Library General Public License for more details.
+
+  You should have received a copy of the GNU Library General Public
+  License along with this library; if not, write to the Free
+  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+}
+
+
+{$MODE delphi}
+
+unit GLUT;
+
+interface
+
+uses GL;
+
+function InitGLUTFromLibrary(libname: PChar): Boolean;
+
+// determines automatically which library to use:
+function InitGLUT: Boolean;
+
+
+var
+  GLUTInitialized: Boolean;
+
+
+%GLUTDeclsIF
+%GLUTProcsPD
+
+
+implementation
+
+{$LINKLIB Xmu}
+
+function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlclose(handle: Pointer): LongInt; external 'dl';
+function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+
+function LoadLibrary(name: PChar): Pointer;
+begin
+  Result := dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY});
+end;
+
+procedure FreeLibrary(handle: Pointer);
+begin
+  dlclose(handle);
+end;
+
+function GetProc(handle: Pointer; name: PChar): Pointer;
+begin
+  Result := dlsym(handle, name);
+//  if Result = nil then WriteLn('Unresolved: ', name);
+end;
+
+var
+  libGLUT: Pointer;
+
+function InitGLUTFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLUT := LoadLibrary(libname);
+  if not Assigned(libGLUT) then exit;
+
+%GLUTProcsPL
+
+  GLUTInitialized := True;
+  Result := True;
+end;
+
+
+function InitGLUT: Boolean;
+begin
+  Result := InitGLUTFromLibrary('libglut.so.1');
+end;
+
+
+
+finalization
+  if Assigned(libGLUT) then FreeLibrary(libGLUT);
+end.

+ 114 - 0
packages/opengl/build2/glut_w32d.tem

@@ -0,0 +1,114 @@
+{$MODE delphi}
+
+unit GLUT;
+
+interface
+
+uses GL;
+
+{$IFDEF Linux}
+  {$DEFINE gldecl := cdecl}
+{$ELSE}
+  {$IFDEF Win32}
+    {$DEFINE gldecl := stdcall}
+  {$ENDIF}
+{$ENDIF}
+
+
+function InitGLUTFromLibrary(libname: PChar): Boolean;
+
+// determines automatically which library to use:
+function InitGLUT: Boolean;
+
+
+var
+  GLUTInitialized: Boolean;
+
+
+%GLUTDeclsIF
+
+%GLUTProcsPD
+
+
+implementation
+
+{$IFDEF Linux}
+{$LINKLIB Xmu}
+type
+  HInstance = LongWord;
+
+function dlopen(AFile: PChar; mode: LongInt): Pointer; external 'dl';
+function dlclose(handle: Pointer): LongInt; external 'dl';
+function dlsym(handle: Pointer; name: PChar): Pointer; external 'dl';
+
+function LoadLibrary(name: PChar): HInstance;
+begin
+  Result := LongWord(dlopen(name, $101 {RTLD_GLOBAL or RTLD_LAZY}));
+end;
+
+procedure FreeLibrary(handle: HInstance);
+begin
+  dlclose(Pointer(handle));
+end;
+
+function GetProcAddress(handle: HInstance; name: PChar): Pointer;
+begin
+  Result := dlsym(Pointer(handle), name);
+  if Result = nil then WriteLn('Unresolved: ', name);
+end;
+
+{$ENDIF}
+
+{$IFDEF Win32}
+type
+  HInstance = LongWord;
+
+function LoadLibrary(name: PChar): HInstance;
+begin
+  Result := 0;
+end;
+
+procedure FreeLibrary(handle: HInstance);
+begin
+end;
+
+function GetProcAddress(handle: HInstance; name: PChar): Pointer;
+begin
+  Result := NIL;
+  if Result = nil then WriteLn('Unresolved: ', name);
+end;
+{$ENDIF}
+
+var
+  libGLUT: HInstance;
+
+function InitGLUTFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLUT := LoadLibrary(libname);
+  if libGLUT = 0 then exit;
+
+%GLUTProcsPL
+
+  GLUTInitialized := True;
+  Result := True;
+end;
+
+
+function InitGLUT: Boolean;
+begin
+{$IFDEF Win32}
+  Result := InitGLUTFromLibrary('glut32.dll');
+{$ELSE}
+  {$IFDEF Linux}
+  Result := InitGLUTFromLibrary('libglut.so');
+  {$ELSE}
+    {$ERROR Unsupported platform}
+  {$ENDIF}
+{$ENDIF}
+end;
+
+
+finalization
+  if libGLUT <> 0 then FreeLibrary(libGLUT);
+end.

+ 50 - 0
packages/opengl/build2/glut_w32s.tem

@@ -0,0 +1,50 @@
+{
+  $Id$
+
+  Translation of the GLUT headers for FreePascal
+  Copyright (C) 1999 Sebastian Guenther
+  Version for static linking in Win32 environment by Alexander Stohr.
+  Latest change: 1999-11-13
+
+  Further information:
+
+  GLUT is a powerful toolkit for programming multiplatform OpenGL
+  applications. It was designed by Mark J. Kilgard while working for SGI,
+  he is now working for nVidia.
+}
+{ this translation of the c header files is done by Sebastian Guenther 1999 }
+{ version for static linking for Win32 platforms done by Alexander Stohr 1999 }
+
+{$MODE delphi}
+
+{You have to enable Macros (compiler switch "-Sm") for compiling this unit!
+ This is necessary for supporting different platforms with different calling
+ conventions via a single unit.}
+
+unit GLUT_SL; { version which does statically linking }
+
+
+interface
+
+uses GL_SL;
+
+{x$DEFINE GLUT_GAME} {enable if you need game mode sub api}
+
+{$IFDEF Win32}
+  {$DEFINE glut_dll := external 'glut32.dll'}
+  {$DEFINE glut_callback := cdecl}
+{$ELSE}
+  {$MESSAGE Unsupported platform.}
+{$ENDIF}
+
+
+%GLUTDeclsIF
+
+%GLUTProcsPS
+
+
+implementation
+
+
+{begin{of init}
+end.