浏览代码

* Added new unit generation tools and auto-generated GL units for Linux

sg 26 年之前
父节点
当前提交
eaf94d955c

+ 956 - 0
packages/opengl/Makefile

@@ -0,0 +1,956 @@
+#
+# Makefile generated by fpcmake v0.99.13 on 1999-11-27 22:12
+#
+
+defaultrule: all
+
+#####################################################################
+# 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 search separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+
+#####################################################################
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+ifdef inOS2
+export FPC=ppos2$(EXEEXT)
+else
+export FPC=ppc386$(EXEEXT)
+endif
+endif
+
+# Target OS
+ifndef OS_TARGET
+export OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+export OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+export CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+export CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+export FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+#####################################################################
+# Default Settings
+#####################################################################
+
+# Release ? Then force OPT and don't use extra opts via commandline
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef RELEASE
+override OPT:=-Xs -OG2p3 -n
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override OPT+=-vwni
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override OPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
+
+#####################################################################
+# User Settings
+#####################################################################
+
+
+# Targets
+
+override UNITOBJECTS+=buildgl
+override EXEOBJECTS+=c_linuxd
+
+# Clean
+
+
+# Install
+
+ZIPTARGET=install
+
+# Defaults
+
+
+# Directories
+
+ifndef PACKAGEDIR
+PACKAGEDIR=$(FPCDIR)/packages
+endif
+ifndef COMPONENTDIR
+COMPONENTDIR=$(FPCDIR)/components
+endif
+
+# Packages
+
+
+# Libraries
+
+
+# Info
+
+INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Default Directories
+#####################################################################
+
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+export PREFIXINSTALLDIR=/usr
+else
+export PREFIXINSTALLDIR=/pp
+endif
+endif
+
+# create fcldir,rtldir,unitdir
+ifdef FPCDIR
+ifneq ($(FPCDIR),.)
+override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
+override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
+override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+
+#####################################################################
+# 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)/$(UNITPREFIX)/$(OS_TARGET)
+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
+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 EXTRAINSTALLDIR
+EXTRAINSTALLDIR=$(BASEINSTALLDIR)
+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
+
+# Smartlinking
+ifdef SMARTLINK
+override FPCOPT+=-CX
+endif
+
+# Debug
+ifdef DEBUG
+override FPCOPT+=-g
+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
+
+override COMPILER=$(FPC) $(FPCOPT)
+
+#####################################################################
+# Shell tools
+#####################################################################
+
+# To copy pograms
+ifndef COPY
+export COPY:=cp -fp
+endif
+
+# Copy a whole tree
+ifndef COPYTREE
+export COPYTREE:=cp -rfp
+endif
+
+# To move pograms
+ifndef MOVE
+export MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+export DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+export DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+export INSTALL:=install -m 644
+else
+export INSTALL:=$(COPY)
+endif
+endif
+
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+export INSTALLEXE:=install -m 755
+else
+export INSTALLEXE:=$(COPY)
+endif
+endif
+
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+export MKDIR:=install -m 755 -d
+else
+export MKDIR:=ginstall -m 755 -d
+endif
+endif
+
+#####################################################################
+# Default Tools
+#####################################################################
+
+# file used to check if a package is compiled
+ifndef FPCMAKED
+FPCMAKED=fpcmaked
+endif
+
+# 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
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS=@$(PPAS)
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+export ECHO:=echo
+else
+export ECHO:=$(firstword $(ECHO))
+endif
+endif
+
+# ppdep
+ifndef PPDEP
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPDEP),)
+PPDEP=
+else
+export PPDEP:=$(firstword $(PPDEP))
+endif
+endif
+
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+export PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+export PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+
+# 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
+export UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+
+# gdate/date
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+export DATE:=$(firstword $(DATE))
+endif
+else
+export DATE:=$(firstword $(DATE))
+endif
+endif
+
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
+endif
+endif
+
+ifndef ZIPEXT
+ZIPEXT=.zip
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+PACKAGESUFFIX=
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+PACKAGESUFFIX=v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+PACKAGESUFFIX=linux
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=win32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=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
+
+#####################################################################
+# 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
+
+zipinstalladd: fpc_zipinstalladd
+
+clean: fpc_clean
+
+cleanall: fpc_cleanall
+
+info: fpc_info
+
+.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
+
+#####################################################################
+# Package depends
+#####################################################################
+
+ifneq ($(wildcard $(RTLDIR)),)
+ifeq ($(wildcard $(RTLDIR)/$(FPCMAKED)),)
+override COMPILEPACKAGES+=rtl
+rtl_package:
+	$(MAKE) -C $(RTLDIR) all
+endif
+endif
+
+.PHONY:  rtl_package
+
+#####################################################################
+# 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_all fpc_debug
+
+$(FPCMAKED):
+	@$(ECHO) Compiled > $(FPCMAKED)
+
+fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
+	 $(addsuffix _component,$(COMPILECOMPONENTS)) \
+	 $(ALLTARGET) $(FPCMAKED)
+
+fpc_debug:
+	$(MAKE) all DEBUG=1
+
+# General compile rules, available for both possible PASEXT
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_smart fpc_shared
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+endif
+
+fpc_smart:
+	$(MAKE) all SMARTLINK=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=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+endif
+endif
+
+fpc_showinstall: $(SHOWINSTALLTARGET)
+ifdef INSTALLEXEFILES
+	@$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
+endif
+ifdef INSTALLPPUFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	@$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(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) $(EXTRAINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
+endif
+
+#####################################################################
+# Source install rules
+#####################################################################
+
+.PHONY: fpc_sourceinstall
+
+fpc_sourceinstall: clean
+	$(MKDIR) $(SOURCEINSTALLDIR)
+	$(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall fpc_zipinstalladd
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Test dir if none specified
+ifndef DESTZIPDIR
+DESTZIPDIR=$(BASEDIR)
+endif
+
+# Add .zip/.tar.gz extension
+ifdef ZIPNAME
+ifndef inlinux
+override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
+endif
+endif
+
+# Note: This will not remove the zipfile first
+fpc_zipinstalladd:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
+	cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
+	gzip $(DESTZIPDIR)/$(ZIPNAME).tar
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+# First remove the zip and then install
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_cleanall
+
+ifdef EXTRACLEANUNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
+endif
+
+ifdef CLEANPPUFILES
+ifdef PPUFILES
+CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES=$(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 EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(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
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)
+	@$(ECHO)
+

+ 31 - 0
packages/opengl/README

@@ -0,0 +1,31 @@
+Free Pascal GL* Units
+(c) 1999 Sebastian Guenther
+
+
+buildgl.pp
+----------
+This unit only contains the class "TDefReader", which reads .def files and
+holds the informations in the read .def file.
+
+
+c_linuxd.pp
+-----------
+This program creates the dynamic Linux units "linuxd/gl.pp" and
+"linuxd/glut.pp".
+
+*.def
+-----
+These are definition files, which hold all declarations common to all
+platforms. It may contain two sections:
+All lines between "%COPY_INTERFACE" and "%END" are just inserted into the
+interface section of generated units; the lines between "%PROCS" and "%END"
+are procedure and function definitions. Comments are preserved.
+Comments within the .def file (which don't appear in generated units) have
+a "#" character at the beginning of the line.
+
+
+*.tpl
+-----
+Template files; these files are the skeleton for the generated units. Within
+a template file, lines beginning with "%" mark special positions where the
+generator inserts its stuff read and possibly converted from .def files.

+ 71 - 0
packages/opengl/buildgl.pp

@@ -0,0 +1,71 @@
+{
+  $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  1999-11-28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+}

+ 157 - 0
packages/opengl/c_linuxd.pp

@@ -0,0 +1,157 @@
+{
+  $Id$
+
+  GL unit creation tool for Linux dynamic version
+  (c) 1999 Sebastian Guenther, [email protected]
+}
+
+{$MODE objfpc}
+{$H+}
+
+program c_linuxd;
+uses SysUtils, Classes, buildgl;
+var
+  f: Text;
+
+procedure PrintInterface(lines: TStringList; var dest: Text);
+var
+  i: Integer;
+begin
+  for i := 0 to lines.Count - 1 do
+    WriteLn(dest, lines.Strings[i]);
+end;
+
+procedure PrintProcDecls(procs: TStringList);
+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(f, s)
+    else if j = 0 then
+      WriteLn(f, s, ' cdecl;')
+    else
+      WriteLn(f, TrimRight(Copy(s, 1, j - 1)), ' cdecl; ', Copy(s, j, Length(s)));
+  end;
+end;
+
+procedure PrintProcLoaders(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(f, '  ', s, ' := GetProc(', libname, ', ''', s, ''');');
+  end;
+end;
+
+procedure PrintCVSLogSection;
+begin
+  WriteLn(f);
+  WriteLn(f);
+  WriteLn(f, '{');
+  WriteLn(f, '  $', 'Log:$');  // needed because _this_ file might be in CVS, too
+  WriteLn(f, '}');
+end;
+
+var
+  DefGL, DefGLExt, DefGLU, DefGLX, DefGLUT: TDefReader;
+  tpl: Text;
+  s: String;
+  j: Integer;
+begin
+
+  // Load definition files
+
+  DefGL    := TDefReader.Create('gl.def');
+  DefGLExt := TDefReader.Create('glext.def');
+  DefGLU   := TDefReader.Create('glu.def');
+  DefGLX   := TDefReader.Create('glx.def');
+  DefGLUT  := TDefReader.Create('glut.def');
+
+
+  // Build GL unit
+
+  Assign(f, 'linuxd/gl.pp');
+  Rewrite(f);
+  Assign(tpl, 'gl_linux.tpl');
+  Reset(tpl);
+  while not EOF(tpl) do begin
+    ReadLn(tpl, s);
+    if Copy(s, 1, 1) = '%' then begin
+      if s = '%GLDecls' then
+        PrintInterface(DefGL.InterfaceBlock, f)
+      else if s = '%GLProcs1' then
+        PrintProcDecls(DefGL.Procs)
+      else if s = '%GLProcs2' then
+        PrintProcLoaders(DefGL.Procs, 'libgl')
+      else if s = '%GLExtDecls' then
+	PrintInterface(DefGLExt.InterfaceBlock, f)
+      else if s = '%GLExtProcs1' then
+	PrintProcDecls(DefGLExt.Procs)
+      else if s = '%GLExtProcs2' then
+        PrintProcLoaders(DefGLExt.Procs, 'libgl')
+      else if s = '%GLUDecls' then
+	PrintInterface(DefGLU.InterfaceBlock, f)
+      else if s = '%GLUProcs1' then
+	PrintProcDecls(DefGLU.Procs)
+      else if s = '%GLUProcs2' then
+        PrintProcLoaders(DefGLU.Procs, 'libglu')
+      else if s = '%GLXDecls' then
+	PrintInterface(DefGLX.InterfaceBlock, f)
+      else if s = '%GLXProcs1' then
+	PrintProcDecls(DefGLX.Procs)
+      else if s = '%GLXProcs2' then
+        PrintProcLoaders(DefGLX.Procs, 'libglx')
+      else
+        WriteLn(f, '// ### c_linuxd: Don''t know what to insert here!: ', s);
+    end else if Copy(s, 1, 1) <> '#' then
+      WriteLn(f, s);
+  end;
+  PrintCVSLogSection;
+  Close(f);
+
+
+  // Build GLUT unit
+
+  Assign(f, 'linuxd/glut.pp');
+  Rewrite(f);
+  Assign(tpl, 'glut_linux.tpl');
+  Reset(tpl);
+  while not EOF(tpl) do begin
+    ReadLn(tpl, s);
+    if Copy(s, 1, 1) = '%' then begin
+      if s = '%GLUTDecls' then
+        PrintInterface(DefGLUT.InterfaceBlock, f)
+      else if s = '%GLUTProcs1' then
+        PrintProcDecls(DefGLUT.Procs)
+      else if s = '%GLUTProcs2' then
+        PrintProcLoaders(DefGLUT.Procs, 'libglut')
+      else
+        WriteLn(f, '// ### c_linuxd: Don''t know what to insert here!: ', s);
+    end else 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;
+  PrintCVSLogSection;
+  Close(f);
+end.
+
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+}

+ 941 - 0
packages/opengl/demos/Makefile

@@ -0,0 +1,941 @@
+#
+# Makefile generated by fpcmake v0.99.13 on 1999-11-28 18:26
+#
+
+defaultrule: all
+
+#####################################################################
+# 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 search separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+
+#####################################################################
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+ifdef inOS2
+export FPC=ppos2$(EXEEXT)
+else
+export FPC=ppc386$(EXEEXT)
+endif
+endif
+
+# Target OS
+ifndef OS_TARGET
+export OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+export OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+export CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+export CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+export FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+#####################################################################
+# Default Settings
+#####################################################################
+
+# Release ? Then force OPT and don't use extra opts via commandline
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef RELEASE
+override OPT:=-Xs -OG2p3 -n
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override OPT+=-vwni
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override OPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
+
+#####################################################################
+# User Settings
+#####################################################################
+
+
+# Targets
+
+override EXEOBJECTS+=glutdemo
+
+# Clean
+
+
+# Install
+
+ZIPTARGET=install
+
+# Defaults
+
+
+# Directories
+
+ifndef PACKAGEDIR
+PACKAGEDIR=$(FPCDIR)/packages
+endif
+ifndef COMPONENTDIR
+COMPONENTDIR=$(FPCDIR)/components
+endif
+
+# Packages
+
+
+# Libraries
+
+
+# Info
+
+INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Default Directories
+#####################################################################
+
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+export PREFIXINSTALLDIR=/usr
+else
+export PREFIXINSTALLDIR=/pp
+endif
+endif
+
+# create fcldir,rtldir,unitdir
+ifdef FPCDIR
+ifneq ($(FPCDIR),.)
+override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
+override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
+override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+
+#####################################################################
+# 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)/$(UNITPREFIX)/$(OS_TARGET)
+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
+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 EXTRAINSTALLDIR
+EXTRAINSTALLDIR=$(BASEINSTALLDIR)
+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
+
+# Smartlinking
+ifdef SMARTLINK
+override FPCOPT+=-CX
+endif
+
+# Debug
+ifdef DEBUG
+override FPCOPT+=-g
+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
+
+override COMPILER=$(FPC) $(FPCOPT)
+
+#####################################################################
+# Shell tools
+#####################################################################
+
+# To copy pograms
+ifndef COPY
+export COPY:=cp -fp
+endif
+
+# Copy a whole tree
+ifndef COPYTREE
+export COPYTREE:=cp -rfp
+endif
+
+# To move pograms
+ifndef MOVE
+export MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+export DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+export DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+export INSTALL:=install -m 644
+else
+export INSTALL:=$(COPY)
+endif
+endif
+
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+export INSTALLEXE:=install -m 755
+else
+export INSTALLEXE:=$(COPY)
+endif
+endif
+
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+export MKDIR:=install -m 755 -d
+else
+export MKDIR:=ginstall -m 755 -d
+endif
+endif
+
+#####################################################################
+# Default Tools
+#####################################################################
+
+# file used to check if a package is compiled
+ifndef FPCMAKED
+FPCMAKED=fpcmaked
+endif
+
+# 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
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS=@$(PPAS)
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+export ECHO:=echo
+else
+export ECHO:=$(firstword $(ECHO))
+endif
+endif
+
+# ppdep
+ifndef PPDEP
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPDEP),)
+PPDEP=
+else
+export PPDEP:=$(firstword $(PPDEP))
+endif
+endif
+
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+export PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+export PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+
+# 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
+export UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+
+# gdate/date
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+export DATE:=$(firstword $(DATE))
+endif
+else
+export DATE:=$(firstword $(DATE))
+endif
+endif
+
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
+endif
+endif
+
+ifndef ZIPEXT
+ZIPEXT=.zip
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+PACKAGESUFFIX=
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+PACKAGESUFFIX=v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+PACKAGESUFFIX=linux
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=win32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=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
+
+#####################################################################
+# 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
+
+zipinstalladd: fpc_zipinstalladd
+
+clean: fpc_clean
+
+cleanall: fpc_cleanall
+
+info: fpc_info
+
+.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
+
+#####################################################################
+# Package depends
+#####################################################################
+
+ifneq ($(wildcard $(RTLDIR)),)
+ifeq ($(wildcard $(RTLDIR)/$(FPCMAKED)),)
+override COMPILEPACKAGES+=rtl
+rtl_package:
+	$(MAKE) -C $(RTLDIR) all
+endif
+endif
+
+.PHONY:  rtl_package
+
+#####################################################################
+# 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_all fpc_debug
+
+$(FPCMAKED):
+	@$(ECHO) Compiled > $(FPCMAKED)
+
+fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
+	 $(addsuffix _component,$(COMPILECOMPONENTS)) \
+	 $(ALLTARGET) $(FPCMAKED)
+
+fpc_debug:
+	$(MAKE) all DEBUG=1
+
+# General compile rules, available for both possible PASEXT
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_smart fpc_shared
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+endif
+
+fpc_smart:
+	$(MAKE) all SMARTLINK=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=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+endif
+endif
+
+fpc_showinstall: $(SHOWINSTALLTARGET)
+ifdef INSTALLEXEFILES
+	@$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
+endif
+ifdef INSTALLPPUFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	@$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(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) $(EXTRAINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
+endif
+
+#####################################################################
+# Source install rules
+#####################################################################
+
+.PHONY: fpc_sourceinstall
+
+fpc_sourceinstall: clean
+	$(MKDIR) $(SOURCEINSTALLDIR)
+	$(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall fpc_zipinstalladd
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Test dir if none specified
+ifndef DESTZIPDIR
+DESTZIPDIR=$(BASEDIR)
+endif
+
+# Add .zip/.tar.gz extension
+ifdef ZIPNAME
+ifndef inlinux
+override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
+endif
+endif
+
+# Note: This will not remove the zipfile first
+fpc_zipinstalladd:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
+	cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
+	gzip $(DESTZIPDIR)/$(ZIPNAME).tar
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+# First remove the zip and then install
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_cleanall
+
+ifdef EXTRACLEANUNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
+endif
+
+ifdef CLEANPPUFILES
+ifdef PPUFILES
+CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES=$(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 EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(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
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)
+	@$(ECHO)
+

+ 92 - 0
packages/opengl/demos/Makefile.fpc

@@ -0,0 +1,92 @@
+#
+#   Makefile.fpc for GL demos
+#
+
+[targets]
+; The units which should be compiled
+units=
+; The programs which should be compiled
+programs=glutdemo
+
+
+[defaults]
+; the default build target should only compile the units ?
+defaultunits=0
+; What is the default rule to call
+defaultrule=all
+; force target OS
+defaulttarget=
+; force target CPU
+defaultcpu=
+; options needed to compile (like -S2 or -Sg)
+defaultoptions=
+
+
+[dirs]
+; what is the default location of FPC
+fpcdir=
+; which dirs need to be searched for units
+unitdir=
+; which dirs need to be searched for libs
+libdir=
+; which dirs need to be searched for object files
+objdir=
+; which dirs need to be searched for include files
+incdir=
+; where to place the created units/files
+targetdir=
+; where to place the created units
+unittargetdir=
+
+
+[libs]
+; linking with libgcc.a needed ?
+libgcc=0
+; linking with other libraries needed (not in the /lib;/usr/lib;/usr/X11R6/lib)
+libother=0
+
+
+[tools]
+; sed needed?
+toolsed=0
+; cmp needed?
+toolcmp=0
+; diff needed?
+tooldiff=0
+; try to use upx for compression ?
+toolupx=1
+; date needed?
+tooldate=1
+; zip needed?
+toolzip=1
+
+
+[info]
+; show configuration info
+infocfg=1
+; show directory info
+infodir=0
+; show which tools are found
+infotools=0
+; show install dirs
+infoinstall=1
+; show build objects
+infoobjects=1
+; show files found in current dir
+infofiles=0
+
+
+[presettings]
+; Add here the makefile commands which need to be done at the beginning
+; of the user settings section
+
+
+[postsettings]
+; Add here the makefile commands which need to be done at the end
+; of the user settings section
+
+
+[rules]
+; here you can add your own rules, the general rules will automaticly
+; remove the defaults which call fpc_<rule>.
+

+ 154 - 0
packages/opengl/demos/glutdemo.pp

@@ -0,0 +1,154 @@
+{
+  GL units for Free Pascal - GLUT demo
+  1999 Sebastian Guenther, [email protected]
+
+  You may use this source as starting point for your own programs; consider it
+  as Public Domain.
+}
+
+
+{$MODE objfpc}
+{$H+}
+
+program GLUTDemo;
+uses GL, GLUT;
+
+const
+
+  FPCImg: array[0..4, 0..10] of Byte =
+    ((1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1),
+     (1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0),
+     (1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0),
+     (1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0),
+     (1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1));
+
+var
+  counter: Integer;
+
+
+const
+  colors: array[0..7, 0..2] of Single =
+    ((0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1),
+     (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1));
+  corners: array[0..7, 0..2] of Single =
+    ((-1, -1, -1), (+1, -1, -1), (+1, +1, -1), (-1, +1, -1),
+     (-1, -1, +1), (+1, -1, +1), (+1, +1, +1), (-1, +1, +1));
+
+
+procedure DrawCube;
+  procedure DrawSide(i1, i2, i3, i4: Integer);
+  begin
+    glColor4f (colors [i1, 0], colors [i1, 1], colors [i1, 2], 0.5);
+    glVertex3f(corners[i1, 0], corners[i1, 1], corners[i1, 2]);
+    glColor4f (colors [i2, 0], colors [i2, 1], colors [i2, 2], 0.5);
+    glVertex3f(corners[i2, 0], corners[i2, 1], corners[i2, 2]);
+    glColor4f (colors [i3, 0], colors [i3, 1], colors [i3, 2], 0.5);
+    glVertex3f(corners[i3, 0], corners[i3, 1], corners[i3, 2]);
+    
+    glVertex3f(corners[i4, 0], corners[i4, 1], corners[i4, 2]);
+  end;
+begin
+  glBegin(GL_QUADS);
+  DrawSide(4, 5, 6, 7);		// Front
+  DrawSide(3, 2, 1, 0);		// Back
+  DrawSide(2, 3, 7, 6);		// Top
+  DrawSide(0, 1, 5, 4);		// Bottom
+  DrawSide(4, 7, 3, 0);		// Left
+  DrawSide(1, 2, 6, 5);		// Right
+  glEnd;
+end;
+
+
+procedure DisplayWindow; cdecl;
+var
+  x, y: Integer;
+begin
+  Inc(counter);
+
+  glClearColor(0, 0, 0.2, 1);
+  glClear([GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT]);
+
+  glPushMatrix;
+  glTranslatef(0, 0, Sin(Single(counter) / 20.0) * 5.0 - 5.0);
+  glRotatef(Sin(Single(counter) / 200.0) * 720.0, 0, 1, 0);
+  glRotatef(counter, 0, 0, 1);
+
+  for y := 0 to 4 do
+    for x := 0 to 10 do
+      if FPCImg[y, x] > 0 then begin
+        glPushMatrix;
+	glRotatef(x * Sin(Single(counter) / 5.0), 0, 1, 0);
+	glRotatef(y * Sin(Single(counter) / 12.0) * 4.0, 0, 0, 1);
+        glTranslatef((x - 5) * 1, (2 - y) * 1, 0);
+        glScalef(0.4, 0.4, 0.4);
+        glRotatef(counter, 0.5, 1, 0);
+        DrawCube;
+        glPopMatrix;
+      end;
+
+  glPopMatrix;
+
+  Inc(counter);
+
+  glutSwapBuffers;
+end;
+
+procedure OnTimer(value: Integer); cdecl;
+begin
+  glutPostRedisplay;
+  glutTimerFunc(20, @OnTimer, 0);
+end;
+
+begin
+
+  if not InitGl then begin
+    WriteLn('OpenGL is not supported on this system');
+    Halt(2);
+  end;
+
+  if not InitGLU then begin
+    WriteLn('Couldn''t load GLU module');
+    Halt(3);
+  end;
+
+  if not InitGLX then begin
+    WriteLn('Couldn''t load GLX module');
+    Halt(4);
+  end;
+
+  if not InitGLUT then begin
+    WriteLn('Couldn''t load GLUT module');
+    Halt(5);
+  end;
+
+  glutInitDisplayMode(GLUT_RGB or GLUT_DOUBLE or GLUT_DEPTH);
+  glutCreateWindow('Free Pascal  GLUT demo');
+  glutDisplayFunc(@DisplayWindow);
+  glutTimerFunc(20, @OnTimer, 0);
+
+
+  WriteLn('GL info:');
+  WriteLn('  Vendor: ', glGetString(GL_VENDOR));
+  WriteLn('  Renderer: ', glGetString(GL_RENDERER));
+  WriteLn('  Version: ', glGetString(GL_VERSION));
+  WriteLn('  Extensions: ', glGetString(GL_EXTENSIONS));
+
+  // Enable backface culling
+  glEnable(GL_CULL_FACE);
+
+  // Set up depth buffer
+  glEnable(GL_DEPTH_TEST);
+  glDepthFunc(GL_LESS);
+
+  // Set up projection matrix
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity;
+  gluPerspective(90, 1.3, 0.1, 100);
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity;
+  glTranslatef(0, 0, -5.5);
+
+
+  glutMainLoop;
+
+end.

+ 1037 - 0
packages/opengl/gl.def

@@ -0,0 +1,1037 @@
+# This is the definition file for all GL functions and types.
+
+%COPY_INTERFACE
+// ===================================================================
+//   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;
+
+  // 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
+// -------------------------------------------------------------------
+
+var
+%END
+
+
+#=====================================================================
+# Procedures and functions
+#=====================================================================
+
+%PROCS
+  // Miscellaneous
+  glClearIndex: procedure(c: Single);
+  glClearColor: procedure(red, green, blue, alpha: GLclampf);
+  glClear: procedure(mask: GLbitfield);
+  glIndexMask: procedure(mask: LongWord);
+  glColorMask: procedure(red, green, blue, alpha: Boolean);
+  glAlphaFunc: procedure(func: GLenum; ref: GLclampf);
+  glBlendFunc: procedure(sfactor, dfactor: GLenum);
+  glLogicOp: procedure(opcode: GLenum);
+  glCullFace: procedure(mode: GLenum);
+  glFrontFace: procedure(mode: GLenum);
+  glPointSize: procedure(size: Single);
+  glLineWidth: procedure(width: Single);
+  glLineStipple: procedure(factor: LongInt; pattern: Word);
+  glPolygonMode: procedure(face, mode: GLenum);
+  glPolygonOffset: procedure(factor, units: Single);
+  glPolygonStipple: procedure(var mask: Byte);
+  glGetPolygonStipple: procedure(var mask: Byte);
+  glEdgeFlag: procedure(flag: Boolean);
+  glEdgeFlagv: procedure(var flag: Boolean);
+  glScissor: procedure(x, y, width, height: LongInt);
+  glClipPlane: procedure(plane: GLenum; var equation: Double);
+  glGetClipPlane: procedure(plane: GLenum; var equation: Double);
+  glDrawBuffer: procedure(mode: GLenum);
+  glReadBuffer: procedure(mode: GLenum);
+  glEnable: procedure(cap: LongInt);
+  glDisable: procedure(cap: LongInt);
+  glIsEnabled: function(cap: GLenum): Boolean;
+  glEnableClientState: procedure(cap: GLenum);  // 1.1
+  glDisableClientState: procedure(cap: GLenum);  // 1.1
+  glGetBooleanv: procedure(pname: GLenum; var params: Boolean);
+  glGetDoublev: procedure(pname: GLenum; var params: Double);
+  glGetFloatv: procedure(pname: GLenum; var params: Single);
+  glGetIntegerv: procedure(pname: GLenum; var params: LongInt);
+  glPushAttrib: procedure(mask: GLbitfield);
+  glPopAttrib: procedure;
+  glPushClientAttrib: procedure(mask: GLbitfield);  // 1.1
+  glPopClientAttrib: procedure;  // 1.1
+  glRenderMode: function(mode: GLenum): LongInt;
+  glGetError: function: GLenum;
+  glGetString: function(name: GLenum): PChar;
+  glFinish: procedure;
+  glFlush: procedure;
+  glHint: procedure(target, mode: GLenum);
+
+
+  // Depth Buffer
+  glClearDepth: procedure(depth: GLclampd);
+  glDepthFunc: procedure(func: LongInt);
+  glDepthMask: procedure(flag: Boolean);
+  glDepthRange: procedure(near_val, far_val: GLclampd);
+
+  // Accumulation Buffer
+  glClearAccum: procedure(red, green, blue, alpha: Single);
+  glAccum: procedure(op: GLenum; value: Single);
+
+  // Tranformation
+  glMatrixMode: procedure(mode: GLenum);
+  glOrtho: procedure(left, right, bottom, top, near_val, far_val: Double);
+  glFrustum: procedure(left, right, bottom, top, near_val, far_val: Double);
+  glViewport: procedure(x, y, width, height: LongInt);
+  glPushMatrix: procedure;
+  glPopMatrix: procedure;
+  glLoadIdentity: procedure;
+  glLoadMatrixd: procedure(var m: Double);
+  glLoadMatrixf: procedure(var m: PSingle);
+  glMultMatrixd: procedure(var m: Double);
+  glMultMatrixf: procedure(var m: Single);
+  glRotated: procedure(angle, x, y, z: Double);
+  glRotatef: procedure(angle, x, y, z: Single);
+  glScaled: procedure(x, y, z: Double);
+  glScalef: procedure(x, y, z: Single);
+  glTranslated: procedure(x, y, z: Double);
+  glTranslatef: procedure(x, y, z: Single);
+
+  // Display Lists
+  glIsList: function(list: LongWord): Boolean;
+  glDeleteLists: procedure(list: LongWord; range: LongInt);
+  glGenLists: function(range: LongInt): LongWord;
+  glNewList: procedure(list: LongWord; mode: GLenum);
+  glEndList: procedure;
+  glCallList: procedure(list: LongWord);
+  glCallLists: procedure(n: LongInt; AType: GLenum; var lists);
+  glListBase: procedure(base: LongWord);
+
+  // Drawing Functions
+  glBegin: procedure(mode: GLenum);
+  glEnd: procedure;
+  glVertex2d: procedure(x, y: Double);
+  glVertex2f: procedure(x, y: Single);
+  glVertex2i: procedure(x, y: LongInt);
+  glVertex2s: procedure(x, y: SmallInt);
+  glVertex3d: procedure(x, y, z: Double);
+  glVertex3f: procedure(x, y, z: Single);
+  glVertex3i: procedure(x, y, z: LongInt);
+  glVertex3s: procedure(x, y, z: SmallInt);
+  glVertex4d: procedure(x, y, z, w: Double);
+  glVertex4f: procedure(x, y, z, w: Single);
+  glVertex4i: procedure(x, y, z, w: LongInt);
+  glVertex4s: procedure(x, y, z, w: SmallInt);
+  glVertex2dv: procedure(var v: Double);
+  glVertex2fv: procedure(var v: Single);
+  glVertex2iv: procedure(var v: LongInt);
+  glVertex2sv: procedure(var v: SmallInt);
+  glVertex3dv: procedure(var v: Double);
+  glVertex3fv: procedure(var v: Single);
+  glVertex3iv: procedure(var v: LongInt);
+  glVertex3sv: procedure(var v: SmallInt);
+  glVertex4dv: procedure(var v: Double);
+  glVertex4fv: procedure(var v: Single);
+  glVertex4iv: procedure(var v: LongInt);
+  glVertex4sv: procedure(var v: SmallInt);
+  glNormal3b: procedure(nx, ny, nz: Byte);
+  glNormal3d: procedure(nx, ny, nz: Double);
+  glNormal3f: procedure(nx, ny, nz: Single);
+  glNormal3i: procedure(nx, ny, nz: LongInt);
+  glNormal3s: procedure(nx, ny, nz: SmallInt);
+  glNormal3bv: procedure(var v: ShortInt);
+  glNormal3dv: procedure(var v: Double);
+  glNormal3fv: procedure(var v: Single);
+  glNormal3iv: procedure(var v: LongInt);
+  glNormal3sv: procedure(var v: SmallInt);
+  glIndexd: procedure(c: Double);
+  glIndexf: procedure(c: Single);
+  glIndexi: procedure(c: LongInt);
+  glIndexs: procedure(c: SmallInt);
+  glIndexub: procedure(c: Byte);  // 1.1
+  glIndexdv: procedure(var c: Double);
+  glIndexfv: procedure(var c: Single);
+  glIndexiv: procedure(var c: LongInt);
+  glIndexsv: procedure(var c: SmallInt);
+  glIndexubv: procedure(var c: Byte);  // 1.1
+  glColor3b : procedure(red, green, blue: ShortInt);
+  glColor3d : procedure(red, green, blue: Double);
+  glColor3f : procedure(red, green, blue: Single);
+  glColor3i : procedure(red, green, blue: LongInt);
+  glColor3s : procedure(red, green, blue: SmallInt);
+  glColor3ub: procedure(red, green, blue: Byte);
+  glColor3ui: procedure(red, green, blue: LongWord);
+  glColor3us: procedure(red, green, blue: Word);
+  glColor4b : procedure(red, green, blue, alpha: ShortInt);
+  glColor4d : procedure(red, green, blue, alpha: Double);
+  glColor4f : procedure(red, green, blue, alpha: Single);
+  glColor4i : procedure(red, green, blue, alpha: LongInt);
+  glColor4s : procedure(red, green, blue, alpha: SmallInt);
+  glColor4ub: procedure(red, green, blue, alpha: Byte);
+  glColor4ui: procedure(red, green, blue, alpha: LongWord);
+  glColor4us: procedure(red, green, blue, alpha: Word);
+  glColor3bv : procedure(var v: ShortInt);
+  glColor3dv : procedure(var v: Double);
+  glColor3fv : procedure(var v: Single);
+  glColor3iv : procedure(var v: LongInt);
+  glColor3sv : procedure(var v: SmallInt);
+  glColor3ubv: procedure(var v: Byte);
+  glColor3uiv: procedure(var v: LongWord);
+  glColor3usv: procedure(var v: Word);
+  glColor4bv : procedure(var v: ShortInt);
+  glColor4dv : procedure(var v: Double);
+  glColor4fv : procedure(var v: Single);
+  glColor4iv : procedure(var v: LongInt);
+  glColor4sv : procedure(var v: SmallInt);
+  glColor4ubv: procedure(var v: Byte);
+  glColor4uiv: procedure(var v: LongWord);
+  glColor4usv: procedure(var v: Word);
+  glTexCoord1d: procedure(s: Double);
+  glTexCoord1f: procedure(s: Single);
+  glTexCoord1i: procedure(s: LongInt);
+  glTexCoord1s: procedure(s: SmallInt);
+  glTexCoord2d: procedure(s, t: Double);
+  glTexCoord2f: procedure(s, t: Single);
+  glTexCoord2i: procedure(s, t: LongInt);
+  glTexCoord2s: procedure(s, t: SmallInt);
+  glTexCoord3d: procedure(s, t, r: Double);
+  glTexCoord3f: procedure(s, t, r: Single);
+  glTexCoord3i: procedure(s, t, r: LongInt);
+  glTexCoord3s: procedure(s, t, r: SmallInt);
+  glTexCoord4d: procedure(s, t, r, q: Double);
+  glTexCoord4f: procedure(s, t, r, q: Single);
+  glTexCoord4i: procedure(s, t, r, q: LongInt);
+  glTexCoord4s: procedure(s, t, r, q: SmallInt);
+  glTexCoord1dv: procedure(var v: Double);
+  glTexCoord1fv: procedure(var v: Single);
+  glTexCoord1iv: procedure(var v: LongInt);
+  glTexCoord1sv: procedure(var v: SmallInt);
+  glTexCoord2dv: procedure(var v: Double);
+  glTexCoord2fv: procedure(var v: Single);
+  glTexCoord2iv: procedure(var v: LongInt);
+  glTexCoord2sv: procedure(var v: SmallInt);
+  glTexCoord3dv: procedure(var v: Double);
+  glTexCoord3fv: procedure(var v: Single);
+  glTexCoord3iv: procedure(var v: LongInt);
+  glTexCoord3sv: procedure(var v: SmallInt);
+  glTexCoord4dv: procedure(var v: Double);
+  glTexCoord4fv: procedure(var v: Single);
+  glTexCoord4iv: procedure(var v: LongInt);
+  glTexCoord4sv: procedure(var v: SmallInt);
+  glRasterPos2d: procedure(x, y: Double);
+  glRasterPos2f: procedure(x, y: Single);
+  glRasterPos2i: procedure(x, y: LongInt);
+  glRasterPos2s: procedure(x, y: SmallInt);
+  glRasterPos3d: procedure(x, y, z: Double);
+  glRasterPos3f: procedure(x, y, z: Single);
+  glRasterPos3i: procedure(x, y, z: LongInt);
+  glRasterPos3s: procedure(x, y, z: SmallInt);
+  glRasterPos4d: procedure(x, y, z, w: Double);
+  glRasterPos4f: procedure(x, y, z, w: Single);
+  glRasterPos4i: procedure(x, y, z, w: LongInt);
+  glRasterPos4s: procedure(x, y, z, w: SmallInt);
+  glRasterPos2dv: procedure(var v: Double);
+  glRasterPos2fv: procedure(var v: Single);
+  glRasterPos2iv: procedure(var v: LongInt);
+  glRasterPos2sv: procedure(var v: SmallInt);
+  glRasterPos3dv: procedure(var v: Double);
+  glRasterPos3fv: procedure(var v: Single);
+  glRasterPos3iv: procedure(var v: LongInt);
+  glRasterPos3sv: procedure(var v: SmallInt);
+  glRasterPos4dv: procedure(var v: Double);
+  glRasterPos4fv: procedure(var v: Single);
+  glRasterPos4iv: procedure(var v: LongInt);
+  glRasterPos4sv: procedure(var v: SmallInt);
+  glRectd: procedure(x1, y1, x2, y2: Double);
+  glRectf: procedure(x1, y1, x2, y2: Single);
+  glRecti: procedure(x1, y1, x2, y2: LongInt);
+  glRects: procedure(x1, y1, x2, y2: SmallInt);
+  glRectdv: procedure(var v1, v2: Double);
+  glRectfv: procedure(var v1, v2: Single);
+  glRectiv: procedure(var v1, v2: LongInt);
+  glRectsv: procedure(var v1, v2: SmallInt);
+
+  // Vertex Arrays (1.1)
+  glVertexPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr);
+  glNormalPointer: procedure(AType: GLenum; stride: LongInt; var ptr);
+  glColorPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr);
+  glIndexPointer: procedure(AType: GLenum; stride: LongInt; var ptr);
+  glTexCoordPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr);
+  glEdgeFlagPointer: procedure(stride: LongInt; var ptr);
+  glGetPointerv: procedure(pname: GLenum; var params: Pointer);
+  glArrayElement: procedure(i: LongInt);
+  glDrawArrays: procedure(mode: GLenum; first, count: LongInt);
+  glDrawElements: procedure(mode: GLenum; count: Integer; AType: GLenum; var indices);
+  glInterleavedArrays: procedure(format: GLenum; stride: LongInt; var pointer);
+
+  // Lighting
+  glShadeModel: procedure(mode: GLenum);
+  glLightf: procedure(light, pname: GLenum; param: Single);
+  glLighti: procedure(light, pname: GLenum; param: LongInt);
+  glLightfv: procedure(light, pname: GLenum; var params: Single);
+  glLightiv: procedure(light, pname: GLenum; var params: LongInt);
+  glGetLightfv: procedure(light, pname: GLenum; var params: Single);
+  glGetLightiv: procedure(light, pname: GLenum; var params: LongInt);
+  glLightModelf: procedure(pname: GLenum; param: Single);
+  glLightModeli: procedure(pname: GLenum; param: LongInt);
+  glLightModelfv: procedure(pname: GLenum; var params: Single);
+  glLightModeliv: procedure(pname: GLenum; var param: LongInt);
+  glMaterialf: procedure(face, pname: GLenum; param: Single);
+  glMateriali: procedure(face, pname: GLenum; param: LongInt);
+  glMaterialfv: procedure(face, pname: GLenum; var params: Single);
+  glMaterialiv: procedure(face, pname: GLenum; var params: LongInt);
+  glGetMaterialfv: procedure(face, pname: GLenum; var params: Single);
+  glGetMaterialiv: procedure(face, pname: GLenum; var params: LongInt);
+  glColorMaterial: procedure(face, mode: GLenum);
+
+  // Raster Functions
+  glPixelZoom: procedure(xfactor, yfactor: Single);
+  glPixelStoref: procedure(pname: GLenum; param: Single);
+  glPixelStorei: procedure(pname: GLenum; param: LongInt);
+  glPixelTransferf: procedure(pname: GLenum; param: Single);
+  glPixelTransferi: procedure(pname: GLenum; param: LongInt);
+  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: Single);
+  glPixelMapuiv: procedure(map: GLenum; mapsize: LongInt; var values: LongWord);
+  glPixelMapusv: procedure(map: GLenum; mapsize: LongInt; var values: Word);
+  glGetPixelMapfv: procedure(map: GLenum; var values: Single);
+  glGetPixelMapuiv: procedure(map: GLenum; var values: LongWord);
+  glGetPixelMapusv: procedure(map: GLenum; var values: Word);
+  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: Single; var bitmap);
+  glReadPixels: procedure(x, y, width, height: LongInt; format, AType: GLenum; var pixels);
+  glDrawPixels: procedure(width, height: LongInt; format, AType: GLenum; var pixels);
+  glCopyPixels: procedure(x, y, width, height: LongInt; AType: GLenum);
+
+  // Stenciling
+  glStencilFunc: procedure(func: GLenum; ref: LongInt; mask: LongWord);
+  glStencilMask: procedure(mask: LongWord);
+  glStencilOp: procedure(fail, zfail, zpass: GLenum);
+  glClearStencil: procedure(s: LongInt);
+
+  // Texture Mapping
+  glTexGend: procedure(cord, pname: GLenum; param: Double);
+  glTexGenf: procedure(cord, pname: GLenum; param: Single);
+  glTexGeni: procedure(cord, pname: GLenum; param: LongInt);
+  glTexGendv: procedure(cord, pname: GLenum; var params: Double);
+  glTexGenfv: procedure(cord, pname: GLenum; var params: Single);
+  glTexGeniv: procedure(cord, pname: GLenum; var params: LongInt);
+  glGetTexGendv: procedure(cord, pname: GLenum; var params: Double);
+  glGetTexGenfv: procedure(cord, pname: GLenum; var params: Single);
+  glGetTexGeniv: procedure(cord, pname: GLenum; var params: LongInt);
+  glTexEnvf: procedure(target, pname: GLenum; param: Single);
+  glTexEnvi: procedure(target, pname: GLenum; param: LongInt);
+  glTexEnvfv: procedure(target, pname: GLenum; var params: Single);
+  glTexEnviv: procedure(target, pname: GLenum; var params: LongInt);
+  glGetTexEnvfv: procedure(target, pname: GLenum; var params: Single);
+  glGetTexEnviv: procedure(target, pname: GLenum; var params: LongInt);
+  glTexParameterf: procedure(target, pname: GLenum; param: Single);
+  glTexParameteri: procedure(target, pname: GLenum; param: LongInt);
+  glTexParameterfv: procedure(target, pname: GLenum; var params: Single);
+  glTexParameteriv: procedure(target, pname: GLenum; var params: LongInt);
+  glGetTexParameterfv: procedure(target, pname: GLenum; var params: Single);
+  glGetTexParameteriv: procedure(target, pname: GLenum; var params: LongInt);
+  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: Single);
+  glGetTexLevelParameteriv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: LongInt);
+  glTexImage1D: procedure(target: GLenum; level, internalFormat, width, border: LongInt; format, AType: GLenum; var pixels);
+  glTexImage2D: procedure(target: GLenum; level, internalFormat, width, height, border: LongInt; format, AType: GLenum; var pixels);
+  glGetTexImage: procedure(target: GLenum; level: LongInt; format, AType: GLenum; var pixels);
+  // 1.1 functions:
+  glGenTextures: procedure(n: LongInt; var textures: LongWord);
+  glDeleteTextures: procedure(n: LongInt; var textures: LongWord);
+  glBindTexture: procedure(target: GLenum; texture: LongWord);
+  glPrioritizeTextures: procedure(n: LongInt; var textures: LongWord; var priorities: GLclampf);
+  glAreTexturesResident: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean;
+  glIsTexture: function(texture: LongWord): Boolean;
+  glTexSubImage1D: procedure(target: GLenum; level, xoffset, width: LongInt; format, AType: GLenum; var pixels);
+  glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, width, height: LongInt; format, AType: GLenum; var pixels);
+  glCopyTexImage1D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, border: LongInt);
+  glCopyTexImage2D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, height, border: LongInt);
+  glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y, width: LongInt);
+  glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y, width, height: LongInt);
+
+  // Evaluators
+  glMap1d: procedure(target: GLenum; u1, u2: Double; stride, order: LongInt; var points: Double);
+  glMap1f: procedure(target: GLenum; u1, u2: Single; stride, order: LongInt; var points: Single);
+  glMap2d: procedure(target: GLenum; u1, u2: Double; ustride, uorder: LongInt; v1, v2: Double; vstride, vorder: LongInt; var points: Double);
+  glMap2f: procedure(target: GLenum; u1, u2: Single; ustride, uorder: LongInt; v1, v2: Single; vstride, vorder: LongInt; var points: Single);
+  glGetMapdv: procedure(target, query: GLenum; var v: Double);
+  glGetMapfv: procedure(target, query: GLenum; var v: Single);
+  glGetMapiv: procedure(target, query: GLenum; var v: LongInt);
+  glEvalCoord1d: procedure(u: Double);
+  glEvalCoord1f: procedure(u: Single);
+  glEvalCoord1dv: procedure(var u: Double);
+  glEvalCoord1fv: procedure(var u: Single);
+  glEvalCoord2d: procedure(u, v: Double);
+  glEvalCoord2f: procedure(u, v: Single);
+  glEvalCoord2dv: procedure(var u, v: Double);
+  glEvalCoord2fv: procedure(var u, v: Single);
+  glMapGrid1d: procedure(un: LongInt; u1, u2: Double);
+  glMapGrid1f: procedure(un: LongInt; u1, u2: Single);
+  glMapGrid2d: procedure(un: LongInt; u1, u2: Double; vn: LongInt; v1, v2: Double);
+  glMapGrid2f: procedure(un: LongInt; u1, u2: Single; vn: LongInt; v1, v2: Single);
+  glEvalPoint1: procedure(i: LongInt);
+  glEvalPoint2: procedure(i, j: LongInt);
+  glEvalMesh1: procedure(mode: GLenum; i1, i2: LongInt);
+  glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: LongInt);
+
+  // Fog
+  glFogf: procedure(pname: GLenum; param: Single);
+  glFogi: procedure(pname: GLenum; param: LongInt);
+  glFogfv: procedure(pname: GLenum; var params: Single);
+  glFogiv: procedure(pname: GLenum; var params: LongInt);
+
+  // Selection and Feedback
+  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: Single);
+  glPassThrough: procedure(token: Single);
+  glSelectBuffer: procedure(size: LongInt; var buffer: LongWord);
+  glInitNames: procedure;
+  glLoadName: procedure(name: LongWord);
+  glPushName: procedure(name: LongWord);
+  glPopName: procedure;
+%END

+ 146 - 0
packages/opengl/gl_linux.tpl

@@ -0,0 +1,146 @@
+{
+  $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 XLib;
+
+// ===================================================================
+//   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;
+
+%GLDecls
+
+%GLProcs1
+
+const
+%GLExtDecls
+
+%GLExtProcs1
+
+
+%GLUDecls
+%GLUProcs1
+
+
+%GLXDecls
+%GLXProcs1
+
+
+// ===================================================================
+// ===================================================================
+
+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;
+
+%GLProcs2
+#  // Extensions:
+#%GLExtProcs2
+
+  GLInitialized := True;
+  Result := True;
+end;
+
+function InitGLUFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLU := LoadLibrary(libname);
+  if not Assigned(libGLU) then exit;
+
+%GLUProcs2
+
+  GLUInitialized := True;
+  Result := True;
+end;
+
+function InitGLX: Boolean;
+begin
+  Result := False;
+  if not Assigned(libGL) then exit;
+
+%GLXProcs2
+
+  GLXInitialized := True;
+  Result := True;
+end;
+
+function InitGL: Boolean;
+begin
+  Result := InitGLFromLibrary('libGL.so') or InitGLFromLibrary('libMesaGL.so');
+end;
+
+function InitGLU: Boolean;
+begin
+  Result := InitGLUFromLibrary('libGLU.so') or InitGLUFromLibrary('libMesaGLU.so');
+end;
+
+
+
+finalization
+  if Assigned(libGL)  then dlclose(libGL);
+  if Assigned(libGLU) then dlclose(libGLU);
+  if Assigned(libGLX) then dlclose(libGLX);
+end.

+ 299 - 0
packages/opengl/glext.def

@@ -0,0 +1,299 @@
+# This is the definition file for all GL extension stuff
+
+%COPY_INTERFACE
+// -------------------------------------------------------
+//   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;
+
+
+// -------------------------------------------------------
+//   GL Extension Procedures
+// -------------------------------------------------------
+
+var
+%END
+
+
+#=====================================================================
+# Procedures and functions
+#=====================================================================
+
+%PROCS
+  // === 1.0 Extensions ===
+
+  // GL_EXT_blend_minmax
+  glBlendEquationEXT: procedure(mode: GLenum);
+
+  // GL_EXT_blend_color
+  glBlendColorEXT: procedure(red, green, blue, alpha: GLclampf);
+
+  // GL_EXT_polygon_offset
+  glPolygonOffsetEXT: procedure(factor, bias: Single);
+
+  // GL_EXT_vertex_array
+  glVertexPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr);
+  glNormalPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr);
+  glColorPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr);
+  glIndexPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr);
+  glTexCoordPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr);
+  glEdgeFlagPointerEXT: procedure(stride, count: LongInt; var ptr: Boolean);
+  glGetPointervEXT: procedure(pname: GLenum; var params: Pointer);
+  glArrayElementEXT: procedure(i: LongInt);
+  glDrawArraysEXT: procedure(mode: GLEnum; first, count: LongInt);
+
+  // GL_EXT_texture_object
+  glGenTexturesEXT: procedure(n: LongInt; var textures: LongWord);
+  glDeleteTexturesEXT: procedure(n: LongInt; var textures: LongWord);
+  glBindTextureEXT: procedure(target: GLenum; texture: LongWord);
+  glPrioritizeTexturesEXT: procedure(n: LongInt; var textures: LongWord; var priorities: GLClampf);
+  glAreTexturesResidentEXT: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean;
+  glIsTextureEXT: function(texture: LongWord): Boolean;
+
+  // GL_EXT_texture3D
+  glTexImage3DEXT: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLenum; var pixels);
+  glTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLenum; var pixels);
+  glCopyTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, x, y, width, height: LongInt);
+
+  // GL_EXT_color_table
+  glColorTableEXT: procedure(target, internalformat: GLenum; width: LongInt; format, AType: GLenum; var table);
+  glColorSubTableEXT: procedure(target: GLenum; start, count: LongInt; format, AType: GLEnum; var data);
+  glGetColorTableEXT: procedure(target, format, AType: GLenum; var table);
+  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: Single);
+  glGetColorTableParameterivEXT: procedure(target, pname: GLenum; var params: LongInt);
+
+  // GL_SGIS_multitexture
+  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: Double);
+  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: Single);
+  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord1iSGIS: procedure(target: GLenum; s: LongInt);
+  glMultiTexCoord1ivSGIS: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord1sSGIS: procedure(target: GLenum; s: ShortInt);
+  glMultiTexCoord1svSGIS: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: Double);
+  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: Single);
+  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord2iSGIS: procedure(target: GLenum; s, t: LongInt);
+  glMultiTexCoord2ivSGIS: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord2sSGIS: procedure(target: GLenum; s, t: ShortInt);
+  glMultiTexCoord2svSGIS: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: Double);
+  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: Single);
+  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord3iSGIS: procedure(target: GLenum; s, t, r: LongInt);
+  glMultiTexCoord3ivSGIS: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord3sSGIS: procedure(target: GLenum; s, t, r: ShortInt);
+  glMultiTexCoord3svSGIS: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: Double);
+  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: Single);
+  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord4iSGIS: procedure(target: GLenum; s, t, r, q: LongInt);
+  glMultiTexCoord4ivSGIS: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord4sSGIS: procedure(target: GLenum; s, t, r, q: ShortInt);
+  glMultiTexCoord4svSGIS: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoordPointerSGIS: procedure(target: GLenum; size: LongInt; AType: GLEnum; stride: LongInt; var APointer);
+  glSelectTextureSGIS: procedure(target: GLenum);
+  glSelectTextureCoordSetSGIS: procedure(target: GLenum);
+
+  // GL_EXT_multitexture
+  glMultiTexCoord1dEXT: procedure(target: GLenum; s: Double);
+  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord1fEXT: procedure(target: GLenum; s: Single);
+  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord1iEXT: procedure(target: GLenum; s: LongInt);
+  glMultiTexCoord1ivEXT: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord1sEXT: procedure(target: GLenum; s: ShortInt);
+  glMultiTexCoord1svEXT: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: Double);
+  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: Single);
+  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord2iEXT: procedure(target: GLenum; s, t: LongInt);
+  glMultiTexCoord2ivEXT: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord2sEXT: procedure(target: GLenum; s, t: ShortInt);
+  glMultiTexCoord2svEXT: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: Double);
+  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: Single);
+  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord3iEXT: procedure(target: GLenum; s, t, r: LongInt);
+  glMultiTexCoord3ivEXT: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord3sEXT: procedure(target: GLenum; s, t, r: ShortInt);
+  glMultiTexCoord3svEXT: procedure(target: GLenum; var v: ShortInt);
+  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: Double);
+  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: Double);
+  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: Single);
+  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: Single);
+  glMultiTexCoord4iEXT: procedure(target: GLenum; s, t, r, q: LongInt);
+  glMultiTexCoord4ivEXT: procedure(target: GLenum; var v: LongInt);
+  glMultiTexCoord4sEXT: procedure(target: GLenum; s, t, r, q: ShortInt);
+  glMultiTexCoord4svEXT: procedure(target: GLenum; var v: ShortInt);
+  glInterleavedTextureCoordSetsEXT: procedure(factor: LongInt);
+  glSelectTextureEXT: procedure(target: GLenum);
+  glSelectTextureCoordSetEXT: procedure(target: GLenum);
+  glSelectTextureTransformEXT: procedure(target: GLenum);
+
+  // GL_EXT_point_parameters
+  glPointParameterfEXT: procedure(pname: GLenum; param: Single);
+  glPointParameterfvEXT: procedure(pname: GLenum; var params: Single);
+
+  // GL_MESA_window_pos
+  glWindowPos2iMESA: procedure(x, y: LongInt);
+  glWindowPos2sMESA: procedure(x, y: ShortInt);
+  glWindowPos2fMESA: procedure(x, y: Single);
+  glWindowPos2dMESA: procedure(x, y: Double);
+  glWindowPos2ivMESA: procedure(var p: LongInt);
+  glWindowPos2svMESA: procedure(var p: ShortInt);
+  glWindowPos2fvMESA: procedure(var p: Single);
+  glWindowPos2dvMESA: procedure(var p: Double);
+  glWindowPos3iMESA: procedure(x, y, z: LongInt);
+  glWindowPos3sMESA: procedure(x, y, z: ShortInt);
+  glWindowPos3fMESA: procedure(x, y, z: Single);
+  glWindowPos3dMESA: procedure(x, y, z: Double);
+  glWindowPos3ivMESA: procedure(var p: LongInt);
+  glWindowPos3svMESA: procedure(var p: ShortInt);
+  glWindowPos3fvMESA: procedure(var p: Single);
+  glWindowPos3dvMESA: procedure(var p: Double);
+  glWindowPos4iMESA: procedure(x, y, z, w: LongInt);
+  glWindowPos4sMESA: procedure(x, y, z, w: ShortInt);
+  glWindowPos4fMESA: procedure(x, y, z, w: Single);
+  glWindowPos4dMESA: procedure(x, y, z, w: Double);
+  glWindowPos4ivMESA: procedure(var p: LongInt);
+  glWindowPos4svMESA: procedure(var p: ShortInt);
+  glWindowPos4fvMESA: procedure(var p: Single);
+  glWindowPos4dvMESA: procedure(var p: Double);
+
+  // GL_MESA_resize_buffers
+  glResizeBuffersMESA: procedure;
+%END

+ 201 - 0
packages/opengl/glu.def

@@ -0,0 +1,201 @@
+# This is the definition file for all GLU stuff
+
+%COPY_INTERFACE
+// ===================================================================
+//   GLU consts, types and functions
+// ===================================================================
+
+const
+  GLU_TRUE 				= GL_TRUE;
+  GLU_FALSE 				= GL_FALSE;
+
+  // Normal vectors
+  GLU_SMOOTH				= 100000;
+  GLU_FLAT				= 100001;
+  GLU_NONE				= 100002;
+
+  // Quadric draw styles
+  GLU_POINT				= 100010;
+  GLU_LINE				= 100011;
+  GLU_FILL				= 100012;
+  GLU_SILHOUETTE			= 100013;
+
+  // Quadric orientation
+  GLU_OUTSIDE				= 100020;
+  GLU_INSIDE				= 100021;
+
+  // Tesselator
+  GLU_BEGIN				= 100100;
+  GLU_VERTEX				= 100101;
+  GLU_END				= 100102;
+  GLU_ERROR				= 100103;
+  GLU_EDGE_FLAG				= 100104;
+
+  // Contour types
+  GLU_CW				= 100120;
+  GLU_CCW				= 100121;
+  GLU_INTERIOR				= 100122;
+  GLU_EXTERIOR				= 100123;
+  GLU_UNKNOWN				= 100124;
+
+  // Tesselation errors
+  GLU_TESS_ERROR1			= 100151;  // missing gluEndPolygon
+  GLU_TESS_ERROR2 			= 100152;  // missing gluBeginPolygon
+  GLU_TESS_ERROR3 			= 100153;  // misoriented contour
+  GLU_TESS_ERROR4 			= 100154;  // vertex/edge intersection
+  GLU_TESS_ERROR5 			= 100155;  // misoriented or self-intersecting loops
+  GLU_TESS_ERROR6 			= 100156;  // coincident vertices
+  GLU_TESS_ERROR7 			= 100157;  // all vertices collinear
+  GLU_TESS_ERROR8 			= 100158;  // intersecting edges
+  GLU_TESS_ERROR9 			= 100159;  // not coplanar contours
+
+  // NURBS
+  GLU_AUTO_LOAD_MATRIX			= 100200;
+  GLU_CULLING				= 100201;
+  GLU_PARAMETRIC_TOLERANCE		= 100202;
+  GLU_SAMPLING_TOLERANCE		= 100203;
+  GLU_DISPLAY_MODE			= 100204;
+  GLU_SAMPLING_METHOD			= 100205;
+  GLU_U_STEP				= 100206;
+  GLU_V_STEP				= 100207;
+
+  GLU_PATH_LENGTH			= 100215;
+  GLU_PARAMETRIC_ERROR			= 100216;
+  GLU_DOMAIN_DISTANCE			= 100217;
+
+  GLU_MAP1_TRIM_2			= 100210;
+  GLU_MAP1_TRIM_3			= 100211;
+
+  GLU_OUTLINE_POLYGON			= 100240;
+  GLU_OUTLINE_PATCH			= 100241;
+
+  GLU_NURBS_ERROR1  			= 100251;   // spline order un-supported
+  GLU_NURBS_ERROR2  			= 100252;   // too few knots
+  GLU_NURBS_ERROR3  			= 100253;   // valid knot range is empty
+  GLU_NURBS_ERROR4  			= 100254;   // decreasing knot sequence
+  GLU_NURBS_ERROR5  			= 100255;   // knot multiplicity > spline order
+  GLU_NURBS_ERROR6  			= 100256;   // endcurve() must follow bgncurve()
+  GLU_NURBS_ERROR7  			= 100257;   // bgncurve() must precede endcurve()
+  GLU_NURBS_ERROR8  			= 100258;   // ctrlarray or knot vector is NULL
+  GLU_NURBS_ERROR9  			= 100259;   // cannot draw pwlcurves
+  GLU_NURBS_ERROR10 			= 100260;   // missing gluNurbsCurve()
+  GLU_NURBS_ERROR11 			= 100261;   // missing gluNurbsSurface()
+  GLU_NURBS_ERROR12 			= 100262;   // endtrim() must precede endsurface()
+  GLU_NURBS_ERROR13 			= 100263;   // bgnsurface() must precede endsurface()
+  GLU_NURBS_ERROR14 			= 100264;   // curve of improper type passed as trim curve
+  GLU_NURBS_ERROR15 			= 100265;   // bgnsurface() must precede bgntrim()
+  GLU_NURBS_ERROR16 			= 100266;   // endtrim() must follow bgntrim()
+  GLU_NURBS_ERROR17 			= 100267;   // bgntrim() must precede endtrim()*/
+  GLU_NURBS_ERROR18 			= 100268;   // invalid or missing trim curve*/
+  GLU_NURBS_ERROR19 			= 100269;   // bgntrim() must precede pwlcurve()
+  GLU_NURBS_ERROR20 			= 100270;   // pwlcurve referenced twice*/
+  GLU_NURBS_ERROR21 			= 100271;   // pwlcurve and nurbscurve mixed
+  GLU_NURBS_ERROR22 			= 100272;   // improper usage of trim data type
+  GLU_NURBS_ERROR23 			= 100273;   // nurbscurve referenced twice
+  GLU_NURBS_ERROR24 			= 100274;   // nurbscurve and pwlcurve mixed
+  GLU_NURBS_ERROR25 			= 100275;   // nurbssurface referenced twice
+  GLU_NURBS_ERROR26 			= 100276;   // invalid property
+  GLU_NURBS_ERROR27 			= 100277;   // endsurface() must follow bgnsurface()
+  GLU_NURBS_ERROR28 			= 100278;   // intersecting or misoriented trim curves
+  GLU_NURBS_ERROR29 			= 100279;   // intersecting trim curves
+  GLU_NURBS_ERROR30 			= 100280;   // UNUSED
+  GLU_NURBS_ERROR31 			= 100281;   // unconnected trim curves
+  GLU_NURBS_ERROR32 			= 100282;   // unknown knot error
+  GLU_NURBS_ERROR33 			= 100283;   // negative vertex count encountered
+  GLU_NURBS_ERROR34 			= 100284;   // negative byte-stride
+  GLU_NURBS_ERROR35 			= 100285;   // unknown type descriptor
+  GLU_NURBS_ERROR36 			= 100286;   // null control point reference
+  GLU_NURBS_ERROR37 			= 100287;   // duplicate point on pwlcurve
+
+  // Errors
+  GLU_INVALID_ENUM			= 100900;
+  GLU_INVALID_VALUE			= 100901;
+  GLU_OUT_OF_MEMORY			= 100902;
+  GLU_INCOMPATIBLE_GL_VERSION		= 100903;
+
+  // New in GLU 1.1
+  GLU_VERSION				= 100800;
+  GLU_EXTENSIONS			= 100801;
+
+type
+  PGLUquadricObj = ^TGLUquadricObj;
+  TGLUquadricObj = record end;
+  PGLUtriangulatorObj = ^TGLUtriangulatorObj;
+  TGLUtriangulatorObj = record end;
+  PGLUnurbsObj = ^TGLUnurbsObj;
+  TGLUnurbsObj = record end;
+
+  TGLUQuadricCallback = procedure; cdecl;
+  TGLUNurbsCallback = procedure; cdecl;
+  TGLUTessCallback = procedure; cdecl;
+
+  TGLUViewport = array[0..3] of LongInt;
+  TGLUMatrixd = array[0..15] of Double;
+  TGLUMatrixf = array[0..15] of Single;
+  TGLUVectord = array[0..2] of Double;
+var
+%END
+
+
+#=====================================================================
+# Procedures and functions
+#=====================================================================
+
+%PROCS
+  // Miscellaneous functions
+  gluLookAt: procedure(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: Double);
+  gluOrtho2D: procedure(left, right, bottom, top: Double);
+  gluPerspective: procedure(fovy, aspect, zNear, zFar: Double);
+  gluPickMatrix: procedure(x, y, width, height: Double; const viewport: TGLUViewport);
+  gluProject: procedure(objx, objy, objz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; winx, winy, winz: Double);
+  gluUnProject: procedure(winx, winy, winz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; objx, objy, objz: Double);
+  gluErrorString: procedure(errorCode: GLenum);
+
+  // Mipmapping and image scaling
+  gluScaleImage: procedure(format: GLenum; within, heightin: LongInt; typein: GLenum; var datain; widthout, heightout: LongInt; typeout: GLenum; var dataout);
+  gluBuild1DMipmaps: procedure(target: GLenum; components, width: LongInt; format, AType: GLEnum; var data);
+  gluBuild2DMipmaps: procedure(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; var data);
+
+  // Quadrics
+  gluNewQuadric: function: PGLUquadricObj;
+  gluDeleteQuadric: procedure(state: PGLUquadricObj);
+  gluQuadricDrawStyle: procedure(quadObject: PGLUquadricObj; drawStyle: GLenum);
+  gluQuadricOrientation: procedure(quadObject: PGLUquadricObj; orientation: GLenum);
+  gluQuadricNormals: procedure(quadObject: PGLUquadricObj; normals: GLenum);
+  gluQuadricTexture: procedure(quadObject: PGLUquadricObj; textureCoords: Boolean);
+  gluQuadricCallback: procedure(quadObject: PGLUquadricObj; which: GLenum; fn: TGLUQuadricCallback);
+  gluCylinder: procedure(qobj: PGLUquadricObj; baseRadius, topRadius, height: Double; slices, stacks: LongInt);
+  gluSphere: procedure(qobj: PGLUquadricObj; radius: Double; slices, stacks: LongInt);
+  gluDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt);
+  gluPartialDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt; startAngle, sweepAngle: Double);
+
+  // Nurbs
+  gluNewNurbsRenderer: function: PGLUnurbsObj;
+  gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbsObj);
+  gluLoadSamplingMatrices: procedure(nobj: PGLUnurbsObj; const modelMatrix, projMatrix: TGLUMatrixf; const viewport: TGLUViewport);
+  gluNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLenum; value: Single);
+  gluGetNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: Single);
+  gluBeginCurve: procedure(nobj: PGLUnurbsObj);
+  gluEndCurve: procedure(nobj: PGLUnurbsObj);
+  gluNurbsCurve: procedure(nobj: PGLUnurbsObj; nknots: LongInt; var know: Single; stride: LongInt; var ctlarray: Single; order: LongInt; AType: GLenum);
+  gluBeginSurface: procedure(nobj: PGLUnurbsObj);
+  gluEndSurface: procedure(nobj: PGLUnurbsObj);
+  gluNurbsSurface: procedure(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: Single; tknot_count: LongInt; var tknot: Single; s_stride, t_stride: LongInt; var ctlarray: Single; sorder, torder: LongInt; AType: GLenum);
+  gluBeginTrim: procedure(nobj: PGLUnurbsObj);
+  gluEndTrim: procedure(nobj: PGLUnurbsObj);
+  gluPwlCurve: procedure(nobj: PGLUnurbsObj; count: LongInt; var AArray: Single; stride: LongInt; AType: GLenum);
+  gluNurbsCallback: procedure(nobj: PGLUnurbsObj; which: GLenum; fn: TGLUNurbsCallback);
+
+  // Polygon tesselation
+  gluNewTess: function: PGLUtriangulatorObj;
+  gluTessCallback: procedure(tobj: PGLUtriangulatorObj; which: GLenum; fn: TGLUTessCallback);
+
+  gluDeleteTess: procedure(tobj: PGLUtriangulatorObj);
+  gluBeginPolygon: procedure(tobj: PGLUtriangulatorObj);
+  gluEndPolygon: procedure(tobj: PGLUtriangulatorObj);
+  gluNextContour: procedure(tobj: PGLUtriangulatorObj; AType: GLenum);
+  gluTessVertex: procedure(tobj: PGLUtriangulatorObj; v: TGLUVectord; var data);
+
+  // New functions in GLU 1.1
+  gluGetString: function(name: GLenum): PChar;
+%END

+ 107 - 0
packages/opengl/glut.def

@@ -0,0 +1,107 @@
+# This is the definition file for all GLUT stuff
+
+%COPY_INTERFACE
+%END
+
+
+#=====================================================================
+# Procedures and functions
+#=====================================================================
+
+%PROCS
+// GLUT initialization sub-API
+  glutInit: procedure(var argcp: Integer; var argv: PChar);
+  glutInitDisplayMode: procedure(mode: LongWord);
+  glutInitDisplayString: procedure(AString: PChar);
+  glutInitWindowPosition: procedure(x, y: Integer);
+  glutInitWindowSize: procedure(width, height: Integer);
+  glutMainLoop: procedure;
+
+// GLUT window sub-API
+  glutCreateWindow: function(title: PChar): Integer;
+  glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer;
+  glutDestroyWindow: procedure(win: Integer);
+  glutPostRedisplay: procedure;
+  glutPostWindowRedisplay: procedure(win: Integer);
+  glutSwapBuffers: procedure;
+  glutGetWindow: function: Integer;
+  glutSetWindow: procedure(win: Integer);
+  glutSetWindowTitle: procedure(title: PChar);
+  glutSetIconTitle: procedure(title: PChar);
+  glutPositionWindow: procedure(x, y: Integer);
+  glutReshapeWindow: procedure(width, height: Integer);
+  glutPopWindow: procedure;
+  glutPushWindow: procedure;
+  glutIconifyWindow: procedure;
+  glutShowWindow: procedure;
+  glutHideWindow: procedure;
+  glutFullScreen: procedure;
+  glutSetCursor: procedure(cursor: Integer);
+  glutWarpPointer: procedure(x, y: Integer);
+
+//overlays ###
+
+//menus ###
+
+// GLUT window callback sub-API
+  glutDisplayFunc: procedure(func: TGlutDisplayFunc);
+  glutReshapeFunc: procedure(func: TGlutReshapeFunc);
+
+  glutTimerFunc: procedure(millis: LongWord; func: TGlutTimerFunc; value: Integer);
+
+
+// GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
+// GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+// GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+// GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
+// GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+// GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+// GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+// GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
+// GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
+// GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
+// GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+// GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
+// GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+// GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+// GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK * func)(unsigned int buttonMask, int x, int y, int z), int pollInterval)
+
+// GLUT color index sub-API
+  glutSetColor: procedure(index: Integer; red, green, blue: Single);
+  glutGetColor: function(ndx, component: Integer): Single;
+  glutCopyColormap: procedure(win: Integer);
+
+// GLUT state retrieval sub-API
+  glutGet: function(AType: GLEnum): Integer;
+  glutDeviceGet: function(AType: GLEnum): Integer;
+  glutExtensionSupported: function(name: PChar): Integer;
+  glutGetModifiers: function: Integer;
+  glutLayerGet: function(AType: GLEnum): Integer;
+
+// fonts ###
+
+// pre-built models ###
+
+// video resize ###
+
+// debugging ###
+
+// device control ###
+
+
+// GLUT game mode sub-API
+  glutGameModeString: procedure(AString: PChar);
+  glutEnterGameMode: function: Integer;
+  glutLeaveGameMode: procedure;
+  glutGameModeGet: function(mode: GLEnum): Integer;
+%END

+ 260 - 0
packages/opengl/glut_linux.tpl

@@ -0,0 +1,260 @@
+{
+  $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;
+
+
+
+
+const
+  // Display mode bit masks
+  GLUT_RGB			= 0;
+  GLUT_RGBA			= GLUT_RGB;
+  GLUT_INDEX			= 1;
+  GLUT_SINGLE			= 0;
+  GLUT_DOUBLE			= 2;
+  GLUT_ACCUM			= 4;
+  GLUT_ALPHA			= 8;
+  GLUT_DEPTH			= 16;
+  GLUT_STENCIL			= 32;
+  GLUT_MULTISAMPLE		= 128;
+  GLUT_STEREO			= 256;
+  GLUT_LUMINANCE		= 512;
+
+  // Mouse buttons
+  GLUT_LEFT_BUTTON		= 0;
+  GLUT_MIDDLE_BUTTON		= 1;
+  GLUT_RIGHT_BUTTON		= 2;
+
+  // Mouse button state
+  GLUT_DOWN			= 0;
+  GLUT_UP               	= 1;
+
+  // Keys ###
+
+  // Enter / exit state
+  GLUT_LEFT			= 0;
+  GLUT_ENTERED			= 1;
+
+  // Menu usage state
+  GLUT_MENU_NOT_IN_USE		= 0;
+  GLUT_MENU_IN_USE		= 1;
+
+  // Visibility state
+  GLUT_NOT_VISIBLE		= 0;
+  GLUT_VISIBLE			= 1;
+
+  // Window status state
+  GLUT_HIDDEN			= 0;
+  GLUT_FULLY_RETAINED		= 1;
+  GLUT_PARTIALLY_RETAINED 	= 2;
+  GLUT_FULLY_COVERED		= 3;
+
+  // Color index component selection values
+  GLUT_RED			= 0;
+  GLUT_GREEN			= 1;
+  GLUT_BLUE			= 2;
+
+  // Layers for use
+  GLUT_NORMAL			= 0;
+  GLUT_OVERLAY			= 1;
+
+  // Bitmap stuff###
+
+
+  // glutGet parameters
+  GLUT_WINDOW_X			= 100;
+  GLUT_WINDOW_Y			= 101;
+  GLUT_WINDOW_WIDTH		= 102;
+  GLUT_WINDOW_HEIGHT		= 103;
+  GLUT_WINDOW_BUFFER_SIZE	= 104;
+  GLUT_WINDOW_STENCIL_SIZE	= 105;
+  GLUT_WINDOW_DEPTH_SIZE	= 106;
+  GLUT_WINDOW_RED_SIZE		= 107;
+  GLUT_WINDOW_GREEN_SIZE	= 108;
+  GLUT_WINDOW_BLUE_SIZE		= 109;
+  GLUT_WINDOW_ALPHA_SIZE	= 110;
+  GLUT_WINDOW_ACCUM_RED_SIZE	= 111;
+  GLUT_WINDOW_ACCUM_GREEN_SIZE	= 112;
+  GLUT_WINDOW_ACCUM_BLUE_SIZE	= 113;
+  GLUT_WINDOW_ACCUM_ALPHA_SIZE	= 114;
+  GLUT_WINDOW_DOUBLEBUFFER	= 115;
+  GLUT_WINDOW_RGBA		= 116;
+  GLUT_WINDOW_PARENT		= 117;
+  GLUT_WINDOW_NUM_CHILDREN	= 118;
+  GLUT_WINDOW_COLORMAP_SIZE	= 119;
+  GLUT_WINDOW_NUM_SAMPLES	= 120;
+  GLUT_WINDOW_STEREO		= 121;
+  GLUT_WINDOW_CURSOR		= 122;
+  GLUT_SCREEN_WIDTH		= 200;
+  GLUT_SCREEN_HEIGHT		= 201;
+  GLUT_SCREEN_WIDTH_MM		= 202;
+  GLUT_SCREEN_HEIGHT_MM		= 203;
+  GLUT_MENU_NUM_ITEMS		= 300;
+  GLUT_DISPLAY_MODE_POSSIBLE	= 400;
+  GLUT_INIT_WINDOW_X		= 500;
+  GLUT_INIT_WINDOW_Y		= 501;
+  GLUT_INIT_WINDOW_WIDTH	= 502;
+  GLUT_INIT_WINDOW_HEIGHT	= 503;
+  GLUT_INIT_DISPLAY_MODE	= 504;
+  GLUT_ELAPSED_TIME		= 700;
+  GLUT_WINDOW_FORMAT_ID		= 123;
+
+  // glutDeviceGet parameters
+  GLUT_HAS_KEYBOARD		= 600;
+  GLUT_HAS_MOUSE		= 601;
+  GLUT_HAS_SPACEBALL		= 602;
+  GLUT_HAS_DIAL_AND_BUTTON_BOX	= 603;
+  GLUT_HAS_TABLET		= 604;
+  GLUT_NUM_MOUSE_BUTTONS	= 605;
+  GLUT_NUM_SPACEBALL_BUTTONS	= 606;
+  GLUT_NUM_BUTTON_BOX_BUTTONS	= 607;
+  GLUT_NUM_DIALS		= 608;
+  GLUT_NUM_TABLET_BUTTONS	= 609;
+  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
+  GLUT_DEVICE_KEY_REPEAT	= 611;
+  GLUT_HAS_JOYSTICK		= 612;
+  GLUT_OWNS_JOYSTICK		= 613;
+  GLUT_JOYSTICK_BUTTONS		= 614;
+  GLUT_JOYSTICK_AXES		= 615;
+  GLUT_JOYSTICK_POLL_RATE	= 616;
+
+  // glutLayerGet parameters
+  GLUT_OVERLAY_POSSIBLE		= 800;
+  GLUT_LAYER_IN_USE		= 801;
+  GLUT_HAS_OVERLAY		= 802;
+  GLUT_TRANSPARENT_INDEX	= 803;
+  GLUT_NORMAL_DAMAGED		= 804;
+  GLUT_OVERLAY_DAMAGED		= 805;
+
+  // glutVideoResizeGet parameters
+  GLUT_VIDEO_RESIZE_POSSIBLE	= 900;
+  GLUT_VIDEO_RESIZE_IN_USE	= 901;
+  GLUT_VIDEO_RESIZE_X_DELTA	= 902;
+  GLUT_VIDEO_RESIZE_Y_DELTA	= 903;
+  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
+  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
+  GLUT_VIDEO_RESIZE_X		= 906;
+  GLUT_VIDEO_RESIZE_Y		= 907;
+  GLUT_VIDEO_RESIZE_WIDTH	= 908;
+  GLUT_VIDEO_RESIZE_HEIGHT	= 909;
+
+  // glutGetModifiers return mask
+  GLUT_ACTIVE_SHIFT		= 1;
+  GLUT_ACTIVE_CTRL		= 2;
+  GLUT_ACTIVE_ALT		= 4;
+
+  // Cursor stuff ###
+
+// GLUT window callback sub-API
+type
+  TGlutDisplayFunc = procedure; #extdecl;
+  TGlutReshapeFunc = procedure(width, height: Integer); #extdecl;
+
+  TGlutTimerFunc = procedure(value: Integer); #extdecl;
+
+// GLUT game mode sub-API
+// glutGameModeGet
+const
+  GLUT_GAME_MODE_ACTIVE		= 0;
+  GLUT_GAME_MODE_POSSIBLE	= 1;
+  GLUT_GAME_MODE_WIDTH		= 2;
+  GLUT_GAME_MODE_HEIGHT		= 3;
+  GLUT_GAME_MODE_PIXEL_DEPTH	= 4;
+  GLUT_GAME_MODE_REFRESH_RATE	= 5;
+  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;
+
+
+var
+%GLUTProcs1
+
+
+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;
+
+%GLUTProcs2
+
+  GLUTInitialized := True;
+  Result := True;
+end;
+
+
+function InitGLUT: Boolean;
+begin
+  Result := InitGLUTFromLibrary('libglut.so');
+end;
+
+
+
+finalization
+  if Assigned(libGLUT) then FreeLibrary(libGLUT);
+end.

+ 112 - 0
packages/opengl/glx.def

@@ -0,0 +1,112 @@
+# This is the definition file for all GLX stuff
+
+%COPY_INTERFACE
+// ===================================================================
+//   GLX consts, types and functions
+// ===================================================================
+
+// Tokens for glXChooseVisual and glXGetConfig:
+const
+  GLX_USE_GL				= 1;
+  GLX_BUFFER_SIZE			= 2;
+  GLX_LEVEL				= 3;
+  GLX_RGBA				= 4;
+  GLX_DOUBLEBUFFER			= 5; 
+  GLX_STEREO				= 6;
+  GLX_AUX_BUFFERS			= 7;
+  GLX_RED_SIZE				= 8;
+  GLX_GREEN_SIZE			= 9;
+  GLX_BLUE_SIZE				= 10;
+  GLX_ALPHA_SIZE			= 11;
+  GLX_DEPTH_SIZE			= 12;
+  GLX_STENCIL_SIZE			= 13;
+  GLX_ACCUM_RED_SIZE			= 14;
+  GLX_ACCUM_GREEN_SIZE			= 15;
+  GLX_ACCUM_BLUE_SIZE			= 16;
+  GLX_ACCUM_ALPHA_SIZE			= 17;
+
+  // GLX_EXT_visual_info extension
+  GLX_X_VISUAL_TYPE_EXT			= $22;
+  GLX_TRANSPARENT_TYPE_EXT		= $23;
+  GLX_TRANSPARENT_INDEX_VALUE_EXT 	= $24;
+  GLX_TRANSPARENT_RED_VALUE_EXT		= $25;
+  GLX_TRANSPARENT_GREEN_VALUE_EXT	= $26;
+  GLX_TRANSPARENT_BLUE_VALUE_EXT	= $27;
+  GLX_TRANSPARENT_ALPHA_VALUE_EXT	= $28;
+
+
+  // Error codes returned by glXGetConfig:
+  GLX_BAD_SCREEN			= 1;
+  GLX_BAD_ATTRIBUTE			= 2;
+  GLX_NO_EXTENSION			= 3;
+  GLX_BAD_VISUAL			= 4;
+  GLX_BAD_CONTEXT			= 5;
+  GLX_BAD_VALUE       			= 6;
+  GLX_BAD_ENUM				= 7;
+
+  // GLX 1.1 and later:
+  GLX_VENDOR				= 1;
+  GLX_VERSION				= 2;
+  GLX_EXTENSIONS 			= 3;
+
+  // GLX_visual_info extension
+  GLX_TRUE_COLOR_EXT			= $8002;
+  GLX_DIRECT_COLOR_EXT			= $8003;
+  GLX_PSEUDO_COLOR_EXT			= $8004;
+  GLX_STATIC_COLOR_EXT			= $8005;
+  GLX_GRAY_SCALE_EXT			= $8006;
+  GLX_STATIC_GRAY_EXT			= $8007;
+  GLX_NONE_EXT				= $8000;
+  GLX_TRANSPARENT_RGB_EXT		= $8008;
+  GLX_TRANSPARENT_INDEX_EXT		= $8009;
+
+type
+  // From XLib:
+  XPixmap = XID;
+  XFont = XID;
+  XColormap = XID;
+
+  GLXContext = Pointer;
+  GLXPixmap = XID;
+  GLXDrawable = XID;
+  GLXContextID = XID;
+
+var
+%END
+
+
+#=====================================================================
+# Procedures and functions
+#=====================================================================
+
+%PROCS
+  glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl;
+  glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl;
+  glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl;
+  glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl;
+  glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl;
+  glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl;
+  glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl;
+  glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl;
+  glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl;
+  glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl;
+  glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl;
+  glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl;
+  glXGetCurrentContext: function: GLXContext; cdecl;
+  glXGetCurrentDrawable: function: GLXDrawable; cdecl;
+  glXWaitGL: procedure; cdecl;
+  glXWaitX: procedure; cdecl;
+  glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl;
+
+  // GLX 1.1 and later
+  glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl;
+  glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl;
+  glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl;
+
+  // Mesa GLX Extensions
+  glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl;
+  glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl;
+  glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl;
+  glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl;
+  glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl;
+%END

+ 940 - 0
packages/opengl/linuxd/Makefile

@@ -0,0 +1,940 @@
+#
+# Makefile generated by fpcmake v0.99.13 on 1999-11-28 18:15
+#
+
+defaultrule: all
+
+#####################################################################
+# 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 search separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+
+#####################################################################
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+ifdef inOS2
+export FPC=ppos2$(EXEEXT)
+else
+export FPC=ppc386$(EXEEXT)
+endif
+endif
+
+# Target OS
+ifndef OS_TARGET
+export OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+export OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+export CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+export CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+export FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+#####################################################################
+# Default Settings
+#####################################################################
+
+# Release ? Then force OPT and don't use extra opts via commandline
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef RELEASE
+override OPT:=-Xs -OG2p3 -n
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override OPT+=-vwni
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override OPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
+
+#####################################################################
+# User Settings
+#####################################################################
+
+
+# Targets
+
+override UNITOBJECTS+=xlib gl glut
+
+# Clean
+
+
+# Install
+
+ZIPTARGET=install
+
+# Defaults
+
+
+# Directories
+
+ifndef PACKAGEDIR
+PACKAGEDIR=$(FPCDIR)/packages
+endif
+ifndef COMPONENTDIR
+COMPONENTDIR=$(FPCDIR)/components
+endif
+
+# Packages
+
+
+# Libraries
+
+
+# Info
+
+INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Default Directories
+#####################################################################
+
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+export PREFIXINSTALLDIR=/usr
+else
+export PREFIXINSTALLDIR=/pp
+endif
+endif
+
+# create fcldir,rtldir,unitdir
+ifdef FPCDIR
+ifneq ($(FPCDIR),.)
+override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
+override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
+override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+
+#####################################################################
+# 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)/$(UNITPREFIX)/$(OS_TARGET)
+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
+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 EXTRAINSTALLDIR
+EXTRAINSTALLDIR=$(BASEINSTALLDIR)
+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
+
+# Smartlinking
+ifdef SMARTLINK
+override FPCOPT+=-CX
+endif
+
+# Debug
+ifdef DEBUG
+override FPCOPT+=-g
+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
+
+override COMPILER=$(FPC) $(FPCOPT)
+
+#####################################################################
+# Shell tools
+#####################################################################
+
+# To copy pograms
+ifndef COPY
+export COPY:=cp -fp
+endif
+
+# Copy a whole tree
+ifndef COPYTREE
+export COPYTREE:=cp -rfp
+endif
+
+# To move pograms
+ifndef MOVE
+export MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+export DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+export DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+export INSTALL:=install -m 644
+else
+export INSTALL:=$(COPY)
+endif
+endif
+
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+export INSTALLEXE:=install -m 755
+else
+export INSTALLEXE:=$(COPY)
+endif
+endif
+
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+export MKDIR:=install -m 755 -d
+else
+export MKDIR:=ginstall -m 755 -d
+endif
+endif
+
+#####################################################################
+# Default Tools
+#####################################################################
+
+# file used to check if a package is compiled
+ifndef FPCMAKED
+FPCMAKED=fpcmaked
+endif
+
+# 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
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS=@$(PPAS)
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+export ECHO:=echo
+else
+export ECHO:=$(firstword $(ECHO))
+endif
+endif
+
+# ppdep
+ifndef PPDEP
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPDEP),)
+PPDEP=
+else
+export PPDEP:=$(firstword $(PPDEP))
+endif
+endif
+
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+export PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+export PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+
+# 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
+export UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+
+# gdate/date
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+export DATE:=$(firstword $(DATE))
+endif
+else
+export DATE:=$(firstword $(DATE))
+endif
+endif
+
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
+endif
+endif
+
+ifndef ZIPEXT
+ZIPEXT=.zip
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+PACKAGESUFFIX=
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+PACKAGESUFFIX=v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+PACKAGESUFFIX=linux
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=win32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=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
+
+#####################################################################
+# 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
+
+zipinstalladd: fpc_zipinstalladd
+
+clean: fpc_clean
+
+cleanall: fpc_cleanall
+
+info: fpc_info
+
+.PHONY:  all debug smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
+
+#####################################################################
+# Package depends
+#####################################################################
+
+ifneq ($(wildcard $(RTLDIR)),)
+ifeq ($(wildcard $(RTLDIR)/$(FPCMAKED)),)
+override COMPILEPACKAGES+=rtl
+rtl_package:
+	$(MAKE) -C $(RTLDIR) all
+endif
+endif
+
+.PHONY:  rtl_package
+
+#####################################################################
+# Units
+#####################################################################
+
+.PHONY: fpc_units
+
+override ALLTARGET+=fpc_units
+
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
+override INSTALLPPUFILES+=$(UNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES)
+
+fpc_units: $(UNITPPUFILES)
+
+#####################################################################
+# General compile rules
+#####################################################################
+
+.PHONY: fpc_all fpc_debug
+
+$(FPCMAKED):
+	@$(ECHO) Compiled > $(FPCMAKED)
+
+fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
+	 $(addsuffix _component,$(COMPILECOMPONENTS)) \
+	 $(ALLTARGET) $(FPCMAKED)
+
+fpc_debug:
+	$(MAKE) all DEBUG=1
+
+# General compile rules, available for both possible PASEXT
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_smart fpc_shared
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+endif
+
+fpc_smart:
+	$(MAKE) all SMARTLINK=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=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+endif
+endif
+
+fpc_showinstall: $(SHOWINSTALLTARGET)
+ifdef INSTALLEXEFILES
+	@$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
+endif
+ifdef INSTALLPPUFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	@$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(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) $(EXTRAINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
+endif
+
+#####################################################################
+# Source install rules
+#####################################################################
+
+.PHONY: fpc_sourceinstall
+
+fpc_sourceinstall: clean
+	$(MKDIR) $(SOURCEINSTALLDIR)
+	$(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall fpc_zipinstalladd
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Test dir if none specified
+ifndef DESTZIPDIR
+DESTZIPDIR=$(BASEDIR)
+endif
+
+# Add .zip/.tar.gz extension
+ifdef ZIPNAME
+ifndef inlinux
+override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
+endif
+endif
+
+# Note: This will not remove the zipfile first
+fpc_zipinstalladd:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
+	cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
+	gzip $(DESTZIPDIR)/$(ZIPNAME).tar
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+# First remove the zip and then install
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_cleanall
+
+ifdef EXTRACLEANUNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
+endif
+
+ifdef CLEANPPUFILES
+ifdef PPUFILES
+CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES=$(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 EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(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
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)
+	@$(ECHO)
+

+ 92 - 0
packages/opengl/linuxd/Makefile.fpc

@@ -0,0 +1,92 @@
+#
+#   Makefile.fpc for Linux dynamic GL units
+#
+
+[targets]
+; The units which should be compiled
+units=xlib gl glut
+; The programs which should be compiled
+programs=
+
+
+[defaults]
+; the default build target should only compile the units ?
+defaultunits=0
+; What is the default rule to call
+defaultrule=all
+; force target OS
+defaulttarget=
+; force target CPU
+defaultcpu=
+; options needed to compile (like -S2 or -Sg)
+defaultoptions=
+
+
+[dirs]
+; what is the default location of FPC
+fpcdir=
+; which dirs need to be searched for units
+unitdir=
+; which dirs need to be searched for libs
+libdir=
+; which dirs need to be searched for object files
+objdir=
+; which dirs need to be searched for include files
+incdir=
+; where to place the created units/files
+targetdir=
+; where to place the created units
+unittargetdir=
+
+
+[libs]
+; linking with libgcc.a needed ?
+libgcc=0
+; linking with other libraries needed (not in the /lib;/usr/lib;/usr/X11R6/lib)
+libother=0
+
+
+[tools]
+; sed needed?
+toolsed=0
+; cmp needed?
+toolcmp=0
+; diff needed?
+tooldiff=0
+; try to use upx for compression ?
+toolupx=1
+; date needed?
+tooldate=1
+; zip needed?
+toolzip=1
+
+
+[info]
+; show configuration info
+infocfg=1
+; show directory info
+infodir=0
+; show which tools are found
+infotools=0
+; show install dirs
+infoinstall=1
+; show build objects
+infoobjects=1
+; show files found in current dir
+infofiles=0
+
+
+[presettings]
+; Add here the makefile commands which need to be done at the beginning
+; of the user settings section
+
+
+[postsettings]
+; Add here the makefile commands which need to be done at the end
+; of the user settings section
+
+
+[rules]
+; here you can add your own rules, the general rules will automaticly
+; remove the defaults which call fpc_<rule>.
+

+ 2147 - 0
packages/opengl/linuxd/gl.pp

@@ -0,0 +1,2147 @@
+{
+  $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 XLib;
+
+// ===================================================================
+//   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;
+
+// ===================================================================
+//   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;
+
+  // 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
+// -------------------------------------------------------------------
+
+var
+
+  // Miscellaneous
+  glClearIndex: procedure(c: Single); cdecl;
+  glClearColor: procedure(red, green, blue, alpha: GLclampf); cdecl;
+  glClear: procedure(mask: GLbitfield); cdecl;
+  glIndexMask: procedure(mask: LongWord); cdecl;
+  glColorMask: procedure(red, green, blue, alpha: Boolean); cdecl;
+  glAlphaFunc: procedure(func: GLenum; ref: GLclampf); cdecl;
+  glBlendFunc: procedure(sfactor, dfactor: GLenum); cdecl;
+  glLogicOp: procedure(opcode: GLenum); cdecl;
+  glCullFace: procedure(mode: GLenum); cdecl;
+  glFrontFace: procedure(mode: GLenum); cdecl;
+  glPointSize: procedure(size: Single); cdecl;
+  glLineWidth: procedure(width: Single); cdecl;
+  glLineStipple: procedure(factor: LongInt; pattern: Word); cdecl;
+  glPolygonMode: procedure(face, mode: GLenum); cdecl;
+  glPolygonOffset: procedure(factor, units: Single); cdecl;
+  glPolygonStipple: procedure(var mask: Byte); cdecl;
+  glGetPolygonStipple: procedure(var mask: Byte); cdecl;
+  glEdgeFlag: procedure(flag: Boolean); cdecl;
+  glEdgeFlagv: procedure(var flag: Boolean); cdecl;
+  glScissor: procedure(x, y, width, height: LongInt); cdecl;
+  glClipPlane: procedure(plane: GLenum; var equation: Double); cdecl;
+  glGetClipPlane: procedure(plane: GLenum; var equation: Double); cdecl;
+  glDrawBuffer: procedure(mode: GLenum); cdecl;
+  glReadBuffer: procedure(mode: GLenum); cdecl;
+  glEnable: procedure(cap: LongInt); cdecl;
+  glDisable: procedure(cap: LongInt); cdecl;
+  glIsEnabled: function(cap: GLenum): Boolean; cdecl;
+  glEnableClientState: procedure(cap: GLenum); cdecl; // 1.1
+  glDisableClientState: procedure(cap: GLenum); cdecl; // 1.1
+  glGetBooleanv: procedure(pname: GLenum; var params: Boolean); cdecl;
+  glGetDoublev: procedure(pname: GLenum; var params: Double); cdecl;
+  glGetFloatv: procedure(pname: GLenum; var params: Single); cdecl;
+  glGetIntegerv: procedure(pname: GLenum; var params: LongInt); cdecl;
+  glPushAttrib: procedure(mask: GLbitfield); cdecl;
+  glPopAttrib: procedure; cdecl;
+  glPushClientAttrib: procedure(mask: GLbitfield); cdecl; // 1.1
+  glPopClientAttrib: procedure; cdecl; // 1.1
+  glRenderMode: function(mode: GLenum): LongInt; cdecl;
+  glGetError: function: GLenum; cdecl;
+  glGetString: function(name: GLenum): PChar; cdecl;
+  glFinish: procedure; cdecl;
+  glFlush: procedure; cdecl;
+  glHint: procedure(target, mode: GLenum); cdecl;
+
+
+  // Depth Buffer
+  glClearDepth: procedure(depth: GLclampd); cdecl;
+  glDepthFunc: procedure(func: LongInt); cdecl;
+  glDepthMask: procedure(flag: Boolean); cdecl;
+  glDepthRange: procedure(near_val, far_val: GLclampd); cdecl;
+
+  // Accumulation Buffer
+  glClearAccum: procedure(red, green, blue, alpha: Single); cdecl;
+  glAccum: procedure(op: GLenum; value: Single); cdecl;
+
+  // Tranformation
+  glMatrixMode: procedure(mode: GLenum); cdecl;
+  glOrtho: procedure(left, right, bottom, top, near_val, far_val: Double); cdecl;
+  glFrustum: procedure(left, right, bottom, top, near_val, far_val: Double); cdecl;
+  glViewport: procedure(x, y, width, height: LongInt); cdecl;
+  glPushMatrix: procedure; cdecl;
+  glPopMatrix: procedure; cdecl;
+  glLoadIdentity: procedure; cdecl;
+  glLoadMatrixd: procedure(var m: Double); cdecl;
+  glLoadMatrixf: procedure(var m: PSingle); cdecl;
+  glMultMatrixd: procedure(var m: Double); cdecl;
+  glMultMatrixf: procedure(var m: Single); cdecl;
+  glRotated: procedure(angle, x, y, z: Double); cdecl;
+  glRotatef: procedure(angle, x, y, z: Single); cdecl;
+  glScaled: procedure(x, y, z: Double); cdecl;
+  glScalef: procedure(x, y, z: Single); cdecl;
+  glTranslated: procedure(x, y, z: Double); cdecl;
+  glTranslatef: procedure(x, y, z: Single); cdecl;
+
+  // Display Lists
+  glIsList: function(list: LongWord): Boolean; cdecl;
+  glDeleteLists: procedure(list: LongWord; range: LongInt); cdecl;
+  glGenLists: function(range: LongInt): LongWord; cdecl;
+  glNewList: procedure(list: LongWord; mode: GLenum); cdecl;
+  glEndList: procedure; cdecl;
+  glCallList: procedure(list: LongWord); cdecl;
+  glCallLists: procedure(n: LongInt; AType: GLenum; var lists); cdecl;
+  glListBase: procedure(base: LongWord); cdecl;
+
+  // Drawing Functions
+  glBegin: procedure(mode: GLenum); cdecl;
+  glEnd: procedure; cdecl;
+  glVertex2d: procedure(x, y: Double); cdecl;
+  glVertex2f: procedure(x, y: Single); cdecl;
+  glVertex2i: procedure(x, y: LongInt); cdecl;
+  glVertex2s: procedure(x, y: SmallInt); cdecl;
+  glVertex3d: procedure(x, y, z: Double); cdecl;
+  glVertex3f: procedure(x, y, z: Single); cdecl;
+  glVertex3i: procedure(x, y, z: LongInt); cdecl;
+  glVertex3s: procedure(x, y, z: SmallInt); cdecl;
+  glVertex4d: procedure(x, y, z, w: Double); cdecl;
+  glVertex4f: procedure(x, y, z, w: Single); cdecl;
+  glVertex4i: procedure(x, y, z, w: LongInt); cdecl;
+  glVertex4s: procedure(x, y, z, w: SmallInt); cdecl;
+  glVertex2dv: procedure(var v: Double); cdecl;
+  glVertex2fv: procedure(var v: Single); cdecl;
+  glVertex2iv: procedure(var v: LongInt); cdecl;
+  glVertex2sv: procedure(var v: SmallInt); cdecl;
+  glVertex3dv: procedure(var v: Double); cdecl;
+  glVertex3fv: procedure(var v: Single); cdecl;
+  glVertex3iv: procedure(var v: LongInt); cdecl;
+  glVertex3sv: procedure(var v: SmallInt); cdecl;
+  glVertex4dv: procedure(var v: Double); cdecl;
+  glVertex4fv: procedure(var v: Single); cdecl;
+  glVertex4iv: procedure(var v: LongInt); cdecl;
+  glVertex4sv: procedure(var v: SmallInt); cdecl;
+  glNormal3b: procedure(nx, ny, nz: Byte); cdecl;
+  glNormal3d: procedure(nx, ny, nz: Double); cdecl;
+  glNormal3f: procedure(nx, ny, nz: Single); cdecl;
+  glNormal3i: procedure(nx, ny, nz: LongInt); cdecl;
+  glNormal3s: procedure(nx, ny, nz: SmallInt); cdecl;
+  glNormal3bv: procedure(var v: ShortInt); cdecl;
+  glNormal3dv: procedure(var v: Double); cdecl;
+  glNormal3fv: procedure(var v: Single); cdecl;
+  glNormal3iv: procedure(var v: LongInt); cdecl;
+  glNormal3sv: procedure(var v: SmallInt); cdecl;
+  glIndexd: procedure(c: Double); cdecl;
+  glIndexf: procedure(c: Single); cdecl;
+  glIndexi: procedure(c: LongInt); cdecl;
+  glIndexs: procedure(c: SmallInt); cdecl;
+  glIndexub: procedure(c: Byte); cdecl; // 1.1
+  glIndexdv: procedure(var c: Double); cdecl;
+  glIndexfv: procedure(var c: Single); cdecl;
+  glIndexiv: procedure(var c: LongInt); cdecl;
+  glIndexsv: procedure(var c: SmallInt); cdecl;
+  glIndexubv: procedure(var c: Byte); cdecl; // 1.1
+  glColor3b : procedure(red, green, blue: ShortInt); cdecl;
+  glColor3d : procedure(red, green, blue: Double); cdecl;
+  glColor3f : procedure(red, green, blue: Single); cdecl;
+  glColor3i : procedure(red, green, blue: LongInt); cdecl;
+  glColor3s : procedure(red, green, blue: SmallInt); cdecl;
+  glColor3ub: procedure(red, green, blue: Byte); cdecl;
+  glColor3ui: procedure(red, green, blue: LongWord); cdecl;
+  glColor3us: procedure(red, green, blue: Word); cdecl;
+  glColor4b : procedure(red, green, blue, alpha: ShortInt); cdecl;
+  glColor4d : procedure(red, green, blue, alpha: Double); cdecl;
+  glColor4f : procedure(red, green, blue, alpha: Single); cdecl;
+  glColor4i : procedure(red, green, blue, alpha: LongInt); cdecl;
+  glColor4s : procedure(red, green, blue, alpha: SmallInt); cdecl;
+  glColor4ub: procedure(red, green, blue, alpha: Byte); cdecl;
+  glColor4ui: procedure(red, green, blue, alpha: LongWord); cdecl;
+  glColor4us: procedure(red, green, blue, alpha: Word); cdecl;
+  glColor3bv : procedure(var v: ShortInt); cdecl;
+  glColor3dv : procedure(var v: Double); cdecl;
+  glColor3fv : procedure(var v: Single); cdecl;
+  glColor3iv : procedure(var v: LongInt); cdecl;
+  glColor3sv : procedure(var v: SmallInt); cdecl;
+  glColor3ubv: procedure(var v: Byte); cdecl;
+  glColor3uiv: procedure(var v: LongWord); cdecl;
+  glColor3usv: procedure(var v: Word); cdecl;
+  glColor4bv : procedure(var v: ShortInt); cdecl;
+  glColor4dv : procedure(var v: Double); cdecl;
+  glColor4fv : procedure(var v: Single); cdecl;
+  glColor4iv : procedure(var v: LongInt); cdecl;
+  glColor4sv : procedure(var v: SmallInt); cdecl;
+  glColor4ubv: procedure(var v: Byte); cdecl;
+  glColor4uiv: procedure(var v: LongWord); cdecl;
+  glColor4usv: procedure(var v: Word); cdecl;
+  glTexCoord1d: procedure(s: Double); cdecl;
+  glTexCoord1f: procedure(s: Single); cdecl;
+  glTexCoord1i: procedure(s: LongInt); cdecl;
+  glTexCoord1s: procedure(s: SmallInt); cdecl;
+  glTexCoord2d: procedure(s, t: Double); cdecl;
+  glTexCoord2f: procedure(s, t: Single); cdecl;
+  glTexCoord2i: procedure(s, t: LongInt); cdecl;
+  glTexCoord2s: procedure(s, t: SmallInt); cdecl;
+  glTexCoord3d: procedure(s, t, r: Double); cdecl;
+  glTexCoord3f: procedure(s, t, r: Single); cdecl;
+  glTexCoord3i: procedure(s, t, r: LongInt); cdecl;
+  glTexCoord3s: procedure(s, t, r: SmallInt); cdecl;
+  glTexCoord4d: procedure(s, t, r, q: Double); cdecl;
+  glTexCoord4f: procedure(s, t, r, q: Single); cdecl;
+  glTexCoord4i: procedure(s, t, r, q: LongInt); cdecl;
+  glTexCoord4s: procedure(s, t, r, q: SmallInt); cdecl;
+  glTexCoord1dv: procedure(var v: Double); cdecl;
+  glTexCoord1fv: procedure(var v: Single); cdecl;
+  glTexCoord1iv: procedure(var v: LongInt); cdecl;
+  glTexCoord1sv: procedure(var v: SmallInt); cdecl;
+  glTexCoord2dv: procedure(var v: Double); cdecl;
+  glTexCoord2fv: procedure(var v: Single); cdecl;
+  glTexCoord2iv: procedure(var v: LongInt); cdecl;
+  glTexCoord2sv: procedure(var v: SmallInt); cdecl;
+  glTexCoord3dv: procedure(var v: Double); cdecl;
+  glTexCoord3fv: procedure(var v: Single); cdecl;
+  glTexCoord3iv: procedure(var v: LongInt); cdecl;
+  glTexCoord3sv: procedure(var v: SmallInt); cdecl;
+  glTexCoord4dv: procedure(var v: Double); cdecl;
+  glTexCoord4fv: procedure(var v: Single); cdecl;
+  glTexCoord4iv: procedure(var v: LongInt); cdecl;
+  glTexCoord4sv: procedure(var v: SmallInt); cdecl;
+  glRasterPos2d: procedure(x, y: Double); cdecl;
+  glRasterPos2f: procedure(x, y: Single); cdecl;
+  glRasterPos2i: procedure(x, y: LongInt); cdecl;
+  glRasterPos2s: procedure(x, y: SmallInt); cdecl;
+  glRasterPos3d: procedure(x, y, z: Double); cdecl;
+  glRasterPos3f: procedure(x, y, z: Single); cdecl;
+  glRasterPos3i: procedure(x, y, z: LongInt); cdecl;
+  glRasterPos3s: procedure(x, y, z: SmallInt); cdecl;
+  glRasterPos4d: procedure(x, y, z, w: Double); cdecl;
+  glRasterPos4f: procedure(x, y, z, w: Single); cdecl;
+  glRasterPos4i: procedure(x, y, z, w: LongInt); cdecl;
+  glRasterPos4s: procedure(x, y, z, w: SmallInt); cdecl;
+  glRasterPos2dv: procedure(var v: Double); cdecl;
+  glRasterPos2fv: procedure(var v: Single); cdecl;
+  glRasterPos2iv: procedure(var v: LongInt); cdecl;
+  glRasterPos2sv: procedure(var v: SmallInt); cdecl;
+  glRasterPos3dv: procedure(var v: Double); cdecl;
+  glRasterPos3fv: procedure(var v: Single); cdecl;
+  glRasterPos3iv: procedure(var v: LongInt); cdecl;
+  glRasterPos3sv: procedure(var v: SmallInt); cdecl;
+  glRasterPos4dv: procedure(var v: Double); cdecl;
+  glRasterPos4fv: procedure(var v: Single); cdecl;
+  glRasterPos4iv: procedure(var v: LongInt); cdecl;
+  glRasterPos4sv: procedure(var v: SmallInt); cdecl;
+  glRectd: procedure(x1, y1, x2, y2: Double); cdecl;
+  glRectf: procedure(x1, y1, x2, y2: Single); cdecl;
+  glRecti: procedure(x1, y1, x2, y2: LongInt); cdecl;
+  glRects: procedure(x1, y1, x2, y2: SmallInt); cdecl;
+  glRectdv: procedure(var v1, v2: Double); cdecl;
+  glRectfv: procedure(var v1, v2: Single); cdecl;
+  glRectiv: procedure(var v1, v2: LongInt); cdecl;
+  glRectsv: procedure(var v1, v2: SmallInt); cdecl;
+
+  // Vertex Arrays (1.1)
+  glVertexPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); cdecl;
+  glNormalPointer: procedure(AType: GLenum; stride: LongInt; var ptr); cdecl;
+  glColorPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); cdecl;
+  glIndexPointer: procedure(AType: GLenum; stride: LongInt; var ptr); cdecl;
+  glTexCoordPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); cdecl;
+  glEdgeFlagPointer: procedure(stride: LongInt; var ptr); cdecl;
+  glGetPointerv: procedure(pname: GLenum; var params: Pointer); cdecl;
+  glArrayElement: procedure(i: LongInt); cdecl;
+  glDrawArrays: procedure(mode: GLenum; first, count: LongInt); cdecl;
+  glDrawElements: procedure(mode: GLenum; count: Integer; AType: GLenum; var indices); cdecl;
+  glInterleavedArrays: procedure(format: GLenum; stride: LongInt; var pointer); cdecl;
+
+  // Lighting
+  glShadeModel: procedure(mode: GLenum); cdecl;
+  glLightf: procedure(light, pname: GLenum; param: Single); cdecl;
+  glLighti: procedure(light, pname: GLenum; param: LongInt); cdecl;
+  glLightfv: procedure(light, pname: GLenum; var params: Single); cdecl;
+  glLightiv: procedure(light, pname: GLenum; var params: LongInt); cdecl;
+  glGetLightfv: procedure(light, pname: GLenum; var params: Single); cdecl;
+  glGetLightiv: procedure(light, pname: GLenum; var params: LongInt); cdecl;
+  glLightModelf: procedure(pname: GLenum; param: Single); cdecl;
+  glLightModeli: procedure(pname: GLenum; param: LongInt); cdecl;
+  glLightModelfv: procedure(pname: GLenum; var params: Single); cdecl;
+  glLightModeliv: procedure(pname: GLenum; var param: LongInt); cdecl;
+  glMaterialf: procedure(face, pname: GLenum; param: Single); cdecl;
+  glMateriali: procedure(face, pname: GLenum; param: LongInt); cdecl;
+  glMaterialfv: procedure(face, pname: GLenum; var params: Single); cdecl;
+  glMaterialiv: procedure(face, pname: GLenum; var params: LongInt); cdecl;
+  glGetMaterialfv: procedure(face, pname: GLenum; var params: Single); cdecl;
+  glGetMaterialiv: procedure(face, pname: GLenum; var params: LongInt); cdecl;
+  glColorMaterial: procedure(face, mode: GLenum); cdecl;
+
+  // Raster Functions
+  glPixelZoom: procedure(xfactor, yfactor: Single); cdecl;
+  glPixelStoref: procedure(pname: GLenum; param: Single); cdecl;
+  glPixelStorei: procedure(pname: GLenum; param: LongInt); cdecl;
+  glPixelTransferf: procedure(pname: GLenum; param: Single); cdecl;
+  glPixelTransferi: procedure(pname: GLenum; param: LongInt); cdecl;
+  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: Single); cdecl;
+  glPixelMapuiv: procedure(map: GLenum; mapsize: LongInt; var values: LongWord); cdecl;
+  glPixelMapusv: procedure(map: GLenum; mapsize: LongInt; var values: Word); cdecl;
+  glGetPixelMapfv: procedure(map: GLenum; var values: Single); cdecl;
+  glGetPixelMapuiv: procedure(map: GLenum; var values: LongWord); cdecl;
+  glGetPixelMapusv: procedure(map: GLenum; var values: Word); cdecl;
+  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: Single; var bitmap); cdecl;
+  glReadPixels: procedure(x, y, width, height: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glDrawPixels: procedure(width, height: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glCopyPixels: procedure(x, y, width, height: LongInt; AType: GLenum); cdecl;
+
+  // Stenciling
+  glStencilFunc: procedure(func: GLenum; ref: LongInt; mask: LongWord); cdecl;
+  glStencilMask: procedure(mask: LongWord); cdecl;
+  glStencilOp: procedure(fail, zfail, zpass: GLenum); cdecl;
+  glClearStencil: procedure(s: LongInt); cdecl;
+
+  // Texture Mapping
+  glTexGend: procedure(cord, pname: GLenum; param: Double); cdecl;
+  glTexGenf: procedure(cord, pname: GLenum; param: Single); cdecl;
+  glTexGeni: procedure(cord, pname: GLenum; param: LongInt); cdecl;
+  glTexGendv: procedure(cord, pname: GLenum; var params: Double); cdecl;
+  glTexGenfv: procedure(cord, pname: GLenum; var params: Single); cdecl;
+  glTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); cdecl;
+  glGetTexGendv: procedure(cord, pname: GLenum; var params: Double); cdecl;
+  glGetTexGenfv: procedure(cord, pname: GLenum; var params: Single); cdecl;
+  glGetTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); cdecl;
+  glTexEnvf: procedure(target, pname: GLenum; param: Single); cdecl;
+  glTexEnvi: procedure(target, pname: GLenum; param: LongInt); cdecl;
+  glTexEnvfv: procedure(target, pname: GLenum; var params: Single); cdecl;
+  glTexEnviv: procedure(target, pname: GLenum; var params: LongInt); cdecl;
+  glGetTexEnvfv: procedure(target, pname: GLenum; var params: Single); cdecl;
+  glGetTexEnviv: procedure(target, pname: GLenum; var params: LongInt); cdecl;
+  glTexParameterf: procedure(target, pname: GLenum; param: Single); cdecl;
+  glTexParameteri: procedure(target, pname: GLenum; param: LongInt); cdecl;
+  glTexParameterfv: procedure(target, pname: GLenum; var params: Single); cdecl;
+  glTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); cdecl;
+  glGetTexParameterfv: procedure(target, pname: GLenum; var params: Single); cdecl;
+  glGetTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); cdecl;
+  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: Single); cdecl;
+  glGetTexLevelParameteriv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: LongInt); cdecl;
+  glTexImage1D: procedure(target: GLenum; level, internalFormat, width, border: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glTexImage2D: procedure(target: GLenum; level, internalFormat, width, height, border: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glGetTexImage: procedure(target: GLenum; level: LongInt; format, AType: GLenum; var pixels); cdecl;
+  // 1.1 functions:
+  glGenTextures: procedure(n: LongInt; var textures: LongWord); cdecl;
+  glDeleteTextures: procedure(n: LongInt; var textures: LongWord); cdecl;
+  glBindTexture: procedure(target: GLenum; texture: LongWord); cdecl;
+  glPrioritizeTextures: procedure(n: LongInt; var textures: LongWord; var priorities: GLclampf); cdecl;
+  glAreTexturesResident: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; cdecl;
+  glIsTexture: function(texture: LongWord): Boolean; cdecl;
+  glTexSubImage1D: procedure(target: GLenum; level, xoffset, width: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, width, height: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glCopyTexImage1D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, border: LongInt); cdecl;
+  glCopyTexImage2D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, height, border: LongInt); cdecl;
+  glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y, width: LongInt); cdecl;
+  glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y, width, height: LongInt); cdecl;
+
+  // Evaluators
+  glMap1d: procedure(target: GLenum; u1, u2: Double; stride, order: LongInt; var points: Double); cdecl;
+  glMap1f: procedure(target: GLenum; u1, u2: Single; stride, order: LongInt; var points: Single); cdecl;
+  glMap2d: procedure(target: GLenum; u1, u2: Double; ustride, uorder: LongInt; v1, v2: Double; vstride, vorder: LongInt; var points: Double); cdecl;
+  glMap2f: procedure(target: GLenum; u1, u2: Single; ustride, uorder: LongInt; v1, v2: Single; vstride, vorder: LongInt; var points: Single); cdecl;
+  glGetMapdv: procedure(target, query: GLenum; var v: Double); cdecl;
+  glGetMapfv: procedure(target, query: GLenum; var v: Single); cdecl;
+  glGetMapiv: procedure(target, query: GLenum; var v: LongInt); cdecl;
+  glEvalCoord1d: procedure(u: Double); cdecl;
+  glEvalCoord1f: procedure(u: Single); cdecl;
+  glEvalCoord1dv: procedure(var u: Double); cdecl;
+  glEvalCoord1fv: procedure(var u: Single); cdecl;
+  glEvalCoord2d: procedure(u, v: Double); cdecl;
+  glEvalCoord2f: procedure(u, v: Single); cdecl;
+  glEvalCoord2dv: procedure(var u, v: Double); cdecl;
+  glEvalCoord2fv: procedure(var u, v: Single); cdecl;
+  glMapGrid1d: procedure(un: LongInt; u1, u2: Double); cdecl;
+  glMapGrid1f: procedure(un: LongInt; u1, u2: Single); cdecl;
+  glMapGrid2d: procedure(un: LongInt; u1, u2: Double; vn: LongInt; v1, v2: Double); cdecl;
+  glMapGrid2f: procedure(un: LongInt; u1, u2: Single; vn: LongInt; v1, v2: Single); cdecl;
+  glEvalPoint1: procedure(i: LongInt); cdecl;
+  glEvalPoint2: procedure(i, j: LongInt); cdecl;
+  glEvalMesh1: procedure(mode: GLenum; i1, i2: LongInt); cdecl;
+  glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: LongInt); cdecl;
+
+  // Fog
+  glFogf: procedure(pname: GLenum; param: Single); cdecl;
+  glFogi: procedure(pname: GLenum; param: LongInt); cdecl;
+  glFogfv: procedure(pname: GLenum; var params: Single); cdecl;
+  glFogiv: procedure(pname: GLenum; var params: LongInt); cdecl;
+
+  // Selection and Feedback
+  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: Single); cdecl;
+  glPassThrough: procedure(token: Single); cdecl;
+  glSelectBuffer: procedure(size: LongInt; var buffer: LongWord); cdecl;
+  glInitNames: procedure; cdecl;
+  glLoadName: procedure(name: LongWord); cdecl;
+  glPushName: procedure(name: LongWord); cdecl;
+  glPopName: procedure; cdecl;
+
+const
+// -------------------------------------------------------
+//   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;
+
+
+// -------------------------------------------------------
+//   GL Extension Procedures
+// -------------------------------------------------------
+
+var
+
+  // === 1.0 Extensions ===
+
+  // GL_EXT_blend_minmax
+  glBlendEquationEXT: procedure(mode: GLenum); cdecl;
+
+  // GL_EXT_blend_color
+  glBlendColorEXT: procedure(red, green, blue, alpha: GLclampf); cdecl;
+
+  // GL_EXT_polygon_offset
+  glPolygonOffsetEXT: procedure(factor, bias: Single); cdecl;
+
+  // GL_EXT_vertex_array
+  glVertexPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); cdecl;
+  glNormalPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); cdecl;
+  glColorPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); cdecl;
+  glIndexPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); cdecl;
+  glTexCoordPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); cdecl;
+  glEdgeFlagPointerEXT: procedure(stride, count: LongInt; var ptr: Boolean); cdecl;
+  glGetPointervEXT: procedure(pname: GLenum; var params: Pointer); cdecl;
+  glArrayElementEXT: procedure(i: LongInt); cdecl;
+  glDrawArraysEXT: procedure(mode: GLEnum; first, count: LongInt); cdecl;
+
+  // GL_EXT_texture_object
+  glGenTexturesEXT: procedure(n: LongInt; var textures: LongWord); cdecl;
+  glDeleteTexturesEXT: procedure(n: LongInt; var textures: LongWord); cdecl;
+  glBindTextureEXT: procedure(target: GLenum; texture: LongWord); cdecl;
+  glPrioritizeTexturesEXT: procedure(n: LongInt; var textures: LongWord; var priorities: GLClampf); cdecl;
+  glAreTexturesResidentEXT: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; cdecl;
+  glIsTextureEXT: function(texture: LongWord): Boolean; cdecl;
+
+  // GL_EXT_texture3D
+  glTexImage3DEXT: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLenum; var pixels); cdecl;
+  glCopyTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, x, y, width, height: LongInt); cdecl;
+
+  // GL_EXT_color_table
+  glColorTableEXT: procedure(target, internalformat: GLenum; width: LongInt; format, AType: GLenum; var table); cdecl;
+  glColorSubTableEXT: procedure(target: GLenum; start, count: LongInt; format, AType: GLEnum; var data); cdecl;
+  glGetColorTableEXT: procedure(target, format, AType: GLenum; var table); cdecl;
+  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: Single); cdecl;
+  glGetColorTableParameterivEXT: procedure(target, pname: GLenum; var params: LongInt); cdecl;
+
+  // GL_SGIS_multitexture
+  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: Double); cdecl;
+  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: Single); cdecl;
+  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord1iSGIS: procedure(target: GLenum; s: LongInt); cdecl;
+  glMultiTexCoord1ivSGIS: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord1sSGIS: procedure(target: GLenum; s: ShortInt); cdecl;
+  glMultiTexCoord1svSGIS: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: Double); cdecl;
+  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: Single); cdecl;
+  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord2iSGIS: procedure(target: GLenum; s, t: LongInt); cdecl;
+  glMultiTexCoord2ivSGIS: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord2sSGIS: procedure(target: GLenum; s, t: ShortInt); cdecl;
+  glMultiTexCoord2svSGIS: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: Double); cdecl;
+  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: Single); cdecl;
+  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord3iSGIS: procedure(target: GLenum; s, t, r: LongInt); cdecl;
+  glMultiTexCoord3ivSGIS: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord3sSGIS: procedure(target: GLenum; s, t, r: ShortInt); cdecl;
+  glMultiTexCoord3svSGIS: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: Double); cdecl;
+  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: Single); cdecl;
+  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord4iSGIS: procedure(target: GLenum; s, t, r, q: LongInt); cdecl;
+  glMultiTexCoord4ivSGIS: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord4sSGIS: procedure(target: GLenum; s, t, r, q: ShortInt); cdecl;
+  glMultiTexCoord4svSGIS: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoordPointerSGIS: procedure(target: GLenum; size: LongInt; AType: GLEnum; stride: LongInt; var APointer); cdecl;
+  glSelectTextureSGIS: procedure(target: GLenum); cdecl;
+  glSelectTextureCoordSetSGIS: procedure(target: GLenum); cdecl;
+
+  // GL_EXT_multitexture
+  glMultiTexCoord1dEXT: procedure(target: GLenum; s: Double); cdecl;
+  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord1fEXT: procedure(target: GLenum; s: Single); cdecl;
+  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord1iEXT: procedure(target: GLenum; s: LongInt); cdecl;
+  glMultiTexCoord1ivEXT: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord1sEXT: procedure(target: GLenum; s: ShortInt); cdecl;
+  glMultiTexCoord1svEXT: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: Double); cdecl;
+  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: Single); cdecl;
+  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord2iEXT: procedure(target: GLenum; s, t: LongInt); cdecl;
+  glMultiTexCoord2ivEXT: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord2sEXT: procedure(target: GLenum; s, t: ShortInt); cdecl;
+  glMultiTexCoord2svEXT: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: Double); cdecl;
+  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: Single); cdecl;
+  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord3iEXT: procedure(target: GLenum; s, t, r: LongInt); cdecl;
+  glMultiTexCoord3ivEXT: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord3sEXT: procedure(target: GLenum; s, t, r: ShortInt); cdecl;
+  glMultiTexCoord3svEXT: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: Double); cdecl;
+  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: Double); cdecl;
+  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: Single); cdecl;
+  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: Single); cdecl;
+  glMultiTexCoord4iEXT: procedure(target: GLenum; s, t, r, q: LongInt); cdecl;
+  glMultiTexCoord4ivEXT: procedure(target: GLenum; var v: LongInt); cdecl;
+  glMultiTexCoord4sEXT: procedure(target: GLenum; s, t, r, q: ShortInt); cdecl;
+  glMultiTexCoord4svEXT: procedure(target: GLenum; var v: ShortInt); cdecl;
+  glInterleavedTextureCoordSetsEXT: procedure(factor: LongInt); cdecl;
+  glSelectTextureEXT: procedure(target: GLenum); cdecl;
+  glSelectTextureCoordSetEXT: procedure(target: GLenum); cdecl;
+  glSelectTextureTransformEXT: procedure(target: GLenum); cdecl;
+
+  // GL_EXT_point_parameters
+  glPointParameterfEXT: procedure(pname: GLenum; param: Single); cdecl;
+  glPointParameterfvEXT: procedure(pname: GLenum; var params: Single); cdecl;
+
+  // GL_MESA_window_pos
+  glWindowPos2iMESA: procedure(x, y: LongInt); cdecl;
+  glWindowPos2sMESA: procedure(x, y: ShortInt); cdecl;
+  glWindowPos2fMESA: procedure(x, y: Single); cdecl;
+  glWindowPos2dMESA: procedure(x, y: Double); cdecl;
+  glWindowPos2ivMESA: procedure(var p: LongInt); cdecl;
+  glWindowPos2svMESA: procedure(var p: ShortInt); cdecl;
+  glWindowPos2fvMESA: procedure(var p: Single); cdecl;
+  glWindowPos2dvMESA: procedure(var p: Double); cdecl;
+  glWindowPos3iMESA: procedure(x, y, z: LongInt); cdecl;
+  glWindowPos3sMESA: procedure(x, y, z: ShortInt); cdecl;
+  glWindowPos3fMESA: procedure(x, y, z: Single); cdecl;
+  glWindowPos3dMESA: procedure(x, y, z: Double); cdecl;
+  glWindowPos3ivMESA: procedure(var p: LongInt); cdecl;
+  glWindowPos3svMESA: procedure(var p: ShortInt); cdecl;
+  glWindowPos3fvMESA: procedure(var p: Single); cdecl;
+  glWindowPos3dvMESA: procedure(var p: Double); cdecl;
+  glWindowPos4iMESA: procedure(x, y, z, w: LongInt); cdecl;
+  glWindowPos4sMESA: procedure(x, y, z, w: ShortInt); cdecl;
+  glWindowPos4fMESA: procedure(x, y, z, w: Single); cdecl;
+  glWindowPos4dMESA: procedure(x, y, z, w: Double); cdecl;
+  glWindowPos4ivMESA: procedure(var p: LongInt); cdecl;
+  glWindowPos4svMESA: procedure(var p: ShortInt); cdecl;
+  glWindowPos4fvMESA: procedure(var p: Single); cdecl;
+  glWindowPos4dvMESA: procedure(var p: Double); cdecl;
+
+  // GL_MESA_resize_buffers
+  glResizeBuffersMESA: procedure; cdecl;
+
+
+// ===================================================================
+//   GLU consts, types and functions
+// ===================================================================
+
+const
+  GLU_TRUE 				= GL_TRUE;
+  GLU_FALSE 				= GL_FALSE;
+
+  // Normal vectors
+  GLU_SMOOTH				= 100000;
+  GLU_FLAT				= 100001;
+  GLU_NONE				= 100002;
+
+  // Quadric draw styles
+  GLU_POINT				= 100010;
+  GLU_LINE				= 100011;
+  GLU_FILL				= 100012;
+  GLU_SILHOUETTE			= 100013;
+
+  // Quadric orientation
+  GLU_OUTSIDE				= 100020;
+  GLU_INSIDE				= 100021;
+
+  // Tesselator
+  GLU_BEGIN				= 100100;
+  GLU_VERTEX				= 100101;
+  GLU_END				= 100102;
+  GLU_ERROR				= 100103;
+  GLU_EDGE_FLAG				= 100104;
+
+  // Contour types
+  GLU_CW				= 100120;
+  GLU_CCW				= 100121;
+  GLU_INTERIOR				= 100122;
+  GLU_EXTERIOR				= 100123;
+  GLU_UNKNOWN				= 100124;
+
+  // Tesselation errors
+  GLU_TESS_ERROR1			= 100151;  // missing gluEndPolygon
+  GLU_TESS_ERROR2 			= 100152;  // missing gluBeginPolygon
+  GLU_TESS_ERROR3 			= 100153;  // misoriented contour
+  GLU_TESS_ERROR4 			= 100154;  // vertex/edge intersection
+  GLU_TESS_ERROR5 			= 100155;  // misoriented or self-intersecting loops
+  GLU_TESS_ERROR6 			= 100156;  // coincident vertices
+  GLU_TESS_ERROR7 			= 100157;  // all vertices collinear
+  GLU_TESS_ERROR8 			= 100158;  // intersecting edges
+  GLU_TESS_ERROR9 			= 100159;  // not coplanar contours
+
+  // NURBS
+  GLU_AUTO_LOAD_MATRIX			= 100200;
+  GLU_CULLING				= 100201;
+  GLU_PARAMETRIC_TOLERANCE		= 100202;
+  GLU_SAMPLING_TOLERANCE		= 100203;
+  GLU_DISPLAY_MODE			= 100204;
+  GLU_SAMPLING_METHOD			= 100205;
+  GLU_U_STEP				= 100206;
+  GLU_V_STEP				= 100207;
+
+  GLU_PATH_LENGTH			= 100215;
+  GLU_PARAMETRIC_ERROR			= 100216;
+  GLU_DOMAIN_DISTANCE			= 100217;
+
+  GLU_MAP1_TRIM_2			= 100210;
+  GLU_MAP1_TRIM_3			= 100211;
+
+  GLU_OUTLINE_POLYGON			= 100240;
+  GLU_OUTLINE_PATCH			= 100241;
+
+  GLU_NURBS_ERROR1  			= 100251;   // spline order un-supported
+  GLU_NURBS_ERROR2  			= 100252;   // too few knots
+  GLU_NURBS_ERROR3  			= 100253;   // valid knot range is empty
+  GLU_NURBS_ERROR4  			= 100254;   // decreasing knot sequence
+  GLU_NURBS_ERROR5  			= 100255;   // knot multiplicity > spline order
+  GLU_NURBS_ERROR6  			= 100256;   // endcurve() must follow bgncurve()
+  GLU_NURBS_ERROR7  			= 100257;   // bgncurve() must precede endcurve()
+  GLU_NURBS_ERROR8  			= 100258;   // ctrlarray or knot vector is NULL
+  GLU_NURBS_ERROR9  			= 100259;   // cannot draw pwlcurves
+  GLU_NURBS_ERROR10 			= 100260;   // missing gluNurbsCurve()
+  GLU_NURBS_ERROR11 			= 100261;   // missing gluNurbsSurface()
+  GLU_NURBS_ERROR12 			= 100262;   // endtrim() must precede endsurface()
+  GLU_NURBS_ERROR13 			= 100263;   // bgnsurface() must precede endsurface()
+  GLU_NURBS_ERROR14 			= 100264;   // curve of improper type passed as trim curve
+  GLU_NURBS_ERROR15 			= 100265;   // bgnsurface() must precede bgntrim()
+  GLU_NURBS_ERROR16 			= 100266;   // endtrim() must follow bgntrim()
+  GLU_NURBS_ERROR17 			= 100267;   // bgntrim() must precede endtrim()*/
+  GLU_NURBS_ERROR18 			= 100268;   // invalid or missing trim curve*/
+  GLU_NURBS_ERROR19 			= 100269;   // bgntrim() must precede pwlcurve()
+  GLU_NURBS_ERROR20 			= 100270;   // pwlcurve referenced twice*/
+  GLU_NURBS_ERROR21 			= 100271;   // pwlcurve and nurbscurve mixed
+  GLU_NURBS_ERROR22 			= 100272;   // improper usage of trim data type
+  GLU_NURBS_ERROR23 			= 100273;   // nurbscurve referenced twice
+  GLU_NURBS_ERROR24 			= 100274;   // nurbscurve and pwlcurve mixed
+  GLU_NURBS_ERROR25 			= 100275;   // nurbssurface referenced twice
+  GLU_NURBS_ERROR26 			= 100276;   // invalid property
+  GLU_NURBS_ERROR27 			= 100277;   // endsurface() must follow bgnsurface()
+  GLU_NURBS_ERROR28 			= 100278;   // intersecting or misoriented trim curves
+  GLU_NURBS_ERROR29 			= 100279;   // intersecting trim curves
+  GLU_NURBS_ERROR30 			= 100280;   // UNUSED
+  GLU_NURBS_ERROR31 			= 100281;   // unconnected trim curves
+  GLU_NURBS_ERROR32 			= 100282;   // unknown knot error
+  GLU_NURBS_ERROR33 			= 100283;   // negative vertex count encountered
+  GLU_NURBS_ERROR34 			= 100284;   // negative byte-stride
+  GLU_NURBS_ERROR35 			= 100285;   // unknown type descriptor
+  GLU_NURBS_ERROR36 			= 100286;   // null control point reference
+  GLU_NURBS_ERROR37 			= 100287;   // duplicate point on pwlcurve
+
+  // Errors
+  GLU_INVALID_ENUM			= 100900;
+  GLU_INVALID_VALUE			= 100901;
+  GLU_OUT_OF_MEMORY			= 100902;
+  GLU_INCOMPATIBLE_GL_VERSION		= 100903;
+
+  // New in GLU 1.1
+  GLU_VERSION				= 100800;
+  GLU_EXTENSIONS			= 100801;
+
+type
+  PGLUquadricObj = ^TGLUquadricObj;
+  TGLUquadricObj = record end;
+  PGLUtriangulatorObj = ^TGLUtriangulatorObj;
+  TGLUtriangulatorObj = record end;
+  PGLUnurbsObj = ^TGLUnurbsObj;
+  TGLUnurbsObj = record end;
+
+  TGLUQuadricCallback = procedure; cdecl;
+  TGLUNurbsCallback = procedure; cdecl;
+  TGLUTessCallback = procedure; cdecl;
+
+  TGLUViewport = array[0..3] of LongInt;
+  TGLUMatrixd = array[0..15] of Double;
+  TGLUMatrixf = array[0..15] of Single;
+  TGLUVectord = array[0..2] of Double;
+var
+  // Miscellaneous functions
+  gluLookAt: procedure(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: Double); cdecl;
+  gluOrtho2D: procedure(left, right, bottom, top: Double); cdecl;
+  gluPerspective: procedure(fovy, aspect, zNear, zFar: Double); cdecl;
+  gluPickMatrix: procedure(x, y, width, height: Double; const viewport: TGLUViewport); cdecl;
+  gluProject: procedure(objx, objy, objz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; winx, winy, winz: Double); cdecl;
+  gluUnProject: procedure(winx, winy, winz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; objx, objy, objz: Double); cdecl;
+  gluErrorString: procedure(errorCode: GLenum); cdecl;
+
+  // Mipmapping and image scaling
+  gluScaleImage: procedure(format: GLenum; within, heightin: LongInt; typein: GLenum; var datain; widthout, heightout: LongInt; typeout: GLenum; var dataout); cdecl;
+  gluBuild1DMipmaps: procedure(target: GLenum; components, width: LongInt; format, AType: GLEnum; var data); cdecl;
+  gluBuild2DMipmaps: procedure(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; var data); cdecl;
+
+  // Quadrics
+  gluNewQuadric: function: PGLUquadricObj; cdecl;
+  gluDeleteQuadric: procedure(state: PGLUquadricObj); cdecl;
+  gluQuadricDrawStyle: procedure(quadObject: PGLUquadricObj; drawStyle: GLenum); cdecl;
+  gluQuadricOrientation: procedure(quadObject: PGLUquadricObj; orientation: GLenum); cdecl;
+  gluQuadricNormals: procedure(quadObject: PGLUquadricObj; normals: GLenum); cdecl;
+  gluQuadricTexture: procedure(quadObject: PGLUquadricObj; textureCoords: Boolean); cdecl;
+  gluQuadricCallback: procedure(quadObject: PGLUquadricObj; which: GLenum; fn: TGLUQuadricCallback); cdecl;
+  gluCylinder: procedure(qobj: PGLUquadricObj; baseRadius, topRadius, height: Double; slices, stacks: LongInt); cdecl;
+  gluSphere: procedure(qobj: PGLUquadricObj; radius: Double; slices, stacks: LongInt); cdecl;
+  gluDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt); cdecl;
+  gluPartialDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt; startAngle, sweepAngle: Double); cdecl;
+
+  // Nurbs
+  gluNewNurbsRenderer: function: PGLUnurbsObj; cdecl;
+  gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluLoadSamplingMatrices: procedure(nobj: PGLUnurbsObj; const modelMatrix, projMatrix: TGLUMatrixf; const viewport: TGLUViewport); cdecl;
+  gluNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLenum; value: Single); cdecl;
+  gluGetNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: Single); cdecl;
+  gluBeginCurve: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluEndCurve: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluNurbsCurve: procedure(nobj: PGLUnurbsObj; nknots: LongInt; var know: Single; stride: LongInt; var ctlarray: Single; order: LongInt; AType: GLenum); cdecl;
+  gluBeginSurface: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluEndSurface: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluNurbsSurface: procedure(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: Single; tknot_count: LongInt; var tknot: Single; s_stride, t_stride: LongInt; var ctlarray: Single; sorder, torder: LongInt; AType: GLenum); cdecl;
+  gluBeginTrim: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluEndTrim: procedure(nobj: PGLUnurbsObj); cdecl;
+  gluPwlCurve: procedure(nobj: PGLUnurbsObj; count: LongInt; var AArray: Single; stride: LongInt; AType: GLenum); cdecl;
+  gluNurbsCallback: procedure(nobj: PGLUnurbsObj; which: GLenum; fn: TGLUNurbsCallback); cdecl;
+
+  // Polygon tesselation
+  gluNewTess: function: PGLUtriangulatorObj; cdecl;
+  gluTessCallback: procedure(tobj: PGLUtriangulatorObj; which: GLenum; fn: TGLUTessCallback); cdecl;
+
+  gluDeleteTess: procedure(tobj: PGLUtriangulatorObj); cdecl;
+  gluBeginPolygon: procedure(tobj: PGLUtriangulatorObj); cdecl;
+  gluEndPolygon: procedure(tobj: PGLUtriangulatorObj); cdecl;
+  gluNextContour: procedure(tobj: PGLUtriangulatorObj; AType: GLenum); cdecl;
+  gluTessVertex: procedure(tobj: PGLUtriangulatorObj; v: TGLUVectord; var data); cdecl;
+
+  // New functions in GLU 1.1
+  gluGetString: function(name: GLenum): PChar; cdecl;
+
+
+// ===================================================================
+//   GLX consts, types and functions
+// ===================================================================
+
+// Tokens for glXChooseVisual and glXGetConfig:
+const
+  GLX_USE_GL				= 1;
+  GLX_BUFFER_SIZE			= 2;
+  GLX_LEVEL				= 3;
+  GLX_RGBA				= 4;
+  GLX_DOUBLEBUFFER			= 5; 
+  GLX_STEREO				= 6;
+  GLX_AUX_BUFFERS			= 7;
+  GLX_RED_SIZE				= 8;
+  GLX_GREEN_SIZE			= 9;
+  GLX_BLUE_SIZE				= 10;
+  GLX_ALPHA_SIZE			= 11;
+  GLX_DEPTH_SIZE			= 12;
+  GLX_STENCIL_SIZE			= 13;
+  GLX_ACCUM_RED_SIZE			= 14;
+  GLX_ACCUM_GREEN_SIZE			= 15;
+  GLX_ACCUM_BLUE_SIZE			= 16;
+  GLX_ACCUM_ALPHA_SIZE			= 17;
+
+  // GLX_EXT_visual_info extension
+  GLX_X_VISUAL_TYPE_EXT			= $22;
+  GLX_TRANSPARENT_TYPE_EXT		= $23;
+  GLX_TRANSPARENT_INDEX_VALUE_EXT 	= $24;
+  GLX_TRANSPARENT_RED_VALUE_EXT		= $25;
+  GLX_TRANSPARENT_GREEN_VALUE_EXT	= $26;
+  GLX_TRANSPARENT_BLUE_VALUE_EXT	= $27;
+  GLX_TRANSPARENT_ALPHA_VALUE_EXT	= $28;
+
+
+  // Error codes returned by glXGetConfig:
+  GLX_BAD_SCREEN			= 1;
+  GLX_BAD_ATTRIBUTE			= 2;
+  GLX_NO_EXTENSION			= 3;
+  GLX_BAD_VISUAL			= 4;
+  GLX_BAD_CONTEXT			= 5;
+  GLX_BAD_VALUE       			= 6;
+  GLX_BAD_ENUM				= 7;
+
+  // GLX 1.1 and later:
+  GLX_VENDOR				= 1;
+  GLX_VERSION				= 2;
+  GLX_EXTENSIONS 			= 3;
+
+  // GLX_visual_info extension
+  GLX_TRUE_COLOR_EXT			= $8002;
+  GLX_DIRECT_COLOR_EXT			= $8003;
+  GLX_PSEUDO_COLOR_EXT			= $8004;
+  GLX_STATIC_COLOR_EXT			= $8005;
+  GLX_GRAY_SCALE_EXT			= $8006;
+  GLX_STATIC_GRAY_EXT			= $8007;
+  GLX_NONE_EXT				= $8000;
+  GLX_TRANSPARENT_RGB_EXT		= $8008;
+  GLX_TRANSPARENT_INDEX_EXT		= $8009;
+
+type
+  // From XLib:
+  XPixmap = XID;
+  XFont = XID;
+  XColormap = XID;
+
+  GLXContext = Pointer;
+  GLXPixmap = XID;
+  GLXDrawable = XID;
+  GLXContextID = XID;
+
+var
+  glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl; cdecl;
+  glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl; cdecl;
+  glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl; cdecl;
+  glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl; cdecl;
+  glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl; cdecl;
+  glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl; cdecl;
+  glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl; cdecl;
+  glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl; cdecl;
+  glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl; cdecl;
+  glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl; cdecl;
+  glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl; cdecl;
+  glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl; cdecl;
+  glXGetCurrentContext: function: GLXContext; cdecl; cdecl;
+  glXGetCurrentDrawable: function: GLXDrawable; cdecl; cdecl;
+  glXWaitGL: procedure; cdecl; cdecl;
+  glXWaitX: procedure; cdecl; cdecl;
+  glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl; cdecl;
+
+  // GLX 1.1 and later
+  glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl; cdecl;
+  glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl; cdecl;
+  glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl; cdecl;
+
+  // Mesa GLX Extensions
+  glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl; cdecl;
+  glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl; cdecl;
+  glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl; cdecl;
+  glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl; cdecl;
+  glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl; cdecl;
+
+
+// ===================================================================
+// ===================================================================
+
+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;
+
+  glClearIndex := GetProc(libgl, 'glClearIndex');
+  glClearColor := GetProc(libgl, 'glClearColor');
+  glClear := GetProc(libgl, 'glClear');
+  glIndexMask := GetProc(libgl, 'glIndexMask');
+  glColorMask := GetProc(libgl, 'glColorMask');
+  glAlphaFunc := GetProc(libgl, 'glAlphaFunc');
+  glBlendFunc := GetProc(libgl, 'glBlendFunc');
+  glLogicOp := GetProc(libgl, 'glLogicOp');
+  glCullFace := GetProc(libgl, 'glCullFace');
+  glFrontFace := GetProc(libgl, 'glFrontFace');
+  glPointSize := GetProc(libgl, 'glPointSize');
+  glLineWidth := GetProc(libgl, 'glLineWidth');
+  glLineStipple := GetProc(libgl, 'glLineStipple');
+  glPolygonMode := GetProc(libgl, 'glPolygonMode');
+  glPolygonOffset := GetProc(libgl, 'glPolygonOffset');
+  glPolygonStipple := GetProc(libgl, 'glPolygonStipple');
+  glGetPolygonStipple := GetProc(libgl, 'glGetPolygonStipple');
+  glEdgeFlag := GetProc(libgl, 'glEdgeFlag');
+  glEdgeFlagv := GetProc(libgl, 'glEdgeFlagv');
+  glScissor := GetProc(libgl, 'glScissor');
+  glClipPlane := GetProc(libgl, 'glClipPlane');
+  glGetClipPlane := GetProc(libgl, 'glGetClipPlane');
+  glDrawBuffer := GetProc(libgl, 'glDrawBuffer');
+  glReadBuffer := GetProc(libgl, 'glReadBuffer');
+  glEnable := GetProc(libgl, 'glEnable');
+  glDisable := GetProc(libgl, 'glDisable');
+  glIsEnabled := GetProc(libgl, 'glIsEnabled');
+  glEnableClientState := GetProc(libgl, 'glEnableClientState');
+  glDisableClientState := GetProc(libgl, 'glDisableClientState');
+  glGetBooleanv := GetProc(libgl, 'glGetBooleanv');
+  glGetDoublev := GetProc(libgl, 'glGetDoublev');
+  glGetFloatv := GetProc(libgl, 'glGetFloatv');
+  glGetIntegerv := GetProc(libgl, 'glGetIntegerv');
+  glPushAttrib := GetProc(libgl, 'glPushAttrib');
+  glPopAttrib := GetProc(libgl, 'glPopAttrib');
+  glPushClientAttrib := GetProc(libgl, 'glPushClientAttrib');
+  glPopClientAttrib := GetProc(libgl, 'glPopClientAttrib');
+  glRenderMode := GetProc(libgl, 'glRenderMode');
+  glGetError := GetProc(libgl, 'glGetError');
+  glGetString := GetProc(libgl, 'glGetString');
+  glFinish := GetProc(libgl, 'glFinish');
+  glFlush := GetProc(libgl, 'glFlush');
+  glHint := GetProc(libgl, 'glHint');
+  glClearDepth := GetProc(libgl, 'glClearDepth');
+  glDepthFunc := GetProc(libgl, 'glDepthFunc');
+  glDepthMask := GetProc(libgl, 'glDepthMask');
+  glDepthRange := GetProc(libgl, 'glDepthRange');
+  glClearAccum := GetProc(libgl, 'glClearAccum');
+  glAccum := GetProc(libgl, 'glAccum');
+  glMatrixMode := GetProc(libgl, 'glMatrixMode');
+  glOrtho := GetProc(libgl, 'glOrtho');
+  glFrustum := GetProc(libgl, 'glFrustum');
+  glViewport := GetProc(libgl, 'glViewport');
+  glPushMatrix := GetProc(libgl, 'glPushMatrix');
+  glPopMatrix := GetProc(libgl, 'glPopMatrix');
+  glLoadIdentity := GetProc(libgl, 'glLoadIdentity');
+  glLoadMatrixd := GetProc(libgl, 'glLoadMatrixd');
+  glLoadMatrixf := GetProc(libgl, 'glLoadMatrixf');
+  glMultMatrixd := GetProc(libgl, 'glMultMatrixd');
+  glMultMatrixf := GetProc(libgl, 'glMultMatrixf');
+  glRotated := GetProc(libgl, 'glRotated');
+  glRotatef := GetProc(libgl, 'glRotatef');
+  glScaled := GetProc(libgl, 'glScaled');
+  glScalef := GetProc(libgl, 'glScalef');
+  glTranslated := GetProc(libgl, 'glTranslated');
+  glTranslatef := GetProc(libgl, 'glTranslatef');
+  glIsList := GetProc(libgl, 'glIsList');
+  glDeleteLists := GetProc(libgl, 'glDeleteLists');
+  glGenLists := GetProc(libgl, 'glGenLists');
+  glNewList := GetProc(libgl, 'glNewList');
+  glEndList := GetProc(libgl, 'glEndList');
+  glCallList := GetProc(libgl, 'glCallList');
+  glCallLists := GetProc(libgl, 'glCallLists');
+  glListBase := GetProc(libgl, 'glListBase');
+  glBegin := GetProc(libgl, 'glBegin');
+  glEnd := GetProc(libgl, 'glEnd');
+  glVertex2d := GetProc(libgl, 'glVertex2d');
+  glVertex2f := GetProc(libgl, 'glVertex2f');
+  glVertex2i := GetProc(libgl, 'glVertex2i');
+  glVertex2s := GetProc(libgl, 'glVertex2s');
+  glVertex3d := GetProc(libgl, 'glVertex3d');
+  glVertex3f := GetProc(libgl, 'glVertex3f');
+  glVertex3i := GetProc(libgl, 'glVertex3i');
+  glVertex3s := GetProc(libgl, 'glVertex3s');
+  glVertex4d := GetProc(libgl, 'glVertex4d');
+  glVertex4f := GetProc(libgl, 'glVertex4f');
+  glVertex4i := GetProc(libgl, 'glVertex4i');
+  glVertex4s := GetProc(libgl, 'glVertex4s');
+  glVertex2dv := GetProc(libgl, 'glVertex2dv');
+  glVertex2fv := GetProc(libgl, 'glVertex2fv');
+  glVertex2iv := GetProc(libgl, 'glVertex2iv');
+  glVertex2sv := GetProc(libgl, 'glVertex2sv');
+  glVertex3dv := GetProc(libgl, 'glVertex3dv');
+  glVertex3fv := GetProc(libgl, 'glVertex3fv');
+  glVertex3iv := GetProc(libgl, 'glVertex3iv');
+  glVertex3sv := GetProc(libgl, 'glVertex3sv');
+  glVertex4dv := GetProc(libgl, 'glVertex4dv');
+  glVertex4fv := GetProc(libgl, 'glVertex4fv');
+  glVertex4iv := GetProc(libgl, 'glVertex4iv');
+  glVertex4sv := GetProc(libgl, 'glVertex4sv');
+  glNormal3b := GetProc(libgl, 'glNormal3b');
+  glNormal3d := GetProc(libgl, 'glNormal3d');
+  glNormal3f := GetProc(libgl, 'glNormal3f');
+  glNormal3i := GetProc(libgl, 'glNormal3i');
+  glNormal3s := GetProc(libgl, 'glNormal3s');
+  glNormal3bv := GetProc(libgl, 'glNormal3bv');
+  glNormal3dv := GetProc(libgl, 'glNormal3dv');
+  glNormal3fv := GetProc(libgl, 'glNormal3fv');
+  glNormal3iv := GetProc(libgl, 'glNormal3iv');
+  glNormal3sv := GetProc(libgl, 'glNormal3sv');
+  glIndexd := GetProc(libgl, 'glIndexd');
+  glIndexf := GetProc(libgl, 'glIndexf');
+  glIndexi := GetProc(libgl, 'glIndexi');
+  glIndexs := GetProc(libgl, 'glIndexs');
+  glIndexub := GetProc(libgl, 'glIndexub');
+  glIndexdv := GetProc(libgl, 'glIndexdv');
+  glIndexfv := GetProc(libgl, 'glIndexfv');
+  glIndexiv := GetProc(libgl, 'glIndexiv');
+  glIndexsv := GetProc(libgl, 'glIndexsv');
+  glIndexubv := GetProc(libgl, 'glIndexubv');
+  glColor3b := GetProc(libgl, 'glColor3b');
+  glColor3d := GetProc(libgl, 'glColor3d');
+  glColor3f := GetProc(libgl, 'glColor3f');
+  glColor3i := GetProc(libgl, 'glColor3i');
+  glColor3s := GetProc(libgl, 'glColor3s');
+  glColor3ub := GetProc(libgl, 'glColor3ub');
+  glColor3ui := GetProc(libgl, 'glColor3ui');
+  glColor3us := GetProc(libgl, 'glColor3us');
+  glColor4b := GetProc(libgl, 'glColor4b');
+  glColor4d := GetProc(libgl, 'glColor4d');
+  glColor4f := GetProc(libgl, 'glColor4f');
+  glColor4i := GetProc(libgl, 'glColor4i');
+  glColor4s := GetProc(libgl, 'glColor4s');
+  glColor4ub := GetProc(libgl, 'glColor4ub');
+  glColor4ui := GetProc(libgl, 'glColor4ui');
+  glColor4us := GetProc(libgl, 'glColor4us');
+  glColor3bv := GetProc(libgl, 'glColor3bv');
+  glColor3dv := GetProc(libgl, 'glColor3dv');
+  glColor3fv := GetProc(libgl, 'glColor3fv');
+  glColor3iv := GetProc(libgl, 'glColor3iv');
+  glColor3sv := GetProc(libgl, 'glColor3sv');
+  glColor3ubv := GetProc(libgl, 'glColor3ubv');
+  glColor3uiv := GetProc(libgl, 'glColor3uiv');
+  glColor3usv := GetProc(libgl, 'glColor3usv');
+  glColor4bv := GetProc(libgl, 'glColor4bv');
+  glColor4dv := GetProc(libgl, 'glColor4dv');
+  glColor4fv := GetProc(libgl, 'glColor4fv');
+  glColor4iv := GetProc(libgl, 'glColor4iv');
+  glColor4sv := GetProc(libgl, 'glColor4sv');
+  glColor4ubv := GetProc(libgl, 'glColor4ubv');
+  glColor4uiv := GetProc(libgl, 'glColor4uiv');
+  glColor4usv := GetProc(libgl, 'glColor4usv');
+  glTexCoord1d := GetProc(libgl, 'glTexCoord1d');
+  glTexCoord1f := GetProc(libgl, 'glTexCoord1f');
+  glTexCoord1i := GetProc(libgl, 'glTexCoord1i');
+  glTexCoord1s := GetProc(libgl, 'glTexCoord1s');
+  glTexCoord2d := GetProc(libgl, 'glTexCoord2d');
+  glTexCoord2f := GetProc(libgl, 'glTexCoord2f');
+  glTexCoord2i := GetProc(libgl, 'glTexCoord2i');
+  glTexCoord2s := GetProc(libgl, 'glTexCoord2s');
+  glTexCoord3d := GetProc(libgl, 'glTexCoord3d');
+  glTexCoord3f := GetProc(libgl, 'glTexCoord3f');
+  glTexCoord3i := GetProc(libgl, 'glTexCoord3i');
+  glTexCoord3s := GetProc(libgl, 'glTexCoord3s');
+  glTexCoord4d := GetProc(libgl, 'glTexCoord4d');
+  glTexCoord4f := GetProc(libgl, 'glTexCoord4f');
+  glTexCoord4i := GetProc(libgl, 'glTexCoord4i');
+  glTexCoord4s := GetProc(libgl, 'glTexCoord4s');
+  glTexCoord1dv := GetProc(libgl, 'glTexCoord1dv');
+  glTexCoord1fv := GetProc(libgl, 'glTexCoord1fv');
+  glTexCoord1iv := GetProc(libgl, 'glTexCoord1iv');
+  glTexCoord1sv := GetProc(libgl, 'glTexCoord1sv');
+  glTexCoord2dv := GetProc(libgl, 'glTexCoord2dv');
+  glTexCoord2fv := GetProc(libgl, 'glTexCoord2fv');
+  glTexCoord2iv := GetProc(libgl, 'glTexCoord2iv');
+  glTexCoord2sv := GetProc(libgl, 'glTexCoord2sv');
+  glTexCoord3dv := GetProc(libgl, 'glTexCoord3dv');
+  glTexCoord3fv := GetProc(libgl, 'glTexCoord3fv');
+  glTexCoord3iv := GetProc(libgl, 'glTexCoord3iv');
+  glTexCoord3sv := GetProc(libgl, 'glTexCoord3sv');
+  glTexCoord4dv := GetProc(libgl, 'glTexCoord4dv');
+  glTexCoord4fv := GetProc(libgl, 'glTexCoord4fv');
+  glTexCoord4iv := GetProc(libgl, 'glTexCoord4iv');
+  glTexCoord4sv := GetProc(libgl, 'glTexCoord4sv');
+  glRasterPos2d := GetProc(libgl, 'glRasterPos2d');
+  glRasterPos2f := GetProc(libgl, 'glRasterPos2f');
+  glRasterPos2i := GetProc(libgl, 'glRasterPos2i');
+  glRasterPos2s := GetProc(libgl, 'glRasterPos2s');
+  glRasterPos3d := GetProc(libgl, 'glRasterPos3d');
+  glRasterPos3f := GetProc(libgl, 'glRasterPos3f');
+  glRasterPos3i := GetProc(libgl, 'glRasterPos3i');
+  glRasterPos3s := GetProc(libgl, 'glRasterPos3s');
+  glRasterPos4d := GetProc(libgl, 'glRasterPos4d');
+  glRasterPos4f := GetProc(libgl, 'glRasterPos4f');
+  glRasterPos4i := GetProc(libgl, 'glRasterPos4i');
+  glRasterPos4s := GetProc(libgl, 'glRasterPos4s');
+  glRasterPos2dv := GetProc(libgl, 'glRasterPos2dv');
+  glRasterPos2fv := GetProc(libgl, 'glRasterPos2fv');
+  glRasterPos2iv := GetProc(libgl, 'glRasterPos2iv');
+  glRasterPos2sv := GetProc(libgl, 'glRasterPos2sv');
+  glRasterPos3dv := GetProc(libgl, 'glRasterPos3dv');
+  glRasterPos3fv := GetProc(libgl, 'glRasterPos3fv');
+  glRasterPos3iv := GetProc(libgl, 'glRasterPos3iv');
+  glRasterPos3sv := GetProc(libgl, 'glRasterPos3sv');
+  glRasterPos4dv := GetProc(libgl, 'glRasterPos4dv');
+  glRasterPos4fv := GetProc(libgl, 'glRasterPos4fv');
+  glRasterPos4iv := GetProc(libgl, 'glRasterPos4iv');
+  glRasterPos4sv := GetProc(libgl, 'glRasterPos4sv');
+  glRectd := GetProc(libgl, 'glRectd');
+  glRectf := GetProc(libgl, 'glRectf');
+  glRecti := GetProc(libgl, 'glRecti');
+  glRects := GetProc(libgl, 'glRects');
+  glRectdv := GetProc(libgl, 'glRectdv');
+  glRectfv := GetProc(libgl, 'glRectfv');
+  glRectiv := GetProc(libgl, 'glRectiv');
+  glRectsv := GetProc(libgl, 'glRectsv');
+  glVertexPointer := GetProc(libgl, 'glVertexPointer');
+  glNormalPointer := GetProc(libgl, 'glNormalPointer');
+  glColorPointer := GetProc(libgl, 'glColorPointer');
+  glIndexPointer := GetProc(libgl, 'glIndexPointer');
+  glTexCoordPointer := GetProc(libgl, 'glTexCoordPointer');
+  glEdgeFlagPointer := GetProc(libgl, 'glEdgeFlagPointer');
+  glGetPointerv := GetProc(libgl, 'glGetPointerv');
+  glArrayElement := GetProc(libgl, 'glArrayElement');
+  glDrawArrays := GetProc(libgl, 'glDrawArrays');
+  glDrawElements := GetProc(libgl, 'glDrawElements');
+  glInterleavedArrays := GetProc(libgl, 'glInterleavedArrays');
+  glShadeModel := GetProc(libgl, 'glShadeModel');
+  glLightf := GetProc(libgl, 'glLightf');
+  glLighti := GetProc(libgl, 'glLighti');
+  glLightfv := GetProc(libgl, 'glLightfv');
+  glLightiv := GetProc(libgl, 'glLightiv');
+  glGetLightfv := GetProc(libgl, 'glGetLightfv');
+  glGetLightiv := GetProc(libgl, 'glGetLightiv');
+  glLightModelf := GetProc(libgl, 'glLightModelf');
+  glLightModeli := GetProc(libgl, 'glLightModeli');
+  glLightModelfv := GetProc(libgl, 'glLightModelfv');
+  glLightModeliv := GetProc(libgl, 'glLightModeliv');
+  glMaterialf := GetProc(libgl, 'glMaterialf');
+  glMateriali := GetProc(libgl, 'glMateriali');
+  glMaterialfv := GetProc(libgl, 'glMaterialfv');
+  glMaterialiv := GetProc(libgl, 'glMaterialiv');
+  glGetMaterialfv := GetProc(libgl, 'glGetMaterialfv');
+  glGetMaterialiv := GetProc(libgl, 'glGetMaterialiv');
+  glColorMaterial := GetProc(libgl, 'glColorMaterial');
+  glPixelZoom := GetProc(libgl, 'glPixelZoom');
+  glPixelStoref := GetProc(libgl, 'glPixelStoref');
+  glPixelStorei := GetProc(libgl, 'glPixelStorei');
+  glPixelTransferf := GetProc(libgl, 'glPixelTransferf');
+  glPixelTransferi := GetProc(libgl, 'glPixelTransferi');
+  glPixelMapfv := GetProc(libgl, 'glPixelMapfv');
+  glPixelMapuiv := GetProc(libgl, 'glPixelMapuiv');
+  glPixelMapusv := GetProc(libgl, 'glPixelMapusv');
+  glGetPixelMapfv := GetProc(libgl, 'glGetPixelMapfv');
+  glGetPixelMapuiv := GetProc(libgl, 'glGetPixelMapuiv');
+  glGetPixelMapusv := GetProc(libgl, 'glGetPixelMapusv');
+  glBitmap := GetProc(libgl, 'glBitmap');
+  glReadPixels := GetProc(libgl, 'glReadPixels');
+  glDrawPixels := GetProc(libgl, 'glDrawPixels');
+  glCopyPixels := GetProc(libgl, 'glCopyPixels');
+  glStencilFunc := GetProc(libgl, 'glStencilFunc');
+  glStencilMask := GetProc(libgl, 'glStencilMask');
+  glStencilOp := GetProc(libgl, 'glStencilOp');
+  glClearStencil := GetProc(libgl, 'glClearStencil');
+  glTexGend := GetProc(libgl, 'glTexGend');
+  glTexGenf := GetProc(libgl, 'glTexGenf');
+  glTexGeni := GetProc(libgl, 'glTexGeni');
+  glTexGendv := GetProc(libgl, 'glTexGendv');
+  glTexGenfv := GetProc(libgl, 'glTexGenfv');
+  glTexGeniv := GetProc(libgl, 'glTexGeniv');
+  glGetTexGendv := GetProc(libgl, 'glGetTexGendv');
+  glGetTexGenfv := GetProc(libgl, 'glGetTexGenfv');
+  glGetTexGeniv := GetProc(libgl, 'glGetTexGeniv');
+  glTexEnvf := GetProc(libgl, 'glTexEnvf');
+  glTexEnvi := GetProc(libgl, 'glTexEnvi');
+  glTexEnvfv := GetProc(libgl, 'glTexEnvfv');
+  glTexEnviv := GetProc(libgl, 'glTexEnviv');
+  glGetTexEnvfv := GetProc(libgl, 'glGetTexEnvfv');
+  glGetTexEnviv := GetProc(libgl, 'glGetTexEnviv');
+  glTexParameterf := GetProc(libgl, 'glTexParameterf');
+  glTexParameteri := GetProc(libgl, 'glTexParameteri');
+  glTexParameterfv := GetProc(libgl, 'glTexParameterfv');
+  glTexParameteriv := GetProc(libgl, 'glTexParameteriv');
+  glGetTexParameterfv := GetProc(libgl, 'glGetTexParameterfv');
+  glGetTexParameteriv := GetProc(libgl, 'glGetTexParameteriv');
+  glGetTexLevelParameterfv := GetProc(libgl, 'glGetTexLevelParameterfv');
+  glGetTexLevelParameteriv := GetProc(libgl, 'glGetTexLevelParameteriv');
+  glTexImage1D := GetProc(libgl, 'glTexImage1D');
+  glTexImage2D := GetProc(libgl, 'glTexImage2D');
+  glGetTexImage := GetProc(libgl, 'glGetTexImage');
+  glGenTextures := GetProc(libgl, 'glGenTextures');
+  glDeleteTextures := GetProc(libgl, 'glDeleteTextures');
+  glBindTexture := GetProc(libgl, 'glBindTexture');
+  glPrioritizeTextures := GetProc(libgl, 'glPrioritizeTextures');
+  glAreTexturesResident := GetProc(libgl, 'glAreTexturesResident');
+  glIsTexture := GetProc(libgl, 'glIsTexture');
+  glTexSubImage1D := GetProc(libgl, 'glTexSubImage1D');
+  glTexSubImage2D := GetProc(libgl, 'glTexSubImage2D');
+  glCopyTexImage1D := GetProc(libgl, 'glCopyTexImage1D');
+  glCopyTexImage2D := GetProc(libgl, 'glCopyTexImage2D');
+  glCopyTexSubImage1D := GetProc(libgl, 'glCopyTexSubImage1D');
+  glCopyTexSubImage2D := GetProc(libgl, 'glCopyTexSubImage2D');
+  glMap1d := GetProc(libgl, 'glMap1d');
+  glMap1f := GetProc(libgl, 'glMap1f');
+  glMap2d := GetProc(libgl, 'glMap2d');
+  glMap2f := GetProc(libgl, 'glMap2f');
+  glGetMapdv := GetProc(libgl, 'glGetMapdv');
+  glGetMapfv := GetProc(libgl, 'glGetMapfv');
+  glGetMapiv := GetProc(libgl, 'glGetMapiv');
+  glEvalCoord1d := GetProc(libgl, 'glEvalCoord1d');
+  glEvalCoord1f := GetProc(libgl, 'glEvalCoord1f');
+  glEvalCoord1dv := GetProc(libgl, 'glEvalCoord1dv');
+  glEvalCoord1fv := GetProc(libgl, 'glEvalCoord1fv');
+  glEvalCoord2d := GetProc(libgl, 'glEvalCoord2d');
+  glEvalCoord2f := GetProc(libgl, 'glEvalCoord2f');
+  glEvalCoord2dv := GetProc(libgl, 'glEvalCoord2dv');
+  glEvalCoord2fv := GetProc(libgl, 'glEvalCoord2fv');
+  glMapGrid1d := GetProc(libgl, 'glMapGrid1d');
+  glMapGrid1f := GetProc(libgl, 'glMapGrid1f');
+  glMapGrid2d := GetProc(libgl, 'glMapGrid2d');
+  glMapGrid2f := GetProc(libgl, 'glMapGrid2f');
+  glEvalPoint1 := GetProc(libgl, 'glEvalPoint1');
+  glEvalPoint2 := GetProc(libgl, 'glEvalPoint2');
+  glEvalMesh1 := GetProc(libgl, 'glEvalMesh1');
+  glEvalMesh2 := GetProc(libgl, 'glEvalMesh2');
+  glFogf := GetProc(libgl, 'glFogf');
+  glFogi := GetProc(libgl, 'glFogi');
+  glFogfv := GetProc(libgl, 'glFogfv');
+  glFogiv := GetProc(libgl, 'glFogiv');
+  glFeedbackBuffer := GetProc(libgl, 'glFeedbackBuffer');
+  glPassThrough := GetProc(libgl, 'glPassThrough');
+  glSelectBuffer := GetProc(libgl, 'glSelectBuffer');
+  glInitNames := GetProc(libgl, 'glInitNames');
+  glLoadName := GetProc(libgl, 'glLoadName');
+  glPushName := GetProc(libgl, 'glPushName');
+  glPopName := GetProc(libgl, 'glPopName');
+
+  GLInitialized := True;
+  Result := True;
+end;
+
+function InitGLUFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLU := LoadLibrary(libname);
+  if not Assigned(libGLU) then exit;
+
+  gluLookAt := GetProc(libglu, 'gluLookAt');
+  gluOrtho2D := GetProc(libglu, 'gluOrtho2D');
+  gluPerspective := GetProc(libglu, 'gluPerspective');
+  gluPickMatrix := GetProc(libglu, 'gluPickMatrix');
+  gluProject := GetProc(libglu, 'gluProject');
+  gluUnProject := GetProc(libglu, 'gluUnProject');
+  gluErrorString := GetProc(libglu, 'gluErrorString');
+  gluScaleImage := GetProc(libglu, 'gluScaleImage');
+  gluBuild1DMipmaps := GetProc(libglu, 'gluBuild1DMipmaps');
+  gluBuild2DMipmaps := GetProc(libglu, 'gluBuild2DMipmaps');
+  gluNewQuadric := GetProc(libglu, 'gluNewQuadric');
+  gluDeleteQuadric := GetProc(libglu, 'gluDeleteQuadric');
+  gluQuadricDrawStyle := GetProc(libglu, 'gluQuadricDrawStyle');
+  gluQuadricOrientation := GetProc(libglu, 'gluQuadricOrientation');
+  gluQuadricNormals := GetProc(libglu, 'gluQuadricNormals');
+  gluQuadricTexture := GetProc(libglu, 'gluQuadricTexture');
+  gluQuadricCallback := GetProc(libglu, 'gluQuadricCallback');
+  gluCylinder := GetProc(libglu, 'gluCylinder');
+  gluSphere := GetProc(libglu, 'gluSphere');
+  gluDisk := GetProc(libglu, 'gluDisk');
+  gluPartialDisk := GetProc(libglu, 'gluPartialDisk');
+  gluNewNurbsRenderer := GetProc(libglu, 'gluNewNurbsRenderer');
+  gluDeleteNurbsRenderer := GetProc(libglu, 'gluDeleteNurbsRenderer');
+  gluLoadSamplingMatrices := GetProc(libglu, 'gluLoadSamplingMatrices');
+  gluNurbsProperty := GetProc(libglu, 'gluNurbsProperty');
+  gluGetNurbsProperty := GetProc(libglu, 'gluGetNurbsProperty');
+  gluBeginCurve := GetProc(libglu, 'gluBeginCurve');
+  gluEndCurve := GetProc(libglu, 'gluEndCurve');
+  gluNurbsCurve := GetProc(libglu, 'gluNurbsCurve');
+  gluBeginSurface := GetProc(libglu, 'gluBeginSurface');
+  gluEndSurface := GetProc(libglu, 'gluEndSurface');
+  gluNurbsSurface := GetProc(libglu, 'gluNurbsSurface');
+  gluBeginTrim := GetProc(libglu, 'gluBeginTrim');
+  gluEndTrim := GetProc(libglu, 'gluEndTrim');
+  gluPwlCurve := GetProc(libglu, 'gluPwlCurve');
+  gluNurbsCallback := GetProc(libglu, 'gluNurbsCallback');
+  gluNewTess := GetProc(libglu, 'gluNewTess');
+  gluTessCallback := GetProc(libglu, 'gluTessCallback');
+  gluDeleteTess := GetProc(libglu, 'gluDeleteTess');
+  gluBeginPolygon := GetProc(libglu, 'gluBeginPolygon');
+  gluEndPolygon := GetProc(libglu, 'gluEndPolygon');
+  gluNextContour := GetProc(libglu, 'gluNextContour');
+  gluTessVertex := GetProc(libglu, 'gluTessVertex');
+  gluGetString := GetProc(libglu, 'gluGetString');
+
+  GLUInitialized := True;
+  Result := True;
+end;
+
+function InitGLX: Boolean;
+begin
+  Result := False;
+  if not Assigned(libGL) then exit;
+
+  glXChooseVisual := GetProc(libglx, 'glXChooseVisual');
+  glXCreateContext := GetProc(libglx, 'glXCreateContext');
+  glXDestroyContext := GetProc(libglx, 'glXDestroyContext');
+  glXMakeCurrent := GetProc(libglx, 'glXMakeCurrent');
+  glXCopyContext := GetProc(libglx, 'glXCopyContext');
+  glXSwapBuffers := GetProc(libglx, 'glXSwapBuffers');
+  glXCreateGLXPixmap := GetProc(libglx, 'glXCreateGLXPixmap');
+  glXDestroyGLXPixmap := GetProc(libglx, 'glXDestroyGLXPixmap');
+  glXQueryExtension := GetProc(libglx, 'glXQueryExtension');
+  glXQueryVersion := GetProc(libglx, 'glXQueryVersion');
+  glXIsDirect := GetProc(libglx, 'glXIsDirect');
+  glXGetConfig := GetProc(libglx, 'glXGetConfig');
+  glXGetCurrentContext := GetProc(libglx, 'glXGetCurrentContext');
+  glXGetCurrentDrawable := GetProc(libglx, 'glXGetCurrentDrawable');
+  glXWaitGL := GetProc(libglx, 'glXWaitGL');
+  glXWaitX := GetProc(libglx, 'glXWaitX');
+  glXUseXFont := GetProc(libglx, 'glXUseXFont');
+  glXQueryExtensionsString := GetProc(libglx, 'glXQueryExtensionsString');
+  glXQueryServerString := GetProc(libglx, 'glXQueryServerString');
+  glXGetClientString := GetProc(libglx, 'glXGetClientString');
+  glXCreateGLXPixmapMESA := GetProc(libglx, 'glXCreateGLXPixmapMESA');
+  glXReleaseBufferMESA := GetProc(libglx, 'glXReleaseBufferMESA');
+  glXCopySubBufferMESA := GetProc(libglx, 'glXCopySubBufferMESA');
+  glXGetVideoSyncSGI := GetProc(libglx, 'glXGetVideoSyncSGI');
+  glXWaitVideoSyncSGI := GetProc(libglx, 'glXWaitVideoSyncSGI');
+
+  GLXInitialized := True;
+  Result := True;
+end;
+
+function InitGL: Boolean;
+begin
+  Result := InitGLFromLibrary('libGL.so') or InitGLFromLibrary('libMesaGL.so');
+end;
+
+function InitGLU: Boolean;
+begin
+  Result := InitGLUFromLibrary('libGLU.so') or InitGLUFromLibrary('libMesaGLU.so');
+end;
+
+
+
+finalization
+  if Assigned(libGL)  then dlclose(libGL);
+  if Assigned(libGLU) then dlclose(libGLU);
+  if Assigned(libGLX) then dlclose(libGLX);
+end.
+
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+}

+ 402 - 0
packages/opengl/linuxd/glut.pp

@@ -0,0 +1,402 @@
+{
+  $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;
+
+
+
+
+const
+  // Display mode bit masks
+  GLUT_RGB			= 0;
+  GLUT_RGBA			= GLUT_RGB;
+  GLUT_INDEX			= 1;
+  GLUT_SINGLE			= 0;
+  GLUT_DOUBLE			= 2;
+  GLUT_ACCUM			= 4;
+  GLUT_ALPHA			= 8;
+  GLUT_DEPTH			= 16;
+  GLUT_STENCIL			= 32;
+  GLUT_MULTISAMPLE		= 128;
+  GLUT_STEREO			= 256;
+  GLUT_LUMINANCE		= 512;
+
+  // Mouse buttons
+  GLUT_LEFT_BUTTON		= 0;
+  GLUT_MIDDLE_BUTTON		= 1;
+  GLUT_RIGHT_BUTTON		= 2;
+
+  // Mouse button state
+  GLUT_DOWN			= 0;
+  GLUT_UP               	= 1;
+
+  // Keys ###
+
+  // Enter / exit state
+  GLUT_LEFT			= 0;
+  GLUT_ENTERED			= 1;
+
+  // Menu usage state
+  GLUT_MENU_NOT_IN_USE		= 0;
+  GLUT_MENU_IN_USE		= 1;
+
+  // Visibility state
+  GLUT_NOT_VISIBLE		= 0;
+  GLUT_VISIBLE			= 1;
+
+  // Window status state
+  GLUT_HIDDEN			= 0;
+  GLUT_FULLY_RETAINED		= 1;
+  GLUT_PARTIALLY_RETAINED 	= 2;
+  GLUT_FULLY_COVERED		= 3;
+
+  // Color index component selection values
+  GLUT_RED			= 0;
+  GLUT_GREEN			= 1;
+  GLUT_BLUE			= 2;
+
+  // Layers for use
+  GLUT_NORMAL			= 0;
+  GLUT_OVERLAY			= 1;
+
+  // Bitmap stuff###
+
+
+  // glutGet parameters
+  GLUT_WINDOW_X			= 100;
+  GLUT_WINDOW_Y			= 101;
+  GLUT_WINDOW_WIDTH		= 102;
+  GLUT_WINDOW_HEIGHT		= 103;
+  GLUT_WINDOW_BUFFER_SIZE	= 104;
+  GLUT_WINDOW_STENCIL_SIZE	= 105;
+  GLUT_WINDOW_DEPTH_SIZE	= 106;
+  GLUT_WINDOW_RED_SIZE		= 107;
+  GLUT_WINDOW_GREEN_SIZE	= 108;
+  GLUT_WINDOW_BLUE_SIZE		= 109;
+  GLUT_WINDOW_ALPHA_SIZE	= 110;
+  GLUT_WINDOW_ACCUM_RED_SIZE	= 111;
+  GLUT_WINDOW_ACCUM_GREEN_SIZE	= 112;
+  GLUT_WINDOW_ACCUM_BLUE_SIZE	= 113;
+  GLUT_WINDOW_ACCUM_ALPHA_SIZE	= 114;
+  GLUT_WINDOW_DOUBLEBUFFER	= 115;
+  GLUT_WINDOW_RGBA		= 116;
+  GLUT_WINDOW_PARENT		= 117;
+  GLUT_WINDOW_NUM_CHILDREN	= 118;
+  GLUT_WINDOW_COLORMAP_SIZE	= 119;
+  GLUT_WINDOW_NUM_SAMPLES	= 120;
+  GLUT_WINDOW_STEREO		= 121;
+  GLUT_WINDOW_CURSOR		= 122;
+  GLUT_SCREEN_WIDTH		= 200;
+  GLUT_SCREEN_HEIGHT		= 201;
+  GLUT_SCREEN_WIDTH_MM		= 202;
+  GLUT_SCREEN_HEIGHT_MM		= 203;
+  GLUT_MENU_NUM_ITEMS		= 300;
+  GLUT_DISPLAY_MODE_POSSIBLE	= 400;
+  GLUT_INIT_WINDOW_X		= 500;
+  GLUT_INIT_WINDOW_Y		= 501;
+  GLUT_INIT_WINDOW_WIDTH	= 502;
+  GLUT_INIT_WINDOW_HEIGHT	= 503;
+  GLUT_INIT_DISPLAY_MODE	= 504;
+  GLUT_ELAPSED_TIME		= 700;
+  GLUT_WINDOW_FORMAT_ID		= 123;
+
+  // glutDeviceGet parameters
+  GLUT_HAS_KEYBOARD		= 600;
+  GLUT_HAS_MOUSE		= 601;
+  GLUT_HAS_SPACEBALL		= 602;
+  GLUT_HAS_DIAL_AND_BUTTON_BOX	= 603;
+  GLUT_HAS_TABLET		= 604;
+  GLUT_NUM_MOUSE_BUTTONS	= 605;
+  GLUT_NUM_SPACEBALL_BUTTONS	= 606;
+  GLUT_NUM_BUTTON_BOX_BUTTONS	= 607;
+  GLUT_NUM_DIALS		= 608;
+  GLUT_NUM_TABLET_BUTTONS	= 609;
+  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
+  GLUT_DEVICE_KEY_REPEAT	= 611;
+  GLUT_HAS_JOYSTICK		= 612;
+  GLUT_OWNS_JOYSTICK		= 613;
+  GLUT_JOYSTICK_BUTTONS		= 614;
+  GLUT_JOYSTICK_AXES		= 615;
+  GLUT_JOYSTICK_POLL_RATE	= 616;
+
+  // glutLayerGet parameters
+  GLUT_OVERLAY_POSSIBLE		= 800;
+  GLUT_LAYER_IN_USE		= 801;
+  GLUT_HAS_OVERLAY		= 802;
+  GLUT_TRANSPARENT_INDEX	= 803;
+  GLUT_NORMAL_DAMAGED		= 804;
+  GLUT_OVERLAY_DAMAGED		= 805;
+
+  // glutVideoResizeGet parameters
+  GLUT_VIDEO_RESIZE_POSSIBLE	= 900;
+  GLUT_VIDEO_RESIZE_IN_USE	= 901;
+  GLUT_VIDEO_RESIZE_X_DELTA	= 902;
+  GLUT_VIDEO_RESIZE_Y_DELTA	= 903;
+  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
+  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
+  GLUT_VIDEO_RESIZE_X		= 906;
+  GLUT_VIDEO_RESIZE_Y		= 907;
+  GLUT_VIDEO_RESIZE_WIDTH	= 908;
+  GLUT_VIDEO_RESIZE_HEIGHT	= 909;
+
+  // glutGetModifiers return mask
+  GLUT_ACTIVE_SHIFT		= 1;
+  GLUT_ACTIVE_CTRL		= 2;
+  GLUT_ACTIVE_ALT		= 4;
+
+  // Cursor stuff ###
+
+// GLUT window callback sub-API
+type
+  TGlutDisplayFunc = procedure; cdecl;
+  TGlutReshapeFunc = procedure(width, height: Integer); cdecl;
+
+  TGlutTimerFunc = procedure(value: Integer); cdecl;
+
+// GLUT game mode sub-API
+// glutGameModeGet
+const
+  GLUT_GAME_MODE_ACTIVE		= 0;
+  GLUT_GAME_MODE_POSSIBLE	= 1;
+  GLUT_GAME_MODE_WIDTH		= 2;
+  GLUT_GAME_MODE_HEIGHT		= 3;
+  GLUT_GAME_MODE_PIXEL_DEPTH	= 4;
+  GLUT_GAME_MODE_REFRESH_RATE	= 5;
+  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;
+
+
+var
+// GLUT initialization sub-API
+  glutInit: procedure(var argcp: Integer; var argv: PChar); cdecl;
+  glutInitDisplayMode: procedure(mode: LongWord); cdecl;
+  glutInitDisplayString: procedure(AString: PChar); cdecl;
+  glutInitWindowPosition: procedure(x, y: Integer); cdecl;
+  glutInitWindowSize: procedure(width, height: Integer); cdecl;
+  glutMainLoop: procedure; cdecl;
+
+// GLUT window sub-API
+  glutCreateWindow: function(title: PChar): Integer; cdecl;
+  glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; cdecl;
+  glutDestroyWindow: procedure(win: Integer); cdecl;
+  glutPostRedisplay: procedure; cdecl;
+  glutPostWindowRedisplay: procedure(win: Integer); cdecl;
+  glutSwapBuffers: procedure; cdecl;
+  glutGetWindow: function: Integer; cdecl;
+  glutSetWindow: procedure(win: Integer); cdecl;
+  glutSetWindowTitle: procedure(title: PChar); cdecl;
+  glutSetIconTitle: procedure(title: PChar); cdecl;
+  glutPositionWindow: procedure(x, y: Integer); cdecl;
+  glutReshapeWindow: procedure(width, height: Integer); cdecl;
+  glutPopWindow: procedure; cdecl;
+  glutPushWindow: procedure; cdecl;
+  glutIconifyWindow: procedure; cdecl;
+  glutShowWindow: procedure; cdecl;
+  glutHideWindow: procedure; cdecl;
+  glutFullScreen: procedure; cdecl;
+  glutSetCursor: procedure(cursor: Integer); cdecl;
+  glutWarpPointer: procedure(x, y: Integer); cdecl;
+
+//overlays ###
+
+//menus ###
+
+// GLUT window callback sub-API
+  glutDisplayFunc: procedure(func: TGlutDisplayFunc); cdecl;
+  glutReshapeFunc: procedure(func: TGlutReshapeFunc); cdecl;
+
+  glutTimerFunc: procedure(millis: LongWord; func: TGlutTimerFunc; value: Integer); cdecl;
+
+
+// GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
+// GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+// GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+// GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
+// GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+// GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+// GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+// GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
+// GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
+// GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
+// GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+// GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+// GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
+// GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
+// GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
+// GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+// GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+// GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK * func)(unsigned int buttonMask, int x, int y, int z), int pollInterval)
+
+// GLUT color index sub-API
+  glutSetColor: procedure(index: Integer; red, green, blue: Single); cdecl;
+  glutGetColor: function(ndx, component: Integer): Single; cdecl;
+  glutCopyColormap: procedure(win: Integer); cdecl;
+
+// GLUT state retrieval sub-API
+  glutGet: function(AType: GLEnum): Integer; cdecl;
+  glutDeviceGet: function(AType: GLEnum): Integer; cdecl;
+  glutExtensionSupported: function(name: PChar): Integer; cdecl;
+  glutGetModifiers: function: Integer; cdecl;
+  glutLayerGet: function(AType: GLEnum): Integer; cdecl;
+
+// fonts ###
+
+// pre-built models ###
+
+// video resize ###
+
+// debugging ###
+
+// device control ###
+
+
+// GLUT game mode sub-API
+  glutGameModeString: procedure(AString: PChar); cdecl;
+  glutEnterGameMode: function: Integer; cdecl;
+  glutLeaveGameMode: procedure; cdecl;
+  glutGameModeGet: function(mode: GLEnum): Integer; cdecl;
+
+
+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;
+
+  glutInit := GetProc(libglut, 'glutInit');
+  glutInitDisplayMode := GetProc(libglut, 'glutInitDisplayMode');
+  glutInitDisplayString := GetProc(libglut, 'glutInitDisplayString');
+  glutInitWindowPosition := GetProc(libglut, 'glutInitWindowPosition');
+  glutInitWindowSize := GetProc(libglut, 'glutInitWindowSize');
+  glutMainLoop := GetProc(libglut, 'glutMainLoop');
+  glutCreateWindow := GetProc(libglut, 'glutCreateWindow');
+  glutCreateSubWindow := GetProc(libglut, 'glutCreateSubWindow');
+  glutDestroyWindow := GetProc(libglut, 'glutDestroyWindow');
+  glutPostRedisplay := GetProc(libglut, 'glutPostRedisplay');
+  glutPostWindowRedisplay := GetProc(libglut, 'glutPostWindowRedisplay');
+  glutSwapBuffers := GetProc(libglut, 'glutSwapBuffers');
+  glutGetWindow := GetProc(libglut, 'glutGetWindow');
+  glutSetWindow := GetProc(libglut, 'glutSetWindow');
+  glutSetWindowTitle := GetProc(libglut, 'glutSetWindowTitle');
+  glutSetIconTitle := GetProc(libglut, 'glutSetIconTitle');
+  glutPositionWindow := GetProc(libglut, 'glutPositionWindow');
+  glutReshapeWindow := GetProc(libglut, 'glutReshapeWindow');
+  glutPopWindow := GetProc(libglut, 'glutPopWindow');
+  glutPushWindow := GetProc(libglut, 'glutPushWindow');
+  glutIconifyWindow := GetProc(libglut, 'glutIconifyWindow');
+  glutShowWindow := GetProc(libglut, 'glutShowWindow');
+  glutHideWindow := GetProc(libglut, 'glutHideWindow');
+  glutFullScreen := GetProc(libglut, 'glutFullScreen');
+  glutSetCursor := GetProc(libglut, 'glutSetCursor');
+  glutWarpPointer := GetProc(libglut, 'glutWarpPointer');
+  glutDisplayFunc := GetProc(libglut, 'glutDisplayFunc');
+  glutReshapeFunc := GetProc(libglut, 'glutReshapeFunc');
+  glutTimerFunc := GetProc(libglut, 'glutTimerFunc');
+  glutSetColor := GetProc(libglut, 'glutSetColor');
+  glutGetColor := GetProc(libglut, 'glutGetColor');
+  glutCopyColormap := GetProc(libglut, 'glutCopyColormap');
+  glutGet := GetProc(libglut, 'glutGet');
+  glutDeviceGet := GetProc(libglut, 'glutDeviceGet');
+  glutExtensionSupported := GetProc(libglut, 'glutExtensionSupported');
+  glutGetModifiers := GetProc(libglut, 'glutGetModifiers');
+  glutLayerGet := GetProc(libglut, 'glutLayerGet');
+  glutGameModeString := GetProc(libglut, 'glutGameModeString');
+  glutEnterGameMode := GetProc(libglut, 'glutEnterGameMode');
+  glutLeaveGameMode := GetProc(libglut, 'glutLeaveGameMode');
+  glutGameModeGet := GetProc(libglut, 'glutGameModeGet');
+
+  GLUTInitialized := True;
+  Result := True;
+end;
+
+
+function InitGLUT: Boolean;
+begin
+  Result := InitGLUTFromLibrary('libglut.so');
+end;
+
+
+
+finalization
+  if Assigned(libGLUT) then FreeLibrary(libGLUT);
+end.
+
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+}

+ 129 - 0
packages/opengl/linuxd/xlib.pp

@@ -0,0 +1,129 @@
+{
+  $Id$
+}
+
+{$MODE objfpc}
+{$LINKLIB X11}
+{$PACKRECORDS 4}
+
+unit xlib;
+
+interface
+
+type
+
+  XID = LongWord;
+  TVisualID = LongWord;
+  PDisplay = Pointer;
+  PVisual = Pointer;
+
+  PXVisualInfo = ^TXVisualInfo;
+  TXVisualInfo = record
+    visual: PVisual;
+    visualid: TVisualID;
+    screen, depth, c_class: LongInt;
+    red_mask, green_mask, blue_mask: LongWord;
+    colormap_size, bits_per_rgb: LongInt;
+  end;
+
+const
+  VisualNoMask			= 0;
+  VisualIDMask 			= 1;
+  VisualScreenMask		= 2;
+  VisualDepthMask		= 4;
+  VisualClassMask		= 8;
+  VisualRedMaskMask		= $10;
+  VisualGreenMaskMask		= $20;
+  VisualBlueMaskMask		= $40;
+  VisualColormapSizeMask	= $80;
+  VisualBitsPerRGBMask		= $100;
+  VisualAllMask			= $1FF;
+
+  
+
+  function DefaultScreen(dpy: PDisplay): LongInt;
+
+
+  function XFree(data: Pointer): LongInt; cdecl;
+  function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl;
+  function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl;
+
+
+implementation
+
+type
+  PXExtData = Pointer;
+  PXPrivate = Pointer;
+  XPointer = PChar;
+  PXrmHashBucketRec = Pointer;
+  PScreenFormat = Pointer;
+  PScreen = Pointer;
+
+  PXPrivDisplay = ^TXPrivDisplay;
+  TXPrivDisplay = record
+    ext_data: PXExtData;		// hook for extension to hang data
+    private1: PXPrivate;
+    fd: LongInt;			// Network socket.
+    private2: LongInt;
+    proto_major_version: LongInt;	// major version of server's X protocol
+    proto_minor_version: LongInt;	// minor version of server's X protocol
+    vendor: PChar;			// vendor of the server hardware
+    private3, private4, private5: XID;
+    private6: LongInt;
+    resource_alloc: Pointer;		// allocator function
+    byte_order: LongInt;		// screen byte order, LSBFirst, MSBFirst
+    bitmap_unit: LongInt;		// padding and data requirements
+    bitmap_pad: LongInt;		// padding requirements on bitmaps
+    bitmap_bit_order: LongInt;		// LeastSignificant or MostSignificant
+    nformats: LongInt;			// number of pixmap formats in list
+    pixmap_format: PScreenFormat;	// pixmap format list
+    private8: LongInt;
+    release: LongInt;			// release of the server
+    private9, private10: PXPrivate;
+    qlen: LongInt;			// Length of input event queue
+    last_request_read: LongWord;	// seq number of last event read
+    request: LongWord;			// sequence number of last request.
+    private11, private12, private13,
+      private14: XPointer;
+    max_request_size: LongWord;		// maximum number 32 bit words in request
+    db: PXrmHashBucketRec;
+    private15: Pointer;
+    display_name: PChar;		// "host:display" string used on this connect
+    default_screen: LongInt;		// default screen for operations
+    nscreens: LongInt;			// number of screens on this server
+    screens: PScreen;			// pointer to list of screens
+    motion_buffer: LongWord;		// size of motion buffer
+    private16: LongWord;
+    min_keycode: LongInt;		// minimum defined keycode
+    max_keycode: LongInt;		// maximum defined keycode
+    private17, private18: XPointer;
+    private19: LongInt;
+    xdefaults: PChar;			// contents of defaults from server
+    // there is more to this structure, but it is private to Xlib
+  end;
+
+
+
+function DefaultScreen(dpy: PDisplay): LongInt;
+begin
+  Result := PXPrivDisplay(dpy)^.default_screen;
+end;
+
+const
+  libX = 'X11';
+
+function XFree(data: Pointer): LongInt; cdecl; external libX;
+function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl; external libX;
+function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl; external libX;
+
+end.
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:22  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+  Revision 1.1  1999/11/10 14:15:33  sg
+  * Added to CVS
+
+}

+ 92 - 0
packages/opengl/makefile.fpc

@@ -0,0 +1,92 @@
+#
+#   Example Makefile.fpc which shows the defaults
+#
+
+[targets]
+; The units which should be compiled
+units=buildgl
+; The programs which should be compiled
+programs=c_linuxd
+
+
+[defaults]
+; the default build target should only compile the units ?
+defaultunits=0
+; What is the default rule to call
+defaultrule=all
+; force target OS
+defaulttarget=
+; force target CPU
+defaultcpu=
+; options needed to compile (like -S2 or -Sg)
+defaultoptions=
+
+
+[dirs]
+; what is the default location of FPC
+fpcdir=
+; which dirs need to be searched for units
+unitdir=
+; which dirs need to be searched for libs
+libdir=
+; which dirs need to be searched for object files
+objdir=
+; which dirs need to be searched for include files
+incdir=
+; where to place the created units/files
+targetdir=
+; where to place the created units
+unittargetdir=
+
+
+[libs]
+; linking with libgcc.a needed ?
+libgcc=0
+; linking with other libraries needed (not in the /lib;/usr/lib;/usr/X11R6/lib)
+libother=0
+
+
+[tools]
+; sed needed?
+toolsed=0
+; cmp needed?
+toolcmp=0
+; diff needed?
+tooldiff=0
+; try to use upx for compression ?
+toolupx=1
+; date needed?
+tooldate=1
+; zip needed?
+toolzip=1
+
+
+[info]
+; show configuration info
+infocfg=1
+; show directory info
+infodir=0
+; show which tools are found
+infotools=0
+; show install dirs
+infoinstall=1
+; show build objects
+infoobjects=1
+; show files found in current dir
+infofiles=0
+
+
+[presettings]
+; Add here the makefile commands which need to be done at the beginning
+; of the user settings section
+
+
+[postsettings]
+; Add here the makefile commands which need to be done at the end
+; of the user settings section
+
+
+[rules]
+; here you can add your own rules, the general rules will automaticly
+; remove the defaults which call fpc_<rule>.
+

+ 976 - 0
packages/opengl/old/Makefile

@@ -0,0 +1,976 @@
+#
+# Makefile generated by fpcmake v0.99.13 on 1999-11-25 23:46
+#
+
+defaultrule: all
+
+#####################################################################
+# 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 search separated by spaces
+ifdef inlinux
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+
+#####################################################################
+# FPC version/target Detection
+#####################################################################
+
+# What compiler to use ?
+ifndef FPC
+ifdef inOS2
+export FPC=ppos2$(EXEEXT)
+else
+export FPC=ppc386$(EXEEXT)
+endif
+endif
+
+# Target OS
+ifndef OS_TARGET
+export OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+
+# Source OS
+ifndef OS_SOURCE
+export OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+
+# Target CPU
+ifndef CPU_TARGET
+export CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+
+# Source CPU
+ifndef CPU_SOURCE
+export CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+
+# FPC version
+ifndef FPC_VERSION
+export FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+
+#####################################################################
+# Default Settings
+#####################################################################
+
+# Release ? Then force OPT and don't use extra opts via commandline
+ifndef REDIRFILE
+REDIRFILE=log
+endif
+
+ifdef RELEASE
+override OPT:=-Xs -OG2p3 -n
+endif
+
+# Verbose settings (warning,note,info)
+ifdef VERBOSE
+override OPT+=-vwni
+endif
+
+ifdef REDIR
+ifndef inlinux
+override FPC=redir -eo $(FPC)
+endif
+# set the verbosity to max
+override OPT+=-va
+override REDIR:= >> $(REDIRFILE)
+endif
+
+#####################################################################
+# User Settings
+#####################################################################
+
+
+# Targets
+
+override UNITOBJECTS+=xlib gl glut
+override EXAMPLEOBJECTS+=glutdemo
+
+# Clean
+
+
+# Install
+
+ZIPTARGET=install
+
+# Defaults
+
+override NEEDOPT=-Sm
+
+# Directories
+
+ifndef FPCDIR
+FPCDIR=../..
+endif
+ifndef PACKAGEDIR
+PACKAGEDIR=$(FPCDIR)/packages
+endif
+ifndef COMPONENTDIR
+COMPONENTDIR=$(FPCDIR)/components
+endif
+
+# Packages
+
+
+# Libraries
+
+
+# Info
+
+INFOTARGET=fpc_infocfg fpc_infoobjects fpc_infoinstall 
+
+#####################################################################
+# Default Directories
+#####################################################################
+
+# Base dir
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+
+# this can be set to 'rtl' when the RTL units are installed
+ifndef UNITPREFIX
+UNITPREFIX=units
+endif
+
+# set the prefix directory where to install everything
+ifndef PREFIXINSTALLDIR
+ifdef inlinux
+export PREFIXINSTALLDIR=/usr
+else
+export PREFIXINSTALLDIR=/pp
+endif
+endif
+
+# create fcldir,rtldir,unitdir
+ifdef FPCDIR
+ifneq ($(FPCDIR),.)
+override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
+override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
+override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
+endif
+endif
+
+#####################################################################
+# 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)/$(UNITPREFIX)/$(OS_TARGET)
+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
+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 EXTRAINSTALLDIR
+EXTRAINSTALLDIR=$(BASEINSTALLDIR)
+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 NEEDOPT
+override FPCOPT+=$(NEEDOPT)
+endif
+
+ifdef RTLDIR
+override FPCOPT+=-Fu$(RTLDIR)
+endif
+
+ifdef UNITSDIR
+override FPCOPT+=-Fu$(UNITSDIR)
+endif
+
+# Smartlinking
+ifdef SMARTLINK
+override FPCOPT+=-CX
+endif
+
+# Debug
+ifdef DEBUG
+override FPCOPT+=-g
+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
+
+override COMPILER=$(FPC) $(FPCOPT)
+
+#####################################################################
+# Shell tools
+#####################################################################
+
+# To copy pograms
+ifndef COPY
+export COPY:=cp -fp
+endif
+
+# Copy a whole tree
+ifndef COPYTREE
+export COPYTREE:=cp -rfp
+endif
+
+# To move pograms
+ifndef MOVE
+export MOVE:=mv -f
+endif
+
+# Check delete program
+ifndef DEL
+export DEL:=rm -f
+endif
+
+# Check deltree program
+ifndef DELTREE
+export DELTREE:=rm -rf
+endif
+
+# To install files
+ifndef INSTALL
+ifdef inlinux
+export INSTALL:=install -m 644
+else
+export INSTALL:=$(COPY)
+endif
+endif
+
+# To install programs
+ifndef INSTALLEXE
+ifdef inlinux
+export INSTALLEXE:=install -m 755
+else
+export INSTALLEXE:=$(COPY)
+endif
+endif
+
+# To make a directory.
+ifndef MKDIR
+ifdef inlinux
+export MKDIR:=install -m 755 -d
+else
+export MKDIR:=ginstall -m 755 -d
+endif
+endif
+
+#####################################################################
+# Default Tools
+#####################################################################
+
+# file used to check if a package is compiled
+ifndef FPCMAKED
+FPCMAKED=fpcmaked
+endif
+
+# 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
+
+# also call ppas if with command option -s
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+EXECPPAS=@$(PPAS)
+endif
+
+# ldconfig to rebuild .so cache
+ifdef inlinux
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+
+# echo
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+export ECHO:=echo
+else
+export ECHO:=$(firstword $(ECHO))
+endif
+endif
+
+# ppdep
+ifndef PPDEP
+PPDEP:=$(strip $(wildcard $(addsuffix /ppdep$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPDEP),)
+PPDEP=
+else
+export PPDEP:=$(firstword $(PPDEP))
+endif
+endif
+
+# ppumove
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+export PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+
+# ppufiles
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+export PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+
+# 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
+export UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+
+# gdate/date
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(EXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+export DATE:=$(firstword $(DATE))
+endif
+else
+export DATE:=$(firstword $(DATE))
+endif
+endif
+
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+
+# ZipProg, you can't use Zip as the var name (PFV)
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(EXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+export ZIPPROG:=$(firstword $(ZIPPROG)) -D9 -r
+endif
+endif
+
+ifndef ZIPEXT
+ZIPEXT=.zip
+endif
+
+#####################################################################
+# Default extensions
+#####################################################################
+
+# Default needed extensions (Go32v2,Linux)
+LOADEREXT=.as
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+PACKAGESUFFIX=
+
+# Go32v1
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+PACKAGESUFFIX=v1
+endif
+
+# Go32v2
+ifeq ($(OS_TARGET),go32v2)
+PACKAGESUFFIX=go32
+endif
+
+# Linux
+ifeq ($(OS_TARGET),linux)
+PACKAGESUFFIX=linux
+endif
+
+# Win32
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=win32
+endif
+
+# OS/2
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+PACKAGESUFFIX=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
+
+#####################################################################
+# Standard rules
+#####################################################################
+
+all: fpc_all
+
+debug: fpc_debug
+
+examples: fpc_examples
+
+test: fpc_test
+
+smart: fpc_smart
+
+shared: fpc_shared
+
+showinstall: fpc_showinstall
+
+install: fpc_install
+
+sourceinstall: fpc_sourceinstall
+
+zipinstall: fpc_zipinstall
+
+zipinstalladd: fpc_zipinstalladd
+
+clean: fpc_clean
+
+cleanall: fpc_cleanall
+
+info: fpc_info
+
+.PHONY:  all debug examples test smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall info
+
+#####################################################################
+# Package depends
+#####################################################################
+
+ifneq ($(wildcard $(RTLDIR)),)
+ifeq ($(wildcard $(RTLDIR)/$(FPCMAKED)),)
+override COMPILEPACKAGES+=rtl
+rtl_package:
+	$(MAKE) -C $(RTLDIR) all
+endif
+endif
+
+.PHONY:  rtl_package
+
+#####################################################################
+# Units
+#####################################################################
+
+.PHONY: fpc_units
+
+override ALLTARGET+=fpc_units
+
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(UNITOBJECTS))
+override INSTALLPPUFILES+=$(UNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES)
+
+fpc_units: $(UNITPPUFILES)
+
+#####################################################################
+# Examples
+#####################################################################
+
+.PHONY: fpc_examples fpc_test
+
+override EXAMPLEFILES=$(addsuffix $(EXEEXT),$(EXAMPLEOBJECTS))
+override EXAMPLEOFILES=$(addsuffix $(OEXT),$(EXAMPLEOBJECTS))
+
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+
+fpc_examples: all $(EXAMPLEFILES)
+
+fpc_test: examples
+
+#####################################################################
+# General compile rules
+#####################################################################
+
+.PHONY: fpc_all fpc_debug
+
+$(FPCMAKED):
+	@$(ECHO) Compiled > $(FPCMAKED)
+
+fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
+	 $(addsuffix _component,$(COMPILECOMPONENTS)) \
+	 $(ALLTARGET) $(FPCMAKED)
+
+fpc_debug:
+	$(MAKE) all DEBUG=1
+
+# General compile rules, available for both possible PASEXT
+
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+
+%$(PPUEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(PPUEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pp
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+%$(EXEEXT): %.pas
+	$(COMPILER) $< $(REDIR)
+	$(EXECPASS)
+
+#####################################################################
+# Library
+#####################################################################
+
+.PHONY: fpc_smart fpc_shared
+
+# Default sharedlib units are all unit objects
+ifndef SHAREDLIBUNITOBJECTS
+SHAREDLIBUNITOBJECTS=$(UNITOBJECTS)
+endif
+
+fpc_smart:
+	$(MAKE) all SMARTLINK=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=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES))
+endif
+endif
+
+fpc_showinstall: $(SHOWINSTALLTARGET)
+ifdef INSTALLEXEFILES
+	@$(ECHO) $(addprefix "\n"$(BININSTALLDIR)/,$(INSTALLEXEFILES))
+endif
+ifdef INSTALLPPUFILES
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPUFILES))
+ifneq ($(INSTALLPPULINKFILES),)
+	@$(ECHO) $(addprefix "\n"$(UNITINSTALLDIR)/,$(INSTALLPPULINKFILES))
+endif
+ifneq ($(INSTALLPPULIBFILES),)
+	@$(ECHO) $(addprefix "\n"$(LIBINSTALLDIR)/,$(INSTALLPPULIBFILES))
+endif
+endif
+ifdef EXTRAINSTALLFILES
+	@$(ECHO) $(addprefix "\n"$(EXTRAINSTALLDIR)/,$(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) $(EXTRAINSTALLDIR)
+	$(INSTALL) $(EXTRAINSTALLFILES) $(EXTRAINSTALLDIR)
+endif
+
+#####################################################################
+# Source install rules
+#####################################################################
+
+.PHONY: fpc_sourceinstall
+
+fpc_sourceinstall: clean
+	$(MKDIR) $(SOURCEINSTALLDIR)
+	$(COPYTREE) $(BASEDIR) $(SOURCEINSTALLDIR)
+
+#####################################################################
+# Zip
+#####################################################################
+
+.PHONY: fpc_zipinstall fpc_zipinstalladd
+
+# Temporary path to pack a file
+ifndef PACKDIR
+ifndef inlinux
+PACKDIR=pack_tmp
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+
+# Test dir if none specified
+ifndef DESTZIPDIR
+DESTZIPDIR=$(BASEDIR)
+endif
+
+# Add .zip/.tar.gz extension
+ifdef ZIPNAME
+ifndef inlinux
+override ZIPNAME:=$(ZIPNAME)$(ZIPEXT)
+endif
+endif
+
+# Note: This will not remove the zipfile first
+fpc_zipinstalladd:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	gzip -d $(DESTZIPDIR)/$(ZIPNAME).tar.gz
+	cd $(PACKDIR) ; tar rv --file $(DESTZIPDIR)/$(ZIPNAME).tar * ; cd $(BASEDIR)
+	gzip $(DESTZIPDIR)/$(ZIPNAME).tar
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+# First remove the zip and then install
+fpc_zipinstall:
+ifndef ZIPNAME
+	@$(ECHO) Please specify ZIPNAME!
+	@exit
+else
+	$(DEL) $(DESTZIPDIR)/$(ZIPNAME)
+	$(MAKE) $(ZIPTARGET) PREFIXINSTALLDIR=$(PACKDIR)
+ifdef inlinux
+	cd $(PACKDIR) ; tar cvz --file $(DESTZIPDIR)/$(ZIPNAME).tar.gz * ; cd $(BASEDIR)
+else
+	cd $(PACKDIR) ; $(ZIPPROG) $(DESTZIPDIR)/$(ZIPNAME) * ; cd $(BASEDIR)
+endif
+	$(DELTREE) $(PACKDIR)
+endif
+
+#####################################################################
+# Clean rules
+#####################################################################
+
+.PHONY: fpc_clean fpc_cleanall
+
+ifdef EXTRACLEANUNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(EXTRACLEANUNITS))
+endif
+
+ifdef CLEANPPUFILES
+ifdef PPUFILES
+CLEANPPULINKFILES=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES=$(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 EXTRACLEANFILES
+	-$(DEL) $(EXTRACLEANFILES)
+endif
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(REDIRFILE)
+
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMAKED) $(PPAS) link.res $(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
+	@$(ECHO)  PackageSuffix........ $(PACKAGESUFFIX)
+	@$(ECHO)
+	@$(ECHO)  BaseInstallDir....... $(BASEINSTALLDIR)
+	@$(ECHO)  BinInstallDir........ $(BININSTALLDIR)
+	@$(ECHO)  LibInstallDir........ $(LIBINSTALLDIR)
+	@$(ECHO)  UnitInstallDir....... $(UNITINSTALLDIR)
+	@$(ECHO)  SourceInstallDir..... $(SOURCEINSTALLDIR)
+	@$(ECHO)  DocInstallDir........ $(DOCINSTALLDIR)
+	@$(ECHO)  ExtraInstallDir...... $(EXTRAINSTALLDIR)
+	@$(ECHO)
+

+ 13 - 0
packages/opengl/old/Makefile.fpc

@@ -0,0 +1,13 @@
+#
+#   Makefile.fpc for GL Units
+#
+
+[targets]
+units=xlib gl glut
+examples=glutdemo
+
+[dirs]
+fpcdir=../..
+
+[defaults]
+defaultoptions=-Sm

+ 64 - 0
packages/opengl/old/README

@@ -0,0 +1,64 @@
+GL (OpenGl, MesaGl...) units for Free Pascal
+============================================
+(c) 1999 Sebastian Guenther, [email protected]
+
+
+This package contains all units required for writing applications for OpenGl
+or OpenGl like libraries. In fact, this units have been derived from the
+header files of Brian Paul's MesaGl library.
+In Delphi, many people use Erik Ungerer's OpenGl header conversion, which is
+more powerful than the provided opengl32 unit by Borland/Inprise. My units
+work quite the same way (regarding the handling of pointer arguments and
+dynamic loading of the libraries), so it should be simple to use source
+written for Delphi in Free Pascal.
+
+All units come under the LGPL license, like the original MesaGl headers.
+
+Currently, no further documentation is available. A simple demo application
+which uses the GLUT library is being provided.
+
+
+What comes with this package; current state
+-------------------------------------------
+
+(all parts)
+  - only tested under Linux with MesaGl 3.1. Even if the units would compile
+    under Win32, There _will_ be problems because the units won't use the
+    right dynamic loading functions.
+
+GL support
+  * Supports all known OpenGl commands
+  * Dynamic loading of function pointers ensures that the unit supports
+    all OpenGl versions.
+  - GL extensions are not loaded automatically
+
+GLU support
+
+GLX support (Linux only)
+  - not tested with xlib unit from xforms package (see below)
+
+GLUT support (unit "glut.pp")
+  - not all functions are supported
+
+XLib
+  This unit contains some important declarations from xlib.h & friends, they
+  are required under Linux for GLX support. There is a more complete XLib unit
+  available as part of the xforms package (see Free Pascal homepage ->
+  contributed units page)
+
+demos/glutdemo
+  A simple demo which uses the GLUT library for window creation etc.
+
+
+Enjoy!
+
+Sebastian Guenther
+
+
+Version History:
+================
+
+0.1	?		First release as part of (non-public) KCL snapshot
+0.2	1999/10/06	First public release:
+			+ Added GLUT support
+			+ Fixed some bugs regarding library loading

+ 2219 - 0
packages/opengl/old/gl.pp

@@ -0,0 +1,2219 @@
+{
+  $Id$
+
+  Translation of the Mesa GL, GLU and GLX 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
+
+{$IFDEF Linux}
+  {$DEFINE gldecl := cdecl}
+  {$DEFINE HasGLX}  // Activate GLX stuff
+  uses XLib;
+{$ELSE}
+  {$IFDEF Win32}
+    {$DEFINE gldecl := stdcall}
+    uses Windows;
+  {$ENDIF}
+{$ENDIF}
+
+
+// =======================================================
+//   Unit specific extensions
+// =======================================================
+
+function InitGLFromLibrary(libname: PChar): Boolean;
+function InitGLUFromLibrary(libname: PChar): Boolean;
+
+{$IFDEF HasGLX}
+// Requires that the GL library has already been initialized
+function InitGLX: Boolean;
+{$ENDIF}
+
+// determines automatically which libraries to use:
+function InitGL: Boolean;
+function InitGLU: Boolean;
+
+
+var
+  GLInitialized, GLUInitialized: Boolean;
+  {$IFDEF HasGLX} GLXInitialized: Boolean; {$ENDIF}
+
+
+// =======================================================
+//   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
+// -------------------------------------------------------
+
+var
+  // Miscellaneous
+  glClearIndex: procedure(c: Single); gldecl;
+  glClearColor: procedure(red, green, blue, alpha: GLclampf); gldecl;
+  glClear: procedure(mask: GLbitfield); gldecl;
+  glIndexMask: procedure(mask: LongWord); gldecl;
+  glColorMask: procedure(red, green, blue, alpha: Boolean); gldecl;
+  glAlphaFunc: procedure(func: GLenum; ref: GLclampf); gldecl;
+  glBlendFunc: procedure(sfactor, dfactor: GLenum); gldecl;
+  glLogicOp: procedure(opcode: GLenum); gldecl;
+  glCullFace: procedure(mode: GLenum); gldecl;
+  glFrontFace: procedure(mode: GLenum); gldecl;
+  glPointSize: procedure(size: Single); gldecl;
+  glLineWidth: procedure(width: Single); gldecl;
+  glLineStipple: procedure(factor: LongInt; pattern: Word); gldecl;
+  glPolygonMode: procedure(face, mode: GLenum); gldecl;
+  glPolygonOffset: procedure(factor, units: Single); gldecl;
+  glPolygonStipple: procedure(var mask: Byte); gldecl;
+  glGetPolygonStipple: procedure(var mask: Byte); gldecl;
+  glEdgeFlag: procedure(flag: Boolean); gldecl;
+  glEdgeFlagv: procedure(var flag: Boolean); gldecl;
+  glScissor: procedure(x, y, width, height: LongInt); gldecl;
+  glClipPlane: procedure(plane: GLenum; var equation: Double); gldecl;
+  glGetClipPlane: procedure(plane: GLenum; var equation: Double); gldecl;
+  glDrawBuffer: procedure(mode: GLenum); gldecl;
+  glReadBuffer: procedure(mode: GLenum); gldecl;
+  glEnable: procedure(cap: LongInt); gldecl;
+  glDisable: procedure(cap: LongInt); gldecl;
+  glIsEnabled: function(cap: GLenum): Boolean; gldecl;
+  glEnableClientState: procedure(cap: GLenum); gldecl;  // 1.1
+  glDisableClientState: procedure(cap: GLenum); gldecl;  // 1.1
+  glGetBooleanv: procedure(pname: GLenum; var params: Boolean); gldecl;
+  glGetDoublev: procedure(pname: GLenum; var params: Double); gldecl;
+  glGetFloatv: procedure(pname: GLenum; var params: Single); gldecl;
+  glGetIntegerv: procedure(pname: GLenum; var params: LongInt); gldecl;
+  glPushAttrib: procedure(mask: GLbitfield); gldecl;
+  glPopAttrib: procedure; gldecl;
+  glPushClientAttrib: procedure(mask: GLbitfield); gldecl;  // 1.1
+  glPopClientAttrib: procedure; gldecl;  // 1.1
+  glRenderMode: function(mode: GLenum): LongInt; gldecl;
+  glGetError: function: GLenum; gldecl;
+  glGetString: function(name: GLenum): PChar; gldecl;
+  glFinish: procedure; gldecl;
+  glFlush: procedure; gldecl;
+  glHint: procedure(target, mode: GLenum); gldecl;
+
+
+  // Depth Buffer
+  glClearDepth: procedure(depth: GLclampd); gldecl;
+  glDepthFunc: procedure(func: LongInt); gldecl;
+  glDepthMask: procedure(flag: Boolean); gldecl;
+  glDepthRange: procedure(near_val, far_val: GLclampd); gldecl;
+
+  // Accumulation Buffer
+  glClearAccum: procedure(red, green, blue, alpha: Single); gldecl;
+  glAccum: procedure(op: GLenum; value: Single); gldecl;
+
+  // Tranformation
+  glMatrixMode: procedure(mode: GLenum); gldecl;
+  glOrtho: procedure(left, right, bottom, top, near_val, far_val: Double); gldecl;
+  glFrustum: procedure(left, right, bottom, top, near_val, far_val: Double); gldecl;
+  glViewport: procedure(x, y, width, height: LongInt); gldecl;
+  glPushMatrix: procedure; gldecl;
+  glPopMatrix: procedure; gldecl;
+  glLoadIdentity: procedure; gldecl;
+  glLoadMatrixd: procedure(var m: Double); gldecl;
+  glLoadMatrixf: procedure(var m: PSingle); gldecl;
+  glMultMatrixd: procedure(var m: Double); gldecl;
+  glMultMatrixf: procedure(var m: Single); gldecl;
+  glRotated: procedure(angle, x, y, z: Double); gldecl;
+  glRotatef: procedure(angle, x, y, z: Single); gldecl;
+  glScaled: procedure(x, y, z: Double); gldecl;
+  glScalef: procedure(x, y, z: Single); gldecl;
+  glTranslated: procedure(x, y, z: Double); gldecl;
+  glTranslatef: procedure(x, y, z: Single); gldecl;
+
+  // Display Lists
+  glIsList: function(list: LongWord): Boolean; gldecl;
+  glDeleteLists: procedure(list: LongWord; range: LongInt); gldecl;
+  glGenLists: function(range: LongInt): LongWord; gldecl;
+  glNewList: procedure(list: LongWord; mode: GLenum); gldecl;
+  glEndList: procedure; gldecl;
+  glCallList: procedure(list: LongWord); gldecl;
+  glCallLists: procedure(n: LongInt; AType: GLenum; var lists); gldecl;
+  glListBase: procedure(base: LongWord); gldecl;
+
+  // Drawing Functions
+  glBegin: procedure(mode: GLenum); gldecl;
+  glEnd: procedure; gldecl;
+  glVertex2d: procedure(x, y: Double); gldecl;
+  glVertex2f: procedure(x, y: Single); gldecl;
+  glVertex2i: procedure(x, y: LongInt); gldecl;
+  glVertex2s: procedure(x, y: SmallInt); gldecl;
+  glVertex3d: procedure(x, y, z: Double); gldecl;
+  glVertex3f: procedure(x, y, z: Single); gldecl;
+  glVertex3i: procedure(x, y, z: LongInt); gldecl;
+  glVertex3s: procedure(x, y, z: SmallInt); gldecl;
+  glVertex4d: procedure(x, y, z, w: Double); gldecl;
+  glVertex4f: procedure(x, y, z, w: Single); gldecl;
+  glVertex4i: procedure(x, y, z, w: LongInt); gldecl;
+  glVertex4s: procedure(x, y, z, w: SmallInt); gldecl;
+  glVertex2dv: procedure(var v: Double); gldecl;
+  glVertex2fv: procedure(var v: Single); gldecl;
+  glVertex2iv: procedure(var v: LongInt); gldecl;
+  glVertex2sv: procedure(var v: SmallInt); gldecl;
+  glVertex3dv: procedure(var v: Double); gldecl;
+  glVertex3fv: procedure(var v: Single); gldecl;
+  glVertex3iv: procedure(var v: LongInt); gldecl;
+  glVertex3sv: procedure(var v: SmallInt); gldecl;
+  glVertex4dv: procedure(var v: Double); gldecl;
+  glVertex4fv: procedure(var v: Single); gldecl;
+  glVertex4iv: procedure(var v: LongInt); gldecl;
+  glVertex4sv: procedure(var v: SmallInt); gldecl;
+  glNormal3b: procedure(nx, ny, nz: Byte); gldecl;
+  glNormal3d: procedure(nx, ny, nz: Double); gldecl;
+  glNormal3f: procedure(nx, ny, nz: Single); gldecl;
+  glNormal3i: procedure(nx, ny, nz: LongInt); gldecl;
+  glNormal3s: procedure(nx, ny, nz: SmallInt); gldecl;
+  glNormal3bv: procedure(var v: ShortInt); gldecl;
+  glNormal3dv: procedure(var v: Double); gldecl;
+  glNormal3fv: procedure(var v: Single); gldecl;
+  glNormal3iv: procedure(var v: LongInt); gldecl;
+  glNormal3sv: procedure(var v: SmallInt); gldecl;
+  glIndexd: procedure(c: Double); gldecl;
+  glIndexf: procedure(c: Single); gldecl;
+  glIndexi: procedure(c: LongInt); gldecl;
+  glIndexs: procedure(c: SmallInt); gldecl;
+  glIndexub: procedure(c: Byte); gldecl;  // 1.1
+  glIndexdv: procedure(var c: Double); gldecl;
+  glIndexfv: procedure(var c: Single); gldecl;
+  glIndexiv: procedure(var c: LongInt); gldecl;
+  glIndexsv: procedure(var c: SmallInt); gldecl;
+  glIndexubv: procedure(var c: Byte); gldecl;  // 1.1
+  glColor3b : procedure(red, green, blue: ShortInt); gldecl;
+  glColor3d : procedure(red, green, blue: Double); gldecl;
+  glColor3f : procedure(red, green, blue: Single); gldecl;
+  glColor3i : procedure(red, green, blue: LongInt); gldecl;
+  glColor3s : procedure(red, green, blue: SmallInt); gldecl;
+  glColor3ub: procedure(red, green, blue: Byte); gldecl;
+  glColor3ui: procedure(red, green, blue: LongWord); gldecl;
+  glColor3us: procedure(red, green, blue: Word); gldecl;
+  glColor4b : procedure(red, green, blue, alpha: ShortInt); gldecl;
+  glColor4d : procedure(red, green, blue, alpha: Double); gldecl;
+  glColor4f : procedure(red, green, blue, alpha: Single); gldecl;
+  glColor4i : procedure(red, green, blue, alpha: LongInt); gldecl;
+  glColor4s : procedure(red, green, blue, alpha: SmallInt); gldecl;
+  glColor4ub: procedure(red, green, blue, alpha: Byte); gldecl;
+  glColor4ui: procedure(red, green, blue, alpha: LongWord); gldecl;
+  glColor4us: procedure(red, green, blue, alpha: Word); gldecl;
+  glColor3bv : procedure(var v: ShortInt); gldecl;
+  glColor3dv : procedure(var v: Double); gldecl;
+  glColor3fv : procedure(var v: Single); gldecl;
+  glColor3iv : procedure(var v: LongInt); gldecl;
+  glColor3sv : procedure(var v: SmallInt); gldecl;
+  glColor3ubv: procedure(var v: Byte); gldecl;
+  glColor3uiv: procedure(var v: LongWord); gldecl;
+  glColor3usv: procedure(var v: Word); gldecl;
+  glColor4bv : procedure(var v: ShortInt); gldecl;
+  glColor4dv : procedure(var v: Double); gldecl;
+  glColor4fv : procedure(var v: Single); gldecl;
+  glColor4iv : procedure(var v: LongInt); gldecl;
+  glColor4sv : procedure(var v: SmallInt); gldecl;
+  glColor4ubv: procedure(var v: Byte); gldecl;
+  glColor4uiv: procedure(var v: LongWord); gldecl;
+  glColor4usv: procedure(var v: Word); gldecl;
+  glTexCoord1d: procedure(s: Double); gldecl;
+  glTexCoord1f: procedure(s: Single); gldecl;
+  glTexCoord1i: procedure(s: LongInt); gldecl;
+  glTexCoord1s: procedure(s: SmallInt); gldecl;
+  glTexCoord2d: procedure(s, t: Double); gldecl;
+  glTexCoord2f: procedure(s, t: Single); gldecl;
+  glTexCoord2i: procedure(s, t: LongInt); gldecl;
+  glTexCoord2s: procedure(s, t: SmallInt); gldecl;
+  glTexCoord3d: procedure(s, t, r: Double); gldecl;
+  glTexCoord3f: procedure(s, t, r: Single); gldecl;
+  glTexCoord3i: procedure(s, t, r: LongInt); gldecl;
+  glTexCoord3s: procedure(s, t, r: SmallInt); gldecl;
+  glTexCoord4d: procedure(s, t, r, q: Double); gldecl;
+  glTexCoord4f: procedure(s, t, r, q: Single); gldecl;
+  glTexCoord4i: procedure(s, t, r, q: LongInt); gldecl;
+  glTexCoord4s: procedure(s, t, r, q: SmallInt); gldecl;
+  glTexCoord1dv: procedure(var v: Double); gldecl;
+  glTexCoord1fv: procedure(var v: Single); gldecl;
+  glTexCoord1iv: procedure(var v: LongInt); gldecl;
+  glTexCoord1sv: procedure(var v: SmallInt); gldecl;
+  glTexCoord2dv: procedure(var v: Double); gldecl;
+  glTexCoord2fv: procedure(var v: Single); gldecl;
+  glTexCoord2iv: procedure(var v: LongInt); gldecl;
+  glTexCoord2sv: procedure(var v: SmallInt); gldecl;
+  glTexCoord3dv: procedure(var v: Double); gldecl;
+  glTexCoord3fv: procedure(var v: Single); gldecl;
+  glTexCoord3iv: procedure(var v: LongInt); gldecl;
+  glTexCoord3sv: procedure(var v: SmallInt); gldecl;
+  glTexCoord4dv: procedure(var v: Double); gldecl;
+  glTexCoord4fv: procedure(var v: Single); gldecl;
+  glTexCoord4iv: procedure(var v: LongInt); gldecl;
+  glTexCoord4sv: procedure(var v: SmallInt); gldecl;
+  glRasterPos2d: procedure(x, y: Double); gldecl;
+  glRasterPos2f: procedure(x, y: Single); gldecl;
+  glRasterPos2i: procedure(x, y: LongInt); gldecl;
+  glRasterPos2s: procedure(x, y: SmallInt); gldecl;
+  glRasterPos3d: procedure(x, y, z: Double); gldecl;
+  glRasterPos3f: procedure(x, y, z: Single); gldecl;
+  glRasterPos3i: procedure(x, y, z: LongInt); gldecl;
+  glRasterPos3s: procedure(x, y, z: SmallInt); gldecl;
+  glRasterPos4d: procedure(x, y, z, w: Double); gldecl;
+  glRasterPos4f: procedure(x, y, z, w: Single); gldecl;
+  glRasterPos4i: procedure(x, y, z, w: LongInt); gldecl;
+  glRasterPos4s: procedure(x, y, z, w: SmallInt); gldecl;
+  glRasterPos2dv: procedure(var v: Double); gldecl;
+  glRasterPos2fv: procedure(var v: Single); gldecl;
+  glRasterPos2iv: procedure(var v: LongInt); gldecl;
+  glRasterPos2sv: procedure(var v: SmallInt); gldecl;
+  glRasterPos3dv: procedure(var v: Double); gldecl;
+  glRasterPos3fv: procedure(var v: Single); gldecl;
+  glRasterPos3iv: procedure(var v: LongInt); gldecl;
+  glRasterPos3sv: procedure(var v: SmallInt); gldecl;
+  glRasterPos4dv: procedure(var v: Double); gldecl;
+  glRasterPos4fv: procedure(var v: Single); gldecl;
+  glRasterPos4iv: procedure(var v: LongInt); gldecl;
+  glRasterPos4sv: procedure(var v: SmallInt); gldecl;
+  glRectd: procedure(x1, y1, x2, y2: Double); gldecl;
+  glRectf: procedure(x1, y1, x2, y2: Single); gldecl;
+  glRecti: procedure(x1, y1, x2, y2: LongInt); gldecl;
+  glRects: procedure(x1, y1, x2, y2: SmallInt); gldecl;
+  glRectdv: procedure(var v1, v2: Double); gldecl;
+  glRectfv: procedure(var v1, v2: Single); gldecl;
+  glRectiv: procedure(var v1, v2: LongInt); gldecl;
+  glRectsv: procedure(var v1, v2: SmallInt); gldecl;
+
+  // Vertex Arrays (1.1)
+  glVertexPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); gldecl;
+  glNormalPointer: procedure(AType: GLenum; stride: LongInt; var ptr); gldecl;
+  glColorPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); gldecl;
+  glIndexPointer: procedure(AType: GLenum; stride: LongInt; var ptr); gldecl;
+  glTexCoordPointer: procedure(size: LongInt; AType: GLenum; stride: LongInt; var ptr); gldecl;
+  glEdgeFlagPointer: procedure(stride: LongInt; var ptr); gldecl;
+  glGetPointerv: procedure(pname: GLenum; var params: Pointer); gldecl;
+  glArrayElement: procedure(i: LongInt); gldecl;
+  glDrawArrays: procedure(mode: GLenum; first, count: LongInt); gldecl;
+  glDrawElements: procedure(mode: GLenum; count: Integer; AType: GLenum; var indices); gldecl;
+  glInterleavedArrays: procedure(format: GLenum; stride: LongInt; var pointer); gldecl;
+
+  // Lighting
+  glShadeModel: procedure(mode: GLenum); gldecl;
+  glLightf: procedure(light, pname: GLenum; param: Single); gldecl;
+  glLighti: procedure(light, pname: GLenum; param: LongInt); gldecl;
+  glLightfv: procedure(light, pname: GLenum; var params: Single); gldecl;
+  glLightiv: procedure(light, pname: GLenum; var params: LongInt); gldecl;
+  glGetLightfv: procedure(light, pname: GLenum; var params: Single); gldecl;
+  glGetLightiv: procedure(light, pname: GLenum; var params: LongInt); gldecl;
+  glLightModelf: procedure(pname: GLenum; param: Single); gldecl;
+  glLightModeli: procedure(pname: GLenum; param: LongInt); gldecl;
+  glLightModelfv: procedure(pname: GLenum; var params: Single); gldecl;
+  glLightModeliv: procedure(pname: GLenum; var param: LongInt); gldecl;
+  glMaterialf: procedure(face, pname: GLenum; param: Single); gldecl;
+  glMateriali: procedure(face, pname: GLenum; param: LongInt); gldecl;
+  glMaterialfv: procedure(face, pname: GLenum; var params: Single); gldecl;
+  glMaterialiv: procedure(face, pname: GLenum; var params: LongInt); gldecl;
+  glGetMaterialfv: procedure(face, pname: GLenum; var params: Single); gldecl;
+  glGetMaterialiv: procedure(face, pname: GLenum; var params: LongInt); gldecl;
+  glColorMaterial: procedure(face, mode: GLenum); gldecl;
+
+  // Raster Functions
+  glPixelZoom: procedure(xfactor, yfactor: Single); gldecl;
+  glPixelStoref: procedure(pname: GLenum; param: Single); gldecl;
+  glPixelStorei: procedure(pname: GLenum; param: LongInt); gldecl;
+  glPixelTransferf: procedure(pname: GLenum; param: Single); gldecl;
+  glPixelTransferi: procedure(pname: GLenum; param: LongInt); gldecl;
+  glPixelMapfv: procedure(map: GLenum; mapsize: LongInt; var values: Single); gldecl;
+  glPixelMapuiv: procedure(map: GLenum; mapsize: LongInt; var values: LongWord); gldecl;
+  glPixelMapusv: procedure(map: GLenum; mapsize: LongInt; var values: Word); gldecl;
+  glGetPixelMapfv: procedure(map: GLenum; var values: Single); gldecl;
+  glGetPixelMapuiv: procedure(map: GLenum; var values: LongWord); gldecl;
+  glGetPixelMapusv: procedure(map: GLenum; var values: Word); gldecl;
+  glBitmap: procedure(width, height: LongInt; xorig, yorig, xmove, ymove: Single; var bitmap); gldecl;
+  glReadPixels: procedure(x, y, width, height: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glDrawPixels: procedure(width, height: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glCopyPixels: procedure(x, y, width, height: LongInt; AType: GLenum); gldecl;
+
+  // Stenciling
+  glStencilFunc: procedure(func: GLenum; ref: LongInt; mask: LongWord); gldecl;
+  glStencilMask: procedure(mask: LongWord); gldecl;
+  glStencilOp: procedure(fail, zfail, zpass: GLenum); gldecl;
+  glClearStencil: procedure(s: LongInt); gldecl;
+
+  // Texture Mapping
+  glTexGend: procedure(cord, pname: GLenum; param: Double); gldecl;
+  glTexGenf: procedure(cord, pname: GLenum; param: Single); gldecl;
+  glTexGeni: procedure(cord, pname: GLenum; param: LongInt); gldecl;
+  glTexGendv: procedure(cord, pname: GLenum; var params: Double); gldecl;
+  glTexGenfv: procedure(cord, pname: GLenum; var params: Single); gldecl;
+  glTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); gldecl;
+  glGetTexGendv: procedure(cord, pname: GLenum; var params: Double); gldecl;
+  glGetTexGenfv: procedure(cord, pname: GLenum; var params: Single); gldecl;
+  glGetTexGeniv: procedure(cord, pname: GLenum; var params: LongInt); gldecl;
+  glTexEnvf: procedure(target, pname: GLenum; param: Single); gldecl;
+  glTexEnvi: procedure(target, pname: GLenum; param: LongInt); gldecl;
+  glTexEnvfv: procedure(target, pname: GLenum; var params: Single); gldecl;
+  glTexEnviv: procedure(target, pname: GLenum; var params: LongInt); gldecl;
+  glGetTexEnvfv: procedure(target, pname: GLenum; var params: Single); gldecl;
+  glGetTexEnviv: procedure(target, pname: GLenum; var params: LongInt); gldecl;
+  glTexParameterf: procedure(target, pname: GLenum; param: Single); gldecl;
+  glTexParameteri: procedure(target, pname: GLenum; param: LongInt); gldecl;
+  glTexParameterfv: procedure(target, pname: GLenum; var params: Single); gldecl;
+  glTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); gldecl;
+  glGetTexParameterfv: procedure(target, pname: GLenum; var params: Single); gldecl;
+  glGetTexParameteriv: procedure(target, pname: GLenum; var params: LongInt); gldecl;
+  glGetTexLevelParameterfv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: Single); gldecl;
+  glGetTexLevelParameteriv: procedure(target: GLenum; level: LongInt; pname: GLenum; var params: LongInt); gldecl;
+  glTexImage1D: procedure(target: GLenum; level, internalFormat, width, border: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glTexImage2D: procedure(target: GLenum; level, internalFormat, width, height, border: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glGetTexImage: procedure(target: GLenum; level: LongInt; format, AType: GLenum; var pixels); gldecl;
+  // 1.1 functions:
+  glGenTextures: procedure(n: LongInt; var textures: LongWord); gldecl;
+  glDeleteTextures: procedure(n: LongInt; var textures: LongWord); gldecl;
+  glBindTexture: procedure(target: GLenum; texture: LongWord); gldecl;
+  glPrioritizeTextures: procedure(n: LongInt; var textures: LongWord; var priorities: GLclampf); gldecl;
+  glAreTexturesResident: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; gldecl;
+  glIsTexture: function(texture: LongWord): Boolean; gldecl;
+  glTexSubImage1D: procedure(target: GLenum; level, xoffset, width: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, width, height: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glCopyTexImage1D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, border: LongInt); gldecl;
+  glCopyTexImage2D: procedure(target: GLenum; level: LongInt; format: GLenum; x, y, width, height, border: LongInt); gldecl;
+  glCopyTexSubImage1D: procedure(target: GLenum; level, xoffset, x, y, width: LongInt); gldecl;
+  glCopyTexSubImage2D: procedure(target: GLenum; level, xoffset, yoffset, x, y, width, height: LongInt); gldecl;
+
+  // Evaluators
+  glMap1d: procedure(target: GLenum; u1, u2: Double; stride, order: LongInt; var points: Double); gldecl;
+  glMap1f: procedure(target: GLenum; u1, u2: Single; stride, order: LongInt; var points: Single); gldecl;
+  glMap2d: procedure(target: GLenum; u1, u2: Double; ustride, uorder: LongInt; v1, v2: Double; vstride, vorder: LongInt; var points: Double); gldecl;
+  glMap2f: procedure(target: GLenum; u1, u2: Single; ustride, uorder: LongInt; v1, v2: Single; vstride, vorder: LongInt; var points: Single); gldecl;
+  glGetMapdv: procedure(target, query: GLenum; var v: Double); gldecl;
+  glGetMapfv: procedure(target, query: GLenum; var v: Single); gldecl;
+  glGetMapiv: procedure(target, query: GLenum; var v: LongInt); gldecl;
+  glEvalCoord1d: procedure(u: Double); gldecl;
+  glEvalCoord1f: procedure(u: Single); gldecl;
+  glEvalCoord1dv: procedure(var u: Double); gldecl;
+  glEvalCoord1fv: procedure(var u: Single); gldecl;
+  glEvalCoord2d: procedure(u, v: Double); gldecl;
+  glEvalCoord2f: procedure(u, v: Single); gldecl;
+  glEvalCoord2dv: procedure(var u, v: Double); gldecl;
+  glEvalCoord2fv: procedure(var u, v: Single); gldecl;
+  glMapGrid1d: procedure(un: LongInt; u1, u2: Double); gldecl;
+  glMapGrid1f: procedure(un: LongInt; u1, u2: Single); gldecl;
+  glMapGrid2d: procedure(un: LongInt; u1, u2: Double; vn: LongInt; v1, v2: Double); gldecl;
+  glMapGrid2f: procedure(un: LongInt; u1, u2: Single; vn: LongInt; v1, v2: Single); gldecl;
+  glEvalPoint1: procedure(i: LongInt); gldecl;
+  glEvalPoint2: procedure(i, j: LongInt); gldecl;
+  glEvalMesh1: procedure(mode: GLenum; i1, i2: LongInt); gldecl;
+  glEvalMesh2: procedure(mode: GLenum; i1, i2, j1, j2: LongInt); gldecl;
+
+  // Fog
+  glFogf: procedure(pname: GLenum; param: Single); gldecl;
+  glFogi: procedure(pname: GLenum; param: LongInt); gldecl;
+  glFogfv: procedure(pname: GLenum; var params: Single); gldecl;
+  glFogiv: procedure(pname: GLenum; var params: LongInt); gldecl;
+
+  // Selection and Feedback
+  glFeedbackBuffer: procedure(size: LongInt; AType: GLenum; var buffer: Single); gldecl;
+  glPassThrough: procedure(token: Single); gldecl;
+  glSelectBuffer: procedure(size: LongInt; var buffer: LongWord); gldecl;
+  glInitNames: procedure; gldecl;
+  glLoadName: procedure(name: LongWord); gldecl;
+  glPushName: procedure(name: LongWord); gldecl;
+  glPopName: procedure; gldecl;
+
+
+// -------------------------------------------------------
+//   GL Extensions
+// -------------------------------------------------------
+
+var
+  // === 1.0 Extensions ===
+
+  // GL_EXT_blend_minmax
+  glBlendEquationEXT: procedure(mode: GLenum); gldecl;
+
+  // GL_EXT_blend_color
+  glBlendColorEXT: procedure(red, green, blue, alpha: GLclampf); gldecl;
+
+  // GL_EXT_polygon_offset
+  glPolygonOffsetEXT: procedure(factor, bias: Single); gldecl;
+
+  // GL_EXT_vertex_array
+  glVertexPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); gldecl;
+  glNormalPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); gldecl;
+  glColorPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); gldecl;
+  glIndexPointerEXT: procedure(AType: GLenum; stride, count: LongInt; var ptr); gldecl;
+  glTexCoordPointerEXT: procedure(size: LongInt; AType: GLenum; stride, count: LongInt; var ptr); gldecl;
+  glEdgeFlagPointerEXT: procedure(stride, count: LongInt; var ptr: Boolean); gldecl;
+  glGetPointervEXT: procedure(pname: GLenum; var params: Pointer); gldecl;
+  glArrayElementEXT: procedure(i: LongInt); gldecl;
+  glDrawArraysEXT: procedure(mode: GLEnum; first, count: LongInt); gldecl;
+
+  // GL_EXT_texture_object
+  glGenTexturesEXT: procedure(n: LongInt; var textures: LongWord); gldecl;
+  glDeleteTexturesEXT: procedure(n: LongInt; var textures: LongWord); gldecl;
+  glBindTextureEXT: procedure(target: GLenum; texture: LongWord); gldecl;
+  glPrioritizeTexturesEXT: procedure(n: LongInt; var textures: LongWord; var priorities: GLClampf); gldecl;
+  glAreTexturesResidentEXT: function(n: LongInt; var textures: LongWord; var residences: Boolean): Boolean; gldecl;
+  glIsTextureEXT: function(texture: LongWord): Boolean; gldecl;
+
+  // GL_EXT_texture3D
+  glTexImage3DEXT: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLenum; var pixels); gldecl;
+  glCopyTexSubImage3DEXT: procedure(target: GLenum; level, xoffset, yoffset, zoffset, x, y, width, height: LongInt); gldecl;
+
+  // GL_EXT_color_table
+  glColorTableEXT: procedure(target, internalformat: GLenum; width: LongInt; format, AType: GLenum; var table); gldecl;
+  glColorSubTableEXT: procedure(target: GLenum; start, count: LongInt; format, AType: GLEnum; var data); gldecl;
+  glGetColorTableEXT: procedure(target, format, AType: GLenum; var table); gldecl;
+  glGetColorTableParameterfvEXT: procedure(target, pname: GLenum; var params: Single); gldecl;
+  glGetColorTableParameterivEXT: procedure(target, pname: GLenum; var params: LongInt); gldecl;
+
+  // GL_SGIS_multitexture
+  glMultiTexCoord1dSGIS: procedure(target: GLenum; s: Double); gldecl;
+  glMultiTexCoord1dvSGIS: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord1fSGIS: procedure(target: GLenum; s: Single); gldecl;
+  glMultiTexCoord1fvSGIS: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord1iSGIS: procedure(target: GLenum; s: LongInt); gldecl;
+  glMultiTexCoord1ivSGIS: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord1sSGIS: procedure(target: GLenum; s: ShortInt); gldecl;
+  glMultiTexCoord1svSGIS: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord2dSGIS: procedure(target: GLenum; s, t: Double); gldecl;
+  glMultiTexCoord2dvSGIS: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord2fSGIS: procedure(target: GLenum; s, t: Single); gldecl;
+  glMultiTexCoord2fvSGIS: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord2iSGIS: procedure(target: GLenum; s, t: LongInt); gldecl;
+  glMultiTexCoord2ivSGIS: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord2sSGIS: procedure(target: GLenum; s, t: ShortInt); gldecl;
+  glMultiTexCoord2svSGIS: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord3dSGIS: procedure(target: GLenum; s, t, r: Double); gldecl;
+  glMultiTexCoord3dvSGIS: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord3fSGIS: procedure(target: GLenum; s, t, r: Single); gldecl;
+  glMultiTexCoord3fvSGIS: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord3iSGIS: procedure(target: GLenum; s, t, r: LongInt); gldecl;
+  glMultiTexCoord3ivSGIS: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord3sSGIS: procedure(target: GLenum; s, t, r: ShortInt); gldecl;
+  glMultiTexCoord3svSGIS: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord4dSGIS: procedure(target: GLenum; s, t, r, q: Double); gldecl;
+  glMultiTexCoord4dvSGIS: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord4fSGIS: procedure(target: GLenum; s, t, r, q: Single); gldecl;
+  glMultiTexCoord4fvSGIS: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord4iSGIS: procedure(target: GLenum; s, t, r, q: LongInt); gldecl;
+  glMultiTexCoord4ivSGIS: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord4sSGIS: procedure(target: GLenum; s, t, r, q: ShortInt); gldecl;
+  glMultiTexCoord4svSGIS: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoordPointerSGIS: procedure(target: GLenum; size: LongInt; AType: GLEnum; stride: LongInt; var APointer); gldecl;
+  glSelectTextureSGIS: procedure(target: GLenum); gldecl;
+  glSelectTextureCoordSetSGIS: procedure(target: GLenum); gldecl;
+
+  // GL_EXT_multitexture
+  glMultiTexCoord1dEXT: procedure(target: GLenum; s: Double); gldecl;
+  glMultiTexCoord1dvEXT: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord1fEXT: procedure(target: GLenum; s: Single); gldecl;
+  glMultiTexCoord1fvEXT: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord1iEXT: procedure(target: GLenum; s: LongInt); gldecl;
+  glMultiTexCoord1ivEXT: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord1sEXT: procedure(target: GLenum; s: ShortInt); gldecl;
+  glMultiTexCoord1svEXT: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord2dEXT: procedure(target: GLenum; s, t: Double); gldecl;
+  glMultiTexCoord2dvEXT: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord2fEXT: procedure(target: GLenum; s, t: Single); gldecl;
+  glMultiTexCoord2fvEXT: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord2iEXT: procedure(target: GLenum; s, t: LongInt); gldecl;
+  glMultiTexCoord2ivEXT: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord2sEXT: procedure(target: GLenum; s, t: ShortInt); gldecl;
+  glMultiTexCoord2svEXT: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord3dEXT: procedure(target: GLenum; s, t, r: Double); gldecl;
+  glMultiTexCoord3dvEXT: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord3fEXT: procedure(target: GLenum; s, t, r: Single); gldecl;
+  glMultiTexCoord3fvEXT: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord3iEXT: procedure(target: GLenum; s, t, r: LongInt); gldecl;
+  glMultiTexCoord3ivEXT: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord3sEXT: procedure(target: GLenum; s, t, r: ShortInt); gldecl;
+  glMultiTexCoord3svEXT: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glMultiTexCoord4dEXT: procedure(target: GLenum; s, t, r, q: Double); gldecl;
+  glMultiTexCoord4dvEXT: procedure(target: GLenum; var v: Double); gldecl;
+  glMultiTexCoord4fEXT: procedure(target: GLenum; s, t, r, q: Single); gldecl;
+  glMultiTexCoord4fvEXT: procedure(target: GLenum; var v: Single); gldecl;
+  glMultiTexCoord4iEXT: procedure(target: GLenum; s, t, r, q: LongInt); gldecl;
+  glMultiTexCoord4ivEXT: procedure(target: GLenum; var v: LongInt); gldecl;
+  glMultiTexCoord4sEXT: procedure(target: GLenum; s, t, r, q: ShortInt); gldecl;
+  glMultiTexCoord4svEXT: procedure(target: GLenum; var v: ShortInt); gldecl;
+  glInterleavedTextureCoordSetsEXT: procedure(factor: LongInt); gldecl;
+  glSelectTextureEXT: procedure(target: GLenum); gldecl;
+  glSelectTextureCoordSetEXT: procedure(target: GLenum); gldecl;
+  glSelectTextureTransformEXT: procedure(target: GLenum); gldecl;
+
+  // GL_EXT_point_parameters
+  glPointParameterfEXT: procedure(pname: GLenum; param: Single); gldecl;
+  glPointParameterfvEXT: procedure(pname: GLenum; var params: Single); gldecl;
+
+  // GL_MESA_window_pos
+  glWindowPos2iMESA: procedure(x, y: LongInt); gldecl;
+  glWindowPos2sMESA: procedure(x, y: ShortInt); gldecl;
+  glWindowPos2fMESA: procedure(x, y: Single); gldecl;
+  glWindowPos2dMESA: procedure(x, y: Double); gldecl;
+  glWindowPos2ivMESA: procedure(var p: LongInt); gldecl;
+  glWindowPos2svMESA: procedure(var p: ShortInt); gldecl;
+  glWindowPos2fvMESA: procedure(var p: Single); gldecl;
+  glWindowPos2dvMESA: procedure(var p: Double); gldecl;
+  glWindowPos3iMESA: procedure(x, y, z: LongInt); gldecl;
+  glWindowPos3sMESA: procedure(x, y, z: ShortInt); gldecl;
+  glWindowPos3fMESA: procedure(x, y, z: Single); gldecl;
+  glWindowPos3dMESA: procedure(x, y, z: Double); gldecl;
+  glWindowPos3ivMESA: procedure(var p: LongInt); gldecl;
+  glWindowPos3svMESA: procedure(var p: ShortInt); gldecl;
+  glWindowPos3fvMESA: procedure(var p: Single); gldecl;
+  glWindowPos3dvMESA: procedure(var p: Double); gldecl;
+  glWindowPos4iMESA: procedure(x, y, z, w: LongInt); gldecl;
+  glWindowPos4sMESA: procedure(x, y, z, w: ShortInt); gldecl;
+  glWindowPos4fMESA: procedure(x, y, z, w: Single); gldecl;
+  glWindowPos4dMESA: procedure(x, y, z, w: Double); gldecl;
+  glWindowPos4ivMESA: procedure(var p: LongInt); gldecl;
+  glWindowPos4svMESA: procedure(var p: ShortInt); gldecl;
+  glWindowPos4fvMESA: procedure(var p: Single); gldecl;
+  glWindowPos4dvMESA: procedure(var p: Double); gldecl;
+
+  // GL_MESA_resize_buffers
+  glResizeBuffersMESA: procedure; gldecl;
+
+
+// -------------------------------------------------------
+//   GL 1.2 Functions
+// -------------------------------------------------------
+
+  glDrawRangeElements: procedure(mode: GLenum; AStart, AEnd: LongWord; count: LongInt; AType: GLenum; var indices); gldecl;
+  glTexImage3D: procedure(target: GLenum; level: LongInt; internalFormat: GLenum; width, height, depth, border: LongInt; format, AType: GLEnum; var pixels); gldecl;
+  glTexSubImage3D: procedure(target: GLenum; level: LongInt; xoffset, yoffset, zoffset, width, height, depth: LongInt; format, AType: GLEnum; var pixels); gldecl;
+  glCopyTexSubImage3D: procedure(target: GLenum; level: LongInt; xoffset, yoffset, zoffset, x, y, width, height: LongInt); gldecl;
+
+
+// =======================================================
+//   GLU consts, types and functions
+// =======================================================
+
+const
+  GLU_TRUE 				= GL_TRUE;
+  GLU_FALSE 				= GL_FALSE;
+
+  // Normal vectors
+  GLU_SMOOTH				= 100000;
+  GLU_FLAT				= 100001;
+  GLU_NONE				= 100002;
+
+  // Quadric draw styles
+  GLU_POINT				= 100010;
+  GLU_LINE				= 100011;
+  GLU_FILL				= 100012;
+  GLU_SILHOUETTE			= 100013;
+
+  // Quadric orientation
+  GLU_OUTSIDE				= 100020;
+  GLU_INSIDE				= 100021;
+
+  // Tesselator
+  GLU_BEGIN				= 100100;
+  GLU_VERTEX				= 100101;
+  GLU_END				= 100102;
+  GLU_ERROR				= 100103;
+  GLU_EDGE_FLAG				= 100104;
+
+  // Contour types
+  GLU_CW				= 100120;
+  GLU_CCW				= 100121;
+  GLU_INTERIOR				= 100122;
+  GLU_EXTERIOR				= 100123;
+  GLU_UNKNOWN				= 100124;
+
+  // Tesselation errors
+  GLU_TESS_ERROR1			= 100151;  // missing gluEndPolygon
+  GLU_TESS_ERROR2 			= 100152;  // missing gluBeginPolygon
+  GLU_TESS_ERROR3 			= 100153;  // misoriented contour
+  GLU_TESS_ERROR4 			= 100154;  // vertex/edge intersection
+  GLU_TESS_ERROR5 			= 100155;  // misoriented or self-intersecting loops
+  GLU_TESS_ERROR6 			= 100156;  // coincident vertices
+  GLU_TESS_ERROR7 			= 100157;  // all vertices collinear
+  GLU_TESS_ERROR8 			= 100158;  // intersecting edges
+  GLU_TESS_ERROR9 			= 100159;  // not coplanar contours
+
+  // NURBS
+  GLU_AUTO_LOAD_MATRIX			= 100200;
+  GLU_CULLING				= 100201;
+  GLU_PARAMETRIC_TOLERANCE		= 100202;
+  GLU_SAMPLING_TOLERANCE		= 100203;
+  GLU_DISPLAY_MODE			= 100204;
+  GLU_SAMPLING_METHOD			= 100205;
+  GLU_U_STEP				= 100206;
+  GLU_V_STEP				= 100207;
+
+  GLU_PATH_LENGTH			= 100215;
+  GLU_PARAMETRIC_ERROR			= 100216;
+  GLU_DOMAIN_DISTANCE			= 100217;
+
+  GLU_MAP1_TRIM_2			= 100210;
+  GLU_MAP1_TRIM_3			= 100211;
+
+  GLU_OUTLINE_POLYGON			= 100240;
+  GLU_OUTLINE_PATCH			= 100241;
+
+  GLU_NURBS_ERROR1  			= 100251;   // spline order un-supported
+  GLU_NURBS_ERROR2  			= 100252;   // too few knots
+  GLU_NURBS_ERROR3  			= 100253;   // valid knot range is empty
+  GLU_NURBS_ERROR4  			= 100254;   // decreasing knot sequence
+  GLU_NURBS_ERROR5  			= 100255;   // knot multiplicity > spline order
+  GLU_NURBS_ERROR6  			= 100256;   // endcurve() must follow bgncurve()
+  GLU_NURBS_ERROR7  			= 100257;   // bgncurve() must precede endcurve()
+  GLU_NURBS_ERROR8  			= 100258;   // ctrlarray or knot vector is NULL
+  GLU_NURBS_ERROR9  			= 100259;   // cannot draw pwlcurves
+  GLU_NURBS_ERROR10 			= 100260;   // missing gluNurbsCurve()
+  GLU_NURBS_ERROR11 			= 100261;   // missing gluNurbsSurface()
+  GLU_NURBS_ERROR12 			= 100262;   // endtrim() must precede endsurface()
+  GLU_NURBS_ERROR13 			= 100263;   // bgnsurface() must precede endsurface()
+  GLU_NURBS_ERROR14 			= 100264;   // curve of improper type passed as trim curve
+  GLU_NURBS_ERROR15 			= 100265;   // bgnsurface() must precede bgntrim()
+  GLU_NURBS_ERROR16 			= 100266;   // endtrim() must follow bgntrim()
+  GLU_NURBS_ERROR17 			= 100267;   // bgntrim() must precede endtrim()*/
+  GLU_NURBS_ERROR18 			= 100268;   // invalid or missing trim curve*/
+  GLU_NURBS_ERROR19 			= 100269;   // bgntrim() must precede pwlcurve()
+  GLU_NURBS_ERROR20 			= 100270;   // pwlcurve referenced twice*/
+  GLU_NURBS_ERROR21 			= 100271;   // pwlcurve and nurbscurve mixed
+  GLU_NURBS_ERROR22 			= 100272;   // improper usage of trim data type
+  GLU_NURBS_ERROR23 			= 100273;   // nurbscurve referenced twice
+  GLU_NURBS_ERROR24 			= 100274;   // nurbscurve and pwlcurve mixed
+  GLU_NURBS_ERROR25 			= 100275;   // nurbssurface referenced twice
+  GLU_NURBS_ERROR26 			= 100276;   // invalid property
+  GLU_NURBS_ERROR27 			= 100277;   // endsurface() must follow bgnsurface()
+  GLU_NURBS_ERROR28 			= 100278;   // intersecting or misoriented trim curves
+  GLU_NURBS_ERROR29 			= 100279;   // intersecting trim curves
+  GLU_NURBS_ERROR30 			= 100280;   // UNUSED
+  GLU_NURBS_ERROR31 			= 100281;   // unconnected trim curves
+  GLU_NURBS_ERROR32 			= 100282;   // unknown knot error
+  GLU_NURBS_ERROR33 			= 100283;   // negative vertex count encountered
+  GLU_NURBS_ERROR34 			= 100284;   // negative byte-stride
+  GLU_NURBS_ERROR35 			= 100285;   // unknown type descriptor
+  GLU_NURBS_ERROR36 			= 100286;   // null control point reference
+  GLU_NURBS_ERROR37 			= 100287;   // duplicate point on pwlcurve
+
+  // Errors
+  GLU_INVALID_ENUM			= 100900;
+  GLU_INVALID_VALUE			= 100901;
+  GLU_OUT_OF_MEMORY			= 100902;
+  GLU_INCOMPATIBLE_GL_VERSION		= 100903;
+
+  // New in GLU 1.1
+  GLU_VERSION				= 100800;
+  GLU_EXTENSIONS			= 100801;
+
+type
+  PGLUquadricObj = ^TGLUquadricObj;
+  TGLUquadricObj = record end;
+  PGLUtriangulatorObj = ^TGLUtriangulatorObj;
+  TGLUtriangulatorObj = record end;
+  PGLUnurbsObj = ^TGLUnurbsObj;
+  TGLUnurbsObj = record end;
+
+  TGLUQuadricCallback = procedure; cdecl;
+  TGLUNurbsCallback = procedure; cdecl;
+  TGLUTessCallback = procedure; cdecl;
+
+  TGLUViewport = array[0..3] of LongInt;
+  TGLUMatrixd = array[0..15] of Double;
+  TGLUMatrixf = array[0..15] of Single;
+  TGLUVectord = array[0..2] of Double;
+var
+  // Miscellaneous functions
+  gluLookAt: procedure(eye, eyey, eyez, centerx, centery, centerz, upx, upy, upz: Double); gldecl;
+  gluOrtho2D: procedure(left, right, bottom, top: Double); gldecl;
+  gluPerspective: procedure(fovy, aspect, zNear, zFar: Double); gldecl;
+  gluPickMatrix: procedure(x, y, width, height: Double; const viewport: TGLUViewport); gldecl;
+  gluProject: procedure(objx, objy, objz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; winx, winy, winz: Double); gldecl;
+  gluUnProject: procedure(winx, winy, winz: Double; const modelMatrix, projMatrix: TGLUMatrixd; const viewport: TGLUViewport; objx, objy, objz: Double); gldecl;
+  gluErrorString: procedure(errorCode: GLenum); gldecl;
+
+  // Mipmapping and image scaling
+  gluScaleImage: procedure(format: GLenum; within, heightin: LongInt; typein: GLenum; var datain; widthout, heightout: LongInt; typeout: GLenum; var dataout); gldecl;
+  gluBuild1DMipmaps: procedure(target: GLenum; components, width: LongInt; format, AType: GLEnum; var data); gldecl;
+  gluBuild2DMipmaps: procedure(target: GLenum; components, width, height: LongInt; format, AType: GLEnum; var data); gldecl;
+
+  // Quadrics
+  gluNewQuadric: function: PGLUquadricObj; gldecl;
+  gluDeleteQuadric: procedure(state: PGLUquadricObj); gldecl;
+  gluQuadricDrawStyle: procedure(quadObject: PGLUquadricObj; drawStyle: GLenum); gldecl;
+  gluQuadricOrientation: procedure(quadObject: PGLUquadricObj; orientation: GLenum); gldecl;
+  gluQuadricNormals: procedure(quadObject: PGLUquadricObj; normals: GLenum); gldecl;
+  gluQuadricTexture: procedure(quadObject: PGLUquadricObj; textureCoords: Boolean); gldecl;
+  gluQuadricCallback: procedure(quadObject: PGLUquadricObj; which: GLenum; fn: TGLUQuadricCallback); gldecl;
+  gluCylinder: procedure(qobj: PGLUquadricObj; baseRadius, topRadius, height: Double; slices, stacks: LongInt); gldecl;
+  gluSphere: procedure(qobj: PGLUquadricObj; radius: Double; slices, stacks: LongInt); gldecl;
+  gluDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt); gldecl;
+  gluPartialDisk: procedure(qobj: PGLUquadricObj; innerRadius, outerRadius: Double; slices, loops: LongInt; startAngle, sweepAngle: Double); gldecl;
+
+  // Nurbs
+  gluNewNurbsRenderer: function: PGLUnurbsObj; gldecl;
+  gluDeleteNurbsRenderer: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluLoadSamplingMatrices: procedure(nobj: PGLUnurbsObj; const modelMatrix, projMatrix: TGLUMatrixf; const viewport: TGLUViewport); gldecl;
+  gluNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLenum; value: Single); gldecl;
+  gluGetNurbsProperty: procedure(nobj: PGLUnurbsObj; AProperty: GLEnum; var value: Single); gldecl;
+  gluBeginCurve: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluEndCurve: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluNurbsCurve: procedure(nobj: PGLUnurbsObj; nknots: LongInt; var know: Single; stride: LongInt; var ctlarray: Single; order: LongInt; AType: GLenum); gldecl;
+  gluBeginSurface: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluEndSurface: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluNurbsSurface: procedure(nobj: PGLUnurbsObj; sknot_count: LongInt; var sknot: Single; tknot_count: LongInt; var tknot: Single; s_stride, t_stride: LongInt; var ctlarray: Single; sorder, torder: LongInt; AType: GLenum); gldecl;
+  gluBeginTrim: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluEndTrim: procedure(nobj: PGLUnurbsObj); gldecl;
+  gluPwlCurve: procedure(nobj: PGLUnurbsObj; count: LongInt; var AArray: Single; stride: LongInt; AType: GLenum); gldecl;
+  gluNurbsCallback: procedure(nobj: PGLUnurbsObj; which: GLenum; fn: TGLUNurbsCallback); gldecl;
+
+  // Polygon tesselation
+  gluNewTess: function: PGLUtriangulatorObj; gldecl;
+  gluTessCallback: procedure(tobj: PGLUtriangulatorObj; which: GLenum; fn: TGLUTessCallback); gldecl;
+
+  gluDeleteTess: procedure(tobj: PGLUtriangulatorObj); gldecl;
+  gluBeginPolygon: procedure(tobj: PGLUtriangulatorObj); gldecl;
+  gluEndPolygon: procedure(tobj: PGLUtriangulatorObj); gldecl;
+  gluNextContour: procedure(tobj: PGLUtriangulatorObj; AType: GLenum); gldecl;
+  gluTessVertex: procedure(tobj: PGLUtriangulatorObj; v: TGLUVectord; var data); gldecl;
+
+  // New functions in GLU 1.1
+  gluGetString: function(name: GLenum): PChar; gldecl;
+
+
+// =======================================================
+//   GLX consts, types and functions
+// =======================================================
+
+{$IFDEF HasGLX}
+
+// Tokens for glXChooseVisual and glXGetConfig:
+const
+  GLX_USE_GL				= 1;
+  GLX_BUFFER_SIZE			= 2;
+  GLX_LEVEL				= 3;
+  GLX_RGBA				= 4;
+  GLX_DOUBLEBUFFER			= 5; 
+  GLX_STEREO				= 6;
+  GLX_AUX_BUFFERS			= 7;
+  GLX_RED_SIZE				= 8;
+  GLX_GREEN_SIZE			= 9;
+  GLX_BLUE_SIZE				= 10;
+  GLX_ALPHA_SIZE			= 11;
+  GLX_DEPTH_SIZE			= 12;
+  GLX_STENCIL_SIZE			= 13;
+  GLX_ACCUM_RED_SIZE			= 14;
+  GLX_ACCUM_GREEN_SIZE			= 15;
+  GLX_ACCUM_BLUE_SIZE			= 16;
+  GLX_ACCUM_ALPHA_SIZE			= 17;
+
+  // GLX_EXT_visual_info extension
+  GLX_X_VISUAL_TYPE_EXT			= $22;
+  GLX_TRANSPARENT_TYPE_EXT		= $23;
+  GLX_TRANSPARENT_INDEX_VALUE_EXT 	= $24;
+  GLX_TRANSPARENT_RED_VALUE_EXT		= $25;
+  GLX_TRANSPARENT_GREEN_VALUE_EXT	= $26;
+  GLX_TRANSPARENT_BLUE_VALUE_EXT	= $27;
+  GLX_TRANSPARENT_ALPHA_VALUE_EXT	= $28;
+
+
+  // Error codes returned by glXGetConfig:
+  GLX_BAD_SCREEN			= 1;
+  GLX_BAD_ATTRIBUTE			= 2;
+  GLX_NO_EXTENSION			= 3;
+  GLX_BAD_VISUAL			= 4;
+  GLX_BAD_CONTEXT			= 5;
+  GLX_BAD_VALUE       			= 6;
+  GLX_BAD_ENUM				= 7;
+
+  // GLX 1.1 and later:
+  GLX_VENDOR				= 1;
+  GLX_VERSION				= 2;
+  GLX_EXTENSIONS 			= 3;
+
+  // GLX_visual_info extension
+  GLX_TRUE_COLOR_EXT			= $8002;
+  GLX_DIRECT_COLOR_EXT			= $8003;
+  GLX_PSEUDO_COLOR_EXT			= $8004;
+  GLX_STATIC_COLOR_EXT			= $8005;
+  GLX_GRAY_SCALE_EXT			= $8006;
+  GLX_STATIC_GRAY_EXT			= $8007;
+  GLX_NONE_EXT				= $8000;
+  GLX_TRANSPARENT_RGB_EXT		= $8008;
+  GLX_TRANSPARENT_INDEX_EXT		= $8009;
+
+type
+  // From XLib:
+  XPixmap = XID;
+  XFont = XID;
+  XColormap = XID;
+
+  GLXContext = Pointer;
+  GLXPixmap = XID;
+  GLXDrawable = XID;
+  GLXContextID = XID;
+
+var
+  glXChooseVisual: function(dpy: PDisplay; screen: Integer; var attribList: Integer): PXVisualInfo; cdecl;
+  glXCreateContext: function(dpy: PDisplay; vis: PXVisualInfo; shareList: GLXContext; direct: Boolean): GLXContext; cdecl;
+  glXDestroyContext: procedure(dpy: PDisplay; ctx: GLXContext); cdecl;
+  glXMakeCurrent: function(dpy: PDisplay; drawable: GLXDrawable; ctx: GLXContext): Boolean; cdecl;
+  glXCopyContext: procedure(dpy: PDisplay; src, dst: GLXContext; mask: LongWord); cdecl;
+  glXSwapBuffers: procedure(dpy: PDisplay; drawable: GLXDrawable); cdecl;
+  glXCreateGLXPixmap: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap): GLXPixmap; cdecl;
+  glXDestroyGLXPixmap: procedure(dpy: PDisplay; pixmap: GLXPixmap); cdecl;
+  glXQueryExtension: function(dpy: PDisplay; var errorb, event: Integer): Boolean; cdecl;
+  glXQueryVersion: function(dpy: PDisplay; var maj, min: Integer): Boolean; cdecl;
+  glXIsDirect: function(dpy: PDisplay; ctx: GLXContext): Boolean; cdecl;
+  glXGetConfig: function(dpy: PDisplay; visual: PXVisualInfo; attrib: Integer; var value: Integer): Integer; cdecl;
+  glXGetCurrentContext: function: GLXContext; cdecl;
+  glXGetCurrentDrawable: function: GLXDrawable; cdecl;
+  glXWaitGL: procedure; cdecl;
+  glXWaitX: procedure; cdecl;
+  glXUseXFont: procedure(font: XFont; first, count, list: Integer); cdecl;
+
+  // GLX 1.1 and later
+  glXQueryExtensionsString: function(dpy: PDisplay; screen: Integer): PChar; cdecl;
+  glXQueryServerString: function(dpy: PDisplay; screen, name: Integer): PChar; cdecl;
+  glXGetClientString: function(dpy: PDisplay; name: Integer): PChar; cdecl;
+
+  // Mesa GLX Extensions
+  glXCreateGLXPixmapMESA: function(dpy: PDisplay; visual: PXVisualInfo; pixmap: XPixmap; cmap: XColormap): GLXPixmap; cdecl;
+  glXReleaseBufferMESA: function(dpy: PDisplay; d: GLXDrawable): Boolean; cdecl;
+  glXCopySubBufferMESA: procedure(dpy: PDisplay; drawbale: GLXDrawable; x, y, width, height: Integer); cdecl;
+  glXGetVideoSyncSGI: function(var counter: LongWord): Integer; cdecl;
+  glXWaitVideoSyncSGI: function(divisor, remainder: Integer; var count: LongWord): Integer; cdecl;
+
+{$ENDIF  IFDEF HasGLX}
+
+
+
+// =======================================================
+// =======================================================
+
+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}
+
+var
+  libGL, libGLU: 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');
+
+  GLInitialized := True;
+  Result := True;
+end;
+
+function InitGLUFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLU := LoadLibrary(libname);
+  if libGLU = 0 then exit;
+
+  gluLookAt := GetProcAddress(libGLU, 'gluLookAt');
+  gluOrtho2D := GetProcAddress(libGLU, 'gluOrtho2D');
+  gluPerspective := GetProcAddress(libGLU, 'gluPerspective');
+  gluPickMatrix := GetProcAddress(libGLU, 'gluPickMatrix');
+  gluProject := GetProcAddress(libGLU, 'gluProject');
+  gluUnProject := GetProcAddress(libGLU, 'gluUnProject');
+  gluErrorString := GetProcAddress(libGLU, 'gluErrorString');
+  gluScaleImage := GetProcAddress(libGLU, 'gluScaleImage');
+  gluBuild1DMipmaps := GetProcAddress(libGLU, 'gluBuild1DMipmaps');
+  gluBuild2DMipmaps := GetProcAddress(libGLU, 'gluBuild2DMipmaps');
+  gluNewQuadric := GetProcAddress(libGLU, 'gluNewQuadric');
+  gluDeleteQuadric := GetProcAddress(libGLU, 'gluDeleteQuadric');
+  gluQuadricDrawStyle := GetProcAddress(libGLU, 'gluQuadricDrawStyle');
+  gluQuadricOrientation := GetProcAddress(libGLU, 'gluQuadricOrientation');
+  gluQuadricNormals := GetProcAddress(libGLU, 'gluQuadricNormals');
+  gluQuadricTexture := GetProcAddress(libGLU, 'gluQuadricTexture');
+  gluQuadricCallback := GetProcAddress(libGLU, 'gluQuadricCallback');
+  gluCylinder := GetProcAddress(libGLU, 'gluCylinder');
+  gluSphere := GetProcAddress(libGLU, 'gluSphere');
+  gluDisk := GetProcAddress(libGLU, 'gluDisk');
+  gluPartialDisk := GetProcAddress(libGLU, 'gluPartialDisk');
+  gluNewNurbsRenderer := GetProcAddress(libGLU, 'gluNewNurbsRenderer');
+  gluDeleteNurbsRenderer := GetProcAddress(libGLU, 'gluDeleteNurbsRenderer');
+  gluLoadSamplingMatrices := GetProcAddress(libGLU, 'gluLoadSamplingMatrices');
+  gluNurbsProperty := GetProcAddress(libGLU, 'gluNurbsProperty');
+  gluGetNurbsProperty := GetProcAddress(libGLU, 'gluGetNurbsProperty');
+  gluBeginCurve := GetProcAddress(libGLU, 'gluBeginCurve');
+  gluEndCurve := GetProcAddress(libGLU, 'gluEndCurve');
+  gluNurbsCurve := GetProcAddress(libGLU, 'gluNurbsCurve');
+  gluBeginSurface := GetProcAddress(libGLU, 'gluBeginSurface');
+  gluEndSurface := GetProcAddress(libGLU, 'gluEndSurface');
+  gluNurbsSurface := GetProcAddress(libGLU, 'gluNurbsSurface');
+  gluBeginTrim := GetProcAddress(libGLU, 'gluBeginTrim');
+  gluEndTrim := GetProcAddress(libGLU, 'gluEndTrim');
+  gluPwlCurve := GetProcAddress(libGLU, 'gluPwlCurve');
+  gluNurbsCallback := GetProcAddress(libGLU, 'gluNurbsCallback');
+  gluNewTess := GetProcAddress(libGLU, 'gluNewTess');
+  gluTessCallback := GetProcAddress(libGLU, 'gluTessCallback');
+  gluDeleteTess := GetProcAddress(libGLU, 'gluDeleteTess');
+  gluBeginPolygon := GetProcAddress(libGLU, 'gluBeginPolygon');
+  gluEndPolygon := GetProcAddress(libGLU, 'gluEndPolygon');
+  gluNextContour := GetProcAddress(libGLU, 'gluNextContour');
+  gluTessVertex := GetProcAddress(libGLU, 'gluTessVertex');
+  gluGetString := GetProcAddress(libGLU, 'gluGetString');
+
+  GLUInitialized := True;
+  Result := True;
+end;
+
+
+{$IFDEF HasGLX}
+
+function InitGLX: Boolean;
+begin
+  Result := False;
+  if libGL = 0 then exit;
+  
+  glXQueryVersion := GetProcAddress(libGL, 'glXQueryVersion');
+  if @glXQueryVersion = nil then exit;
+
+  glXChooseVisual := GetProcAddress(libGL, 'glXChooseVisual');
+  glXCreateContext := GetProcAddress(libGL, 'glXCreateContext');
+  glXDestroyContext := GetProcAddress(libGL, 'glXDestroyContext');
+  glXMakeCurrent := GetProcAddress(libGL, 'glXMakeCurrent');
+  glXCopyContext := GetProcAddress(libGL, 'glXCopyContext');
+  glXSwapBuffers := GetProcAddress(libGL, 'glXSwapBuffers');
+  glXCreateGLXPixmap := GetProcAddress(libGL, 'glXCreateGLXPixmap');
+  glXDestroyGLXPixmap := GetProcAddress(libGL, 'glXDestroyGLXPixmap');
+  glXQueryExtension := GetProcAddress(libGL, 'glXQueryExtension');
+
+  glXIsDirect := GetProcAddress(libGL, 'glXIsDirect');
+  glXGetConfig := GetProcAddress(libGL, 'glXGetConfig');
+  glXGetCurrentContext := GetProcAddress(libGL, 'glXGetCurrentContext');
+  glXGetCurrentDrawable := GetProcAddress(libGL, 'glXGetCurrentDrawable');
+  glXWaitGL := GetProcAddress(libGL, 'glXWaitGL');
+  glXWaitX := GetProcAddress(libGL, 'glXWaitX');
+  glXUseXFont := GetProcAddress(libGL, 'glXUseXFont');
+  glXQueryExtensionsString := GetProcAddress(libGL, 'glXQueryExtensionsString');
+  glXQueryServerString := GetProcAddress(libGL, 'glXQueryServerString');
+  glXGetClientString := GetProcAddress(libGL, 'glXGetClientString');
+  glXCreateGLXPixmapMESA := GetProcAddress(libGL, 'glXCreateGLXPixmapMESA');
+  glXReleaseBufferMESA := GetProcAddress(libGL, 'glXReleaseBufferMESA');
+  glXCopySubBufferMESA := GetProcAddress(libGL, 'glXCopySubBufferMESA');
+  glXGetVideoSyncSGI := GetProcAddress(libGL, 'glXGetVideoSyncSGI');
+  glXWaitVideoSyncSGI := GetProcAddress(libGL, 'glXWaitVideoSyncSGI');
+
+  GLXInitialized := True;
+  Result := True;
+end;
+
+{$ENDIF  IFDEF HasGLX}
+
+
+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;
+
+function InitGLU: Boolean;
+begin
+{$IFDEF Win32}
+  Result := InitGLUFromLibrary('glu32.dll');
+{$ELSE}
+  {$IFDEF Linux}
+  Result := InitGLUFromLibrary('libGLU.so') or InitGLUFromLibrary('libMesaGLU.so');
+  {$ELSE}
+    {$ERROR Unsupported platform}
+  {$ENDIF}
+{$ENDIF}
+end;
+
+
+
+finalization
+  if libGL <> 0 then FreeLibrary(libGL);
+  if libGLU <> 0 then FreeLibrary(libGLU);
+end.
+
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:23  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+  Revision 1.1  1999/11/10 14:15:33  sg
+  * Added to CVS
+
+}

+ 415 - 0
packages/opengl/old/glut.pp

@@ -0,0 +1,415 @@
+{
+  $Id$
+
+  Translation of the Mesa GLUT 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}
+
+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;
+
+
+
+
+const
+  // Display mode bit masks
+  GLUT_RGB			= 0;
+  GLUT_RGBA			= GLUT_RGB;
+  GLUT_INDEX			= 1;
+  GLUT_SINGLE			= 0;
+  GLUT_DOUBLE			= 2;
+  GLUT_ACCUM			= 4;
+  GLUT_ALPHA			= 8;
+  GLUT_DEPTH			= 16;
+  GLUT_STENCIL			= 32;
+  GLUT_MULTISAMPLE		= 128;
+  GLUT_STEREO			= 256;
+  GLUT_LUMINANCE		= 512;
+
+  // Mouse buttons
+  GLUT_LEFT_BUTTON		= 0;
+  GLUT_MIDDLE_BUTTON		= 1;
+  GLUT_RIGHT_BUTTON		= 2;
+
+  // Mouse button state
+  GLUT_DOWN			= 0;
+  GLUT_UP               	= 1;
+
+  // Keys ###
+
+  // Enter / exit state
+  GLUT_LEFT			= 0;
+  GLUT_ENTERED			= 1;
+
+  // Menu usage state
+  GLUT_MENU_NOT_IN_USE		= 0;
+  GLUT_MENU_IN_USE		= 1;
+
+  // Visibility state
+  GLUT_NOT_VISIBLE		= 0;
+  GLUT_VISIBLE			= 1;
+
+  // Window status state
+  GLUT_HIDDEN			= 0;
+  GLUT_FULLY_RETAINED		= 1;
+  GLUT_PARTIALLY_RETAINED 	= 2;
+  GLUT_FULLY_COVERED		= 3;
+
+  // Color index component selection values
+  GLUT_RED			= 0;
+  GLUT_GREEN			= 1;
+  GLUT_BLUE			= 2;
+
+  // Layers for use
+  GLUT_NORMAL			= 0;
+  GLUT_OVERLAY			= 1;
+
+  // Bitmap stuff###
+
+
+  // glutGet parameters
+  GLUT_WINDOW_X			= 100;
+  GLUT_WINDOW_Y			= 101;
+  GLUT_WINDOW_WIDTH		= 102;
+  GLUT_WINDOW_HEIGHT		= 103;
+  GLUT_WINDOW_BUFFER_SIZE	= 104;
+  GLUT_WINDOW_STENCIL_SIZE	= 105;
+  GLUT_WINDOW_DEPTH_SIZE	= 106;
+  GLUT_WINDOW_RED_SIZE		= 107;
+  GLUT_WINDOW_GREEN_SIZE	= 108;
+  GLUT_WINDOW_BLUE_SIZE		= 109;
+  GLUT_WINDOW_ALPHA_SIZE	= 110;
+  GLUT_WINDOW_ACCUM_RED_SIZE	= 111;
+  GLUT_WINDOW_ACCUM_GREEN_SIZE	= 112;
+  GLUT_WINDOW_ACCUM_BLUE_SIZE	= 113;
+  GLUT_WINDOW_ACCUM_ALPHA_SIZE	= 114;
+  GLUT_WINDOW_DOUBLEBUFFER	= 115;
+  GLUT_WINDOW_RGBA		= 116;
+  GLUT_WINDOW_PARENT		= 117;
+  GLUT_WINDOW_NUM_CHILDREN	= 118;
+  GLUT_WINDOW_COLORMAP_SIZE	= 119;
+  GLUT_WINDOW_NUM_SAMPLES	= 120;
+  GLUT_WINDOW_STEREO		= 121;
+  GLUT_WINDOW_CURSOR		= 122;
+  GLUT_SCREEN_WIDTH		= 200;
+  GLUT_SCREEN_HEIGHT		= 201;
+  GLUT_SCREEN_WIDTH_MM		= 202;
+  GLUT_SCREEN_HEIGHT_MM		= 203;
+  GLUT_MENU_NUM_ITEMS		= 300;
+  GLUT_DISPLAY_MODE_POSSIBLE	= 400;
+  GLUT_INIT_WINDOW_X		= 500;
+  GLUT_INIT_WINDOW_Y		= 501;
+  GLUT_INIT_WINDOW_WIDTH	= 502;
+  GLUT_INIT_WINDOW_HEIGHT	= 503;
+  GLUT_INIT_DISPLAY_MODE	= 504;
+  GLUT_ELAPSED_TIME		= 700;
+  GLUT_WINDOW_FORMAT_ID		= 123;
+
+  // glutDeviceGet parameters
+  GLUT_HAS_KEYBOARD		= 600;
+  GLUT_HAS_MOUSE		= 601;
+  GLUT_HAS_SPACEBALL		= 602;
+  GLUT_HAS_DIAL_AND_BUTTON_BOX	= 603;
+  GLUT_HAS_TABLET		= 604;
+  GLUT_NUM_MOUSE_BUTTONS	= 605;
+  GLUT_NUM_SPACEBALL_BUTTONS	= 606;
+  GLUT_NUM_BUTTON_BOX_BUTTONS	= 607;
+  GLUT_NUM_DIALS		= 608;
+  GLUT_NUM_TABLET_BUTTONS	= 609;
+  GLUT_DEVICE_IGNORE_KEY_REPEAT = 610;
+  GLUT_DEVICE_KEY_REPEAT	= 611;
+  GLUT_HAS_JOYSTICK		= 612;
+  GLUT_OWNS_JOYSTICK		= 613;
+  GLUT_JOYSTICK_BUTTONS		= 614;
+  GLUT_JOYSTICK_AXES		= 615;
+  GLUT_JOYSTICK_POLL_RATE	= 616;
+
+  // glutLayerGet parameters
+  GLUT_OVERLAY_POSSIBLE		= 800;
+  GLUT_LAYER_IN_USE		= 801;
+  GLUT_HAS_OVERLAY		= 802;
+  GLUT_TRANSPARENT_INDEX	= 803;
+  GLUT_NORMAL_DAMAGED		= 804;
+  GLUT_OVERLAY_DAMAGED		= 805;
+
+  // glutVideoResizeGet parameters
+  GLUT_VIDEO_RESIZE_POSSIBLE	= 900;
+  GLUT_VIDEO_RESIZE_IN_USE	= 901;
+  GLUT_VIDEO_RESIZE_X_DELTA	= 902;
+  GLUT_VIDEO_RESIZE_Y_DELTA	= 903;
+  GLUT_VIDEO_RESIZE_WIDTH_DELTA = 904;
+  GLUT_VIDEO_RESIZE_HEIGHT_DELTA= 905;
+  GLUT_VIDEO_RESIZE_X		= 906;
+  GLUT_VIDEO_RESIZE_Y		= 907;
+  GLUT_VIDEO_RESIZE_WIDTH	= 908;
+  GLUT_VIDEO_RESIZE_HEIGHT	= 909;
+
+  // glutGetModifiers return mask
+  GLUT_ACTIVE_SHIFT		= 1;
+  GLUT_ACTIVE_CTRL		= 2;
+  GLUT_ACTIVE_ALT		= 4;
+
+  // Cursor stuff ###
+
+
+var
+// GLUT initialization sub-API
+  glutInit: procedure(var argcp: Integer; var argv: PChar); gldecl;
+  glutInitDisplayMode: procedure(mode: LongWord); gldecl;
+  glutInitDisplayString: procedure(AString: PChar); gldecl;
+  glutInitWindowPosition: procedure(x, y: Integer); gldecl;
+  glutInitWindowSize: procedure(width, height: Integer); gldecl;
+  glutMainLoop: procedure; gldecl;
+
+// GLUT window sub-API
+  glutCreateWindow: function(title: PChar): Integer; gldecl;
+  glutCreateSubWindow: function(win, x, y, width, height: Integer): Integer; gldecl;
+  glutDestroyWindow: procedure(win: Integer); gldecl;
+  glutPostRedisplay: procedure; gldecl;
+  glutPostWindowRedisplay: procedure(win: Integer); gldecl;
+  glutSwapBuffers: procedure; gldecl;
+  glutGetWindow: function: Integer; gldecl;
+  glutSetWindow: procedure(win: Integer); gldecl;
+  glutSetWindowTitle: procedure(title: PChar); gldecl;
+  glutSetIconTitle: procedure(title: PChar); gldecl;
+  glutPositionWindow: procedure(x, y: Integer); gldecl;
+  glutReshapeWindow: procedure(width, height: Integer); gldecl;
+  glutPopWindow: procedure; gldecl;
+  glutPushWindow: procedure; gldecl;
+  glutIconifyWindow: procedure; gldecl;
+  glutShowWindow: procedure; gldecl;
+  glutHideWindow: procedure; gldecl;
+  glutFullScreen: procedure; gldecl;
+  glutSetCursor: procedure(cursor: Integer); gldecl;
+  glutWarpPointer: procedure(x, y: Integer); gldecl;
+
+//overlays ###
+
+//menus ###
+
+// GLUT window callback sub-API
+type
+  TGlutDisplayFunc = procedure; gldecl;
+  TGlutReshapeFunc = procedure(width, height: Integer); gldecl;
+
+  TGlutTimerFunc = procedure(value: Integer); gldecl;
+var
+  glutDisplayFunc: procedure(func: TGlutDisplayFunc); gldecl;
+  glutReshapeFunc: procedure(func: TGlutReshapeFunc); gldecl;
+
+  glutTimerFunc: procedure(millis: LongWord; func: TGlutTimerFunc; value: Integer); gldecl;
+
+{
+GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK * func)(void));
+GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK * func)(int width, int height));
+GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK * func)(void));
+//GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK * func)(int value), int value);
+GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK * func)(int x, int y, int z));
+GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK * func)(int button, int state));
+GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK * func)(int button, int state));
+GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK * func)(int dial, int value));
+GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK * func)(int x, int y));
+GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK * func)(int button, int state, int x, int y));
+GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK * func)(int status, int x, int y));
+GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK * func)(void));
+GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK * func)(int state));
+GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK * func)(unsigned char key, int x, int y));
+GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK * func)(int key, int x, int y));
+GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK * func)(unsigned int buttonMask, int x, int y, int z), int pollInterval)
+}
+// GLUT color index sub-API
+  glutSetColor: procedure(index: Integer; red, green, blue: Single); gldecl;
+  glutGetColor: function(ndx, component: Integer): Single; gldecl;
+  glutCopyColormap: procedure(win: Integer); gldecl;
+
+// GLUT state retrieval sub-API
+  glutGet: function(AType: GLEnum): Integer; gldecl;
+  glutDeviceGet: function(AType: GLEnum): Integer; gldecl;
+  glutExtensionSupported: function(name: PChar): Integer; gldecl;
+  glutGetModifiers: function: Integer; gldecl;
+  glutLayerGet: function(AType: GLEnum): Integer; gldecl;
+
+// fonts ###
+
+// pre-built models ###
+
+// video resize ###
+
+// debugging ###
+
+// device control ###
+
+
+// GLUT game mode sub-API
+// glutGameModeGet
+const
+  GLUT_GAME_MODE_ACTIVE		= 0;
+  GLUT_GAME_MODE_POSSIBLE	= 1;
+  GLUT_GAME_MODE_WIDTH		= 2;
+  GLUT_GAME_MODE_HEIGHT		= 3;
+  GLUT_GAME_MODE_PIXEL_DEPTH	= 4;
+  GLUT_GAME_MODE_REFRESH_RATE	= 5;
+  GLUT_GAME_MODE_DISPLAY_CHANGED= 6;
+var
+  glutGameModeString: procedure(AString: PChar); gldecl;
+  glutEnterGameMode: function: Integer; gldecl;
+  glutLeaveGameMode: procedure; gldecl;
+  glutGameModeGet: function(mode: GLEnum): Integer; gldecl;
+
+
+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}
+
+var
+  libGLUT: HInstance;
+
+function InitGLUTFromLibrary(libname: PChar): Boolean;
+begin
+  Result := False;
+  libGLUT := LoadLibrary(libname);
+  if libGLUT = 0 then exit;
+
+  glutInit := GetProcAddress(libGLUT, 'glutInit');
+  glutInitDisplayMode := GetProcAddress(libGLUT, 'glutInitDisplayMode');
+  glutInitDisplayString := GetProcAddress(libGLUT, 'glutInitDisplayString');
+  glutInitWindowPosition := GetProcAddress(libGLUT, 'glutInitWindowPosition');
+  glutInitWindowSize := GetProcAddress(libGLUT, 'glutInitWindowSize');
+  glutMainLoop := GetProcAddress(libGLUT, 'glutMainLoop');
+  glutCreateWindow := GetProcAddress(libGLUT, 'glutCreateWindow');
+  glutCreateSubWindow := GetProcAddress(libGLUT, 'glutCreateSubWindow');
+  glutDestroyWindow := GetProcAddress(libGLUT, 'glutDestroyWindow');
+  glutPostRedisplay := GetProcAddress(libGLUT, 'glutPostRedisplay');
+  glutPostWindowRedisplay := GetProcAddress(libGLUT, 'glutPostWindowRedisplay');
+  glutSwapBuffers := GetProcAddress(libGLUT, 'glutSwapBuffers');
+  glutGetWindow := GetProcAddress(libGLUT, 'glutGetWindow');
+  glutSetWindow := GetProcAddress(libGLUT, 'glutSetWindow');
+  glutSetWindowTitle := GetProcAddress(libGLUT, 'glutSetWindowTitle');
+  glutSetIconTitle := GetProcAddress(libGLUT, 'glutSetIconTitle');
+  glutPositionWindow := GetProcAddress(libGLUT, 'glutPositionWindow');
+  glutReshapeWindow := GetProcAddress(libGLUT, 'glutReshapeWindow');
+  glutPopWindow := GetProcAddress(libGLUT, 'glutPopWindow');
+  glutPushWindow := GetProcAddress(libGLUT, 'glutPushWindow');
+  glutIconifyWindow := GetProcAddress(libGLUT, 'glutIconifyWindow');
+  glutShowWindow := GetProcAddress(libGLUT, 'glutShowWindow');
+  glutHideWindow := GetProcAddress(libGLUT, 'glutHideWindow');
+  glutFullScreen := GetProcAddress(libGLUT, 'glutFullScreen');
+  glutSetCursor := GetProcAddress(libGLUT, 'glutSetCursor');
+  glutWarpPointer := GetProcAddress(libGLUT, 'glutWarpPointer');
+  glutSetColor := GetProcAddress(libGLUT, 'glutSetColor');
+  glutGetColor := GetProcAddress(libGLUT, 'glutGetColor');
+  glutCopyColormap := GetProcAddress(libGLUT, 'glutCopyColormap');
+  glutGet := GetProcAddress(libGLUT, 'glutGet');
+  glutDeviceGet := GetProcAddress(libGLUT, 'glutDeviceGet');
+  glutExtensionSupported := GetProcAddress(libGLUT, 'glutExtensionSupported');
+  glutGetModifiers := GetProcAddress(libGLUT, 'glutGetModifiers');
+  glutLayerGet := GetProcAddress(libGLUT, 'glutLayerGet');
+  glutGameModeString := GetProcAddress(libGLUT, 'glutGameModeString');
+  glutEnterGameMode := GetProcAddress(libGLUT, 'glutEnterGameMode');
+  glutLeaveGameMode := GetProcAddress(libGLUT, 'glutLeaveGameMode');
+  glutGameModeGet := GetProcAddress(libGLUT, 'glutGameModeGet');
+  glutDisplayFunc := GetProcAddress(libGLUT, 'glutDisplayFunc');
+  glutReshapeFunc := GetProcAddress(libGLUT, 'glutReshapeFunc');
+  glutTimerFunc := GetProcAddress(libGLUT, 'glutTimerFunc');
+  //glut := GetProcAddress(libGLUT, 'glut');
+
+  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.

+ 154 - 0
packages/opengl/old/glutdemo.pp

@@ -0,0 +1,154 @@
+{
+  GL units for Free Pascal - GLUT demo
+  1999 Sebastian Guenther, [email protected]
+
+  You may use this source as starting point for your own programs; consider it
+  as Public Domain.
+}
+
+
+{$MODE objfpc}
+{$H+}
+
+program GLUTDemo;
+uses GL, GLUT;
+
+const
+
+  FPCImg: array[0..4, 0..10] of Byte =
+    ((1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 1),
+     (1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0),
+     (1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0),
+     (1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0),
+     (1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1));
+
+var
+  counter: Integer;
+
+
+const
+  colors: array[0..7, 0..2] of Single =
+    ((0, 0, 0), (0, 0, 1), (0, 1, 0), (0, 1, 1),
+     (1, 0, 0), (1, 0, 1), (1, 1, 0), (1, 1, 1));
+  corners: array[0..7, 0..2] of Single =
+    ((-1, -1, -1), (+1, -1, -1), (+1, +1, -1), (-1, +1, -1),
+     (-1, -1, +1), (+1, -1, +1), (+1, +1, +1), (-1, +1, +1));
+
+
+procedure DrawCube;
+  procedure DrawSide(i1, i2, i3, i4: Integer);
+  begin
+    glColor4f (colors [i1, 0], colors [i1, 1], colors [i1, 2], 0.5);
+    glVertex3f(corners[i1, 0], corners[i1, 1], corners[i1, 2]);
+    glColor4f (colors [i2, 0], colors [i2, 1], colors [i2, 2], 0.5);
+    glVertex3f(corners[i2, 0], corners[i2, 1], corners[i2, 2]);
+    glColor4f (colors [i3, 0], colors [i3, 1], colors [i3, 2], 0.5);
+    glVertex3f(corners[i3, 0], corners[i3, 1], corners[i3, 2]);
+    
+    glVertex3f(corners[i4, 0], corners[i4, 1], corners[i4, 2]);
+  end;
+begin
+  glBegin(GL_QUADS);
+  DrawSide(4, 5, 6, 7);		// Front
+  DrawSide(3, 2, 1, 0);		// Back
+  DrawSide(2, 3, 7, 6);		// Top
+  DrawSide(0, 1, 5, 4);		// Bottom
+  DrawSide(4, 7, 3, 0);		// Left
+  DrawSide(1, 2, 6, 5);		// Right
+  glEnd;
+end;
+
+
+procedure DisplayWindow; cdecl;
+var
+  x, y: Integer;
+begin
+  Inc(counter);
+
+  glClearColor(0, 0, 0.2, 1);
+  glClear([GL_COLOR_BUFFER_BIT, GL_DEPTH_BUFFER_BIT]);
+
+  glPushMatrix;
+  glTranslatef(0, 0, Sin(Single(counter) / 20.0) * 5.0 - 5.0);
+  glRotatef(Sin(Single(counter) / 200.0) * 720.0, 0, 1, 0);
+  glRotatef(counter, 0, 0, 1);
+
+  for y := 0 to 4 do
+    for x := 0 to 10 do
+      if FPCImg[y, x] > 0 then begin
+        glPushMatrix;
+	glRotatef(x * Sin(Single(counter) / 5.0), 0, 1, 0);
+	glRotatef(y * Sin(Single(counter) / 12.0) * 4.0, 0, 0, 1);
+        glTranslatef((x - 5) * 1, (2 - y) * 1, 0);
+        glScalef(0.4, 0.4, 0.4);
+        glRotatef(counter, 0.5, 1, 0);
+        DrawCube;
+        glPopMatrix;
+      end;
+
+  glPopMatrix;
+
+  Inc(counter);
+
+  glutSwapBuffers;
+end;
+
+procedure OnTimer(value: Integer); cdecl;
+begin
+  glutPostRedisplay;
+  glutTimerFunc(20, @OnTimer, 0);
+end;
+
+begin
+
+  if not InitGl then begin
+    WriteLn('OpenGL is not supported on this system');
+    Halt(2);
+  end;
+
+  if not InitGLU then begin
+    WriteLn('Couldn''t load GLU module');
+    Halt(3);
+  end;
+
+  if not InitGLX then begin
+    WriteLn('Couldn''t load GLX module');
+    Halt(4);
+  end;
+
+  if not InitGLUT then begin
+    WriteLn('Couldn''t load GLUT module');
+    Halt(5);
+  end;
+
+  glutInitDisplayMode(GLUT_RGB or GLUT_DOUBLE or GLUT_DEPTH);
+  glutCreateWindow('Free Pascal  GLUT demo');
+  glutDisplayFunc(@DisplayWindow);
+  glutTimerFunc(20, @OnTimer, 0);
+
+
+  WriteLn('GL info:');
+  WriteLn('  Vendor: ', glGetString(GL_VENDOR));
+  WriteLn('  Renderer: ', glGetString(GL_RENDERER));
+  WriteLn('  Version: ', glGetString(GL_VERSION));
+  WriteLn('  Extensions: ', glGetString(GL_EXTENSIONS));
+
+  // Enable backface culling
+  glEnable(GL_CULL_FACE);
+
+  // Set up depth buffer
+  glEnable(GL_DEPTH_TEST);
+  glDepthFunc(GL_LESS);
+
+  // Set up projection matrix
+  glMatrixMode(GL_PROJECTION);
+  glLoadIdentity;
+  gluPerspective(90, 1.3, 0.1, 100);
+  glMatrixMode(GL_MODELVIEW);
+  glLoadIdentity;
+  glTranslatef(0, 0, -5.5);
+
+
+  glutMainLoop;
+
+end.

+ 129 - 0
packages/opengl/old/xlib.pp

@@ -0,0 +1,129 @@
+{
+  $Id$
+}
+
+{$MODE objfpc}
+{$LINKLIB X11}
+{$PACKRECORDS 4}
+
+unit xlib;
+
+interface
+
+type
+
+  XID = LongWord;
+  TVisualID = LongWord;
+  PDisplay = Pointer;
+  PVisual = Pointer;
+
+  PXVisualInfo = ^TXVisualInfo;
+  TXVisualInfo = record
+    visual: PVisual;
+    visualid: TVisualID;
+    screen, depth, c_class: LongInt;
+    red_mask, green_mask, blue_mask: LongWord;
+    colormap_size, bits_per_rgb: LongInt;
+  end;
+
+const
+  VisualNoMask			= 0;
+  VisualIDMask 			= 1;
+  VisualScreenMask		= 2;
+  VisualDepthMask		= 4;
+  VisualClassMask		= 8;
+  VisualRedMaskMask		= $10;
+  VisualGreenMaskMask		= $20;
+  VisualBlueMaskMask		= $40;
+  VisualColormapSizeMask	= $80;
+  VisualBitsPerRGBMask		= $100;
+  VisualAllMask			= $1FF;
+
+  
+
+  function DefaultScreen(dpy: PDisplay): LongInt;
+
+
+  function XFree(data: Pointer): LongInt; cdecl;
+  function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl;
+  function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl;
+
+
+implementation
+
+type
+  PXExtData = Pointer;
+  PXPrivate = Pointer;
+  XPointer = PChar;
+  PXrmHashBucketRec = Pointer;
+  PScreenFormat = Pointer;
+  PScreen = Pointer;
+
+  PXPrivDisplay = ^TXPrivDisplay;
+  TXPrivDisplay = record
+    ext_data: PXExtData;		// hook for extension to hang data
+    private1: PXPrivate;
+    fd: LongInt;			// Network socket.
+    private2: LongInt;
+    proto_major_version: LongInt;	// major version of server's X protocol
+    proto_minor_version: LongInt;	// minor version of server's X protocol
+    vendor: PChar;			// vendor of the server hardware
+    private3, private4, private5: XID;
+    private6: LongInt;
+    resource_alloc: Pointer;		// allocator function
+    byte_order: LongInt;		// screen byte order, LSBFirst, MSBFirst
+    bitmap_unit: LongInt;		// padding and data requirements
+    bitmap_pad: LongInt;		// padding requirements on bitmaps
+    bitmap_bit_order: LongInt;		// LeastSignificant or MostSignificant
+    nformats: LongInt;			// number of pixmap formats in list
+    pixmap_format: PScreenFormat;	// pixmap format list
+    private8: LongInt;
+    release: LongInt;			// release of the server
+    private9, private10: PXPrivate;
+    qlen: LongInt;			// Length of input event queue
+    last_request_read: LongWord;	// seq number of last event read
+    request: LongWord;			// sequence number of last request.
+    private11, private12, private13,
+      private14: XPointer;
+    max_request_size: LongWord;		// maximum number 32 bit words in request
+    db: PXrmHashBucketRec;
+    private15: Pointer;
+    display_name: PChar;		// "host:display" string used on this connect
+    default_screen: LongInt;		// default screen for operations
+    nscreens: LongInt;			// number of screens on this server
+    screens: PScreen;			// pointer to list of screens
+    motion_buffer: LongWord;		// size of motion buffer
+    private16: LongWord;
+    min_keycode: LongInt;		// minimum defined keycode
+    max_keycode: LongInt;		// maximum defined keycode
+    private17, private18: XPointer;
+    private19: LongInt;
+    xdefaults: PChar;			// contents of defaults from server
+    // there is more to this structure, but it is private to Xlib
+  end;
+
+
+
+function DefaultScreen(dpy: PDisplay): LongInt;
+begin
+  Result := PXPrivDisplay(dpy)^.default_screen;
+end;
+
+const
+  libX = 'X11';
+
+function XFree(data: Pointer): LongInt; cdecl; external libX;
+function XVisualIDFromVisual(visual: PVisual): TVisualID; cdecl; external libX;
+function XGetVisualInfo(display: PDisplay; vinfo_mask: LongWord; vinfo_template: PXVisualInfo; var nitems_return: LongInt): PXVisualInfo; cdecl; external libX;
+
+end.
+
+{
+  $Log$
+  Revision 1.1  1999-11-28 17:55:23  sg
+  * Added new unit generation tools and auto-generated GL units for Linux
+
+  Revision 1.1  1999/11/10 14:15:33  sg
+  * Added to CVS
+
+}