* reorganized, it now doesn't depend on fcl anymore by default

This commit is contained in:
peter 1999-12-23 13:51:50 +00:00
parent 1f6ce404a8
commit d85e3914a3
22 changed files with 8656 additions and 0 deletions

379
packages/opengl/Makefile Normal file
View File

@ -0,0 +1,379 @@
#
# Makefile generated by fpcmake v0.99.13 on 1999-12-23 14:38
#
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
# Compatibility with old makefiles
ifdef PP
export FPC=$(PP)
else
ifdef inOS2
export FPC=ppos2$(EXEEXT)
else
export FPC=ppc386$(EXEEXT)
endif
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 DIROBJECTS+=$(wildcard linux examples build)
# Clean
# Install
ZIPTARGET=install
# Defaults
# Directories
ifndef PACKAGEDIR
PACKAGEDIR=$(FPCDIR)/packages
endif
ifndef COMPONENTDIR
COMPONENTDIR=$(FPCDIR)/components
endif
# Packages
# Libraries
#####################################################################
# Standard rules
#####################################################################
all: $(addsuffix _all,$(OS_TARGET))
debug: $(addsuffix _debug,$(OS_TARGET))
test: $(addsuffix _test,$(OS_TARGET))
smart: $(addsuffix _smart,$(OS_TARGET))
shared: $(addsuffix _shared,$(OS_TARGET))
showinstall: $(addsuffix _showinstall,$(OS_TARGET))
install: $(addsuffix _install,$(OS_TARGET))
sourceinstall: $(addsuffix _sourceinstall,$(OS_TARGET))
zipinstall: $(addsuffix _zipinstall,$(OS_TARGET))
zipinstalladd: $(addsuffix _zipinstalladd,$(OS_TARGET))
clean: $(addsuffix _clean,$(DIROBJECTS))
cleanall: $(addsuffix _cleanall,$(DIROBJECTS))
depend: $(addsuffix _depend,$(DIROBJECTS))
.PHONY: all debug test smart shared showinstall install sourceinstall zipinstall zipinstalladd clean cleanall depend
#####################################################################
# Package depends
#####################################################################
ifneq ($(wildcard $(RTLDIR)),)
ifeq ($(wildcard $(RTLDIR)/$(FPCMADE)),)
override COMPILEPACKAGES+=rtl
rtl_package:
$(MAKE) -C $(RTLDIR) all
endif
endif
.PHONY: rtl_package
# Target Dirs
OBJECTDIRLINUX=1
OBJECTDIREXAMPLES=1
OBJECTDIRBUILD=1
# Dir linux
ifdef OBJECTDIRLINUX
.PHONY: linux_all linux_debug linux_examples linux_test linux_smart linux_shared linux_showinstall linux_install linux_sourceinstall linux_zipinstall linux_zipinstalladd linux_clean linux_cleanall linux_depend linux_info
linux_all:
$(MAKE) -C linux all
linux_debug:
$(MAKE) -C linux debug
linux_examples:
$(MAKE) -C linux examples
linux_test:
$(MAKE) -C linux test
linux_smart:
$(MAKE) -C linux smart
linux_shared:
$(MAKE) -C linux shared
linux_showinstall:
$(MAKE) -C linux showinstall
linux_install:
$(MAKE) -C linux install
linux_sourceinstall:
$(MAKE) -C linux sourceinstall
linux_zipinstall:
$(MAKE) -C linux zipinstall
linux_zipinstalladd:
$(MAKE) -C linux zipinstalladd
linux_clean:
$(MAKE) -C linux clean
linux_cleanall:
$(MAKE) -C linux cleanall
linux_depend:
$(MAKE) -C linux depend
linux_info:
$(MAKE) -C linux info
endif
# Dir examples
ifdef OBJECTDIREXAMPLES
.PHONY: examples_all examples_debug examples_examples examples_test examples_smart examples_shared examples_showinstall examples_install examples_sourceinstall examples_zipinstall examples_zipinstalladd examples_clean examples_cleanall examples_depend examples_info
examples_all:
$(MAKE) -C examples all
examples_debug:
$(MAKE) -C examples debug
examples_examples:
$(MAKE) -C examples examples
examples_test:
$(MAKE) -C examples test
examples_smart:
$(MAKE) -C examples smart
examples_shared:
$(MAKE) -C examples shared
examples_showinstall:
$(MAKE) -C examples showinstall
examples_install:
$(MAKE) -C examples install
examples_sourceinstall:
$(MAKE) -C examples sourceinstall
examples_zipinstall:
$(MAKE) -C examples zipinstall
examples_zipinstalladd:
$(MAKE) -C examples zipinstalladd
examples_clean:
$(MAKE) -C examples clean
examples_cleanall:
$(MAKE) -C examples cleanall
examples_depend:
$(MAKE) -C examples depend
examples_info:
$(MAKE) -C examples info
endif
# Dir build
ifdef OBJECTDIRBUILD
.PHONY: build_all build_debug build_examples build_test build_smart build_shared build_showinstall build_install build_sourceinstall build_zipinstall build_zipinstalladd build_clean build_cleanall build_depend build_info
build_all:
$(MAKE) -C build all
build_debug:
$(MAKE) -C build debug
build_examples:
$(MAKE) -C build examples
build_test:
$(MAKE) -C build test
build_smart:
$(MAKE) -C build smart
build_shared:
$(MAKE) -C build shared
build_showinstall:
$(MAKE) -C build showinstall
build_install:
$(MAKE) -C build install
build_sourceinstall:
$(MAKE) -C build sourceinstall
build_zipinstall:
$(MAKE) -C build zipinstall
build_zipinstalladd:
$(MAKE) -C build zipinstalladd
build_clean:
$(MAKE) -C build clean
build_cleanall:
$(MAKE) -C build cleanall
build_depend:
$(MAKE) -C build depend
build_info:
$(MAKE) -C build info
endif
#####################################################################
# Users rules
#####################################################################
.PHONY: examples
examples:
$(MAKE) examples_all

View File

@ -0,0 +1,20 @@
#
# Makefile.fpc for OpenGL for FPC
#
[targets]
dirs=linux examples build
[sections]
none=1
[defaults]
defaultbuilddir=$(OS_TARGET)
defaultinstalldir=$(OS_TARGET)
[rules]
.PHONY: examples
examples:
$(MAKE) examples_all

View File

@ -0,0 +1,994 @@
#
# Makefile generated by fpcmake v0.99.13 on 1999-12-23 14:38
#
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
# Compatibility with old makefiles
ifdef PP
export FPC=$(PP)
else
ifdef inOS2
export FPC=ppos2$(EXEEXT)
else
export FPC=ppc386$(EXEEXT)
endif
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 FPCDIR
FPCDIR=../../..
endif
ifndef PACKAGEDIR
PACKAGEDIR=$(FPCDIR)/packages
endif
ifndef COMPONENTDIR
COMPONENTDIR=$(FPCDIR)/components
endif
# Packages
override NEEDUNITDIR+=$(FPCDIR)/fcl/$(OS_TARGET)
# 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
override FPCDIR:=$(subst \,/,$(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 RTLDIR
override FPCOPT+=-Fu$(RTLDIR)
endif
ifdef UNITSDIR
override FPCOPT+=-Fu$(UNITSDIR)
endif
ifdef NEEDUNITDIR
override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
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
# For win32 the options are passed using the environment variable FPCEXTCMD
ifeq ($(OS_SOURCE),win32)
override FPCEXTCMD:=$(FPCOPT)
override FPCOPT:=!FPCEXTCMD
export FPCEXTCMD
endif
# Compiler commandline
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
#####################################################################
# 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=
FPCMADE=fpcmade
# Go32v1
ifeq ($(OS_TARGET),go32v1)
PPUEXT=.pp1
OEXT=.o1
ASMEXT=.s1
SMARTEXT=.sl1
STATICLIBEXT=.a1
SHAREDLIBEXT=.so1
PACKAGESUFFIX=v1
FPCMADE=fpcmade.v1
endif
# Go32v2
ifeq ($(OS_TARGET),go32v2)
PACKAGESUFFIX=go32
FPCMADE=fpcmade.dos
endif
# Linux
ifeq ($(OS_TARGET),linux)
PACKAGESUFFIX=linux
FPCMADE=fpcmade.lnx
endif
# Win32
ifeq ($(OS_TARGET),win32)
PPUEXT=.ppw
OEXT=.ow
ASMEXT=.sw
SMARTEXT=.slw
STATICLIBEXT=.aw
SHAREDLIBEXT=.dll
PACKAGESUFFIX=win32
FPCMADE=fpcmade.w32
endif
# OS/2
ifeq ($(OS_TARGET),os2)
PPUEXT=.ppo
ASMEXT=.so2
OEXT=.oo2
SMARTEXT=.so
STATICLIBEXT=.ao2
SHAREDLIBEXT=.dll
PACKAGESUFFIX=os2
FPCMADE=fpcmade.os2
endif
# library prefix
LIBPREFIX=lib
ifeq ($(OS_TARGET),go32v2)
LIBPREFIX=
endif
ifeq ($(OS_TARGET),go32v1)
LIBPREFIX=
endif
# determine which .pas extension is used
ifndef PASEXT
ifdef EXEOBJECTS
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
else
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
endif
ifeq ($(TESTPAS),)
PASEXT=.pp
else
PASEXT=.pas
endif
endif
#####################################################################
# 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)/$(FPCMADE)),)
override COMPILEPACKAGES+=rtl
rtl_package:
$(MAKE) -C $(RTLDIR) all
endif
endif
ifneq ($(wildcard $(FCLDIR)),)
ifeq ($(wildcard $(FCLDIR)/$(FPCMADE)),)
override COMPILEPACKAGES+=fcl
fcl_package:
$(MAKE) -C $(FCLDIR) all
endif
endif
.PHONY: rtl_package fcl_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
$(FPCMADE):
@$(ECHO) Compiled > $(FPCMADE)
fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
$(addsuffix _component,$(COMPILECOMPONENTS)) \
$(ALLTARGET) $(FPCMADE)
fpc_debug:
$(MAKE) all DEBUG=1
# General compile rules, available for both possible PASEXT
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
%$(PPUEXT): %.pp
$(COMPILER) $< $(REDIR)
$(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:=$(wildcard $(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:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
endif
endif
fpc_clean: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
ifdef CLEANPPUFILES
-$(DEL) $(CLEANPPUFILES)
endif
ifneq ($(CLEANPPULINKFILES),)
-$(DEL) $(CLEANPPULINKFILES)
endif
ifdef EXTRACLEANFILES
-$(DEL) $(EXTRACLEANFILES)
endif
-$(DEL) $(FPCMADE) $(PPAS) link.res $(REDIRFILE)
fpc_cleanall: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DELTREE) *$(SMARTEXT)
-$(DEL) $(FPCMADE) $(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)

View File

@ -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.

View File

@ -0,0 +1,74 @@
{
$Id$
GL unit creation tool helpers
(c) 1999 Sebastian Guenther, sg@freepascal.org
}
{$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-12-23 13:51:50 peter
* reorganized, it now doesn't depend on fcl anymore by default
Revision 1.1 1999/11/28 17:55:22 sg
* Added new unit generation tools and auto-generated GL units for Linux
}

View File

@ -0,0 +1,172 @@
{
$Id$
GL unit creation tool for Linux dynamic version
(c) 1999 Sebastian Guenther, sg@freepascal.org
}
{$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
WriteLn('File Generator for OpenGL related Units');
// Load definition files
WriteLn('Loading 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
WriteLn('Generating GL unit for Linux...');
Assign(f, '../linux/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
WriteLn('Generating GLut unit for Linux...');
Assign(f, '../linux/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);
WriteLn('Done...');
end.
{
$Log$
Revision 1.1 1999-12-23 13:51:50 peter
* reorganized, it now doesn't depend on fcl anymore by default
Revision 1.2 1999/12/01 00:55:44 alex
Added info prints so that we know how far the program worked.
Revision 1.1 1999/11/28 17:55:22 sg
* Added new unit generation tools and auto-generated GL units for Linux
}

1037
packages/opengl/build/gl.def Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -0,0 +1,13 @@
#
# Makefile.fpc for auto generation of OpenGL units
#
[targets]
units=buildgl
programs=c_linuxd
[packages]
fcl=1
[dirs]
fpcdir=../../..

View File

@ -0,0 +1,985 @@
#
# Makefile generated by fpcmake v0.99.13 on 1999-12-23 14:38
#
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
# Compatibility with old makefiles
ifdef PP
export FPC=$(PP)
else
ifdef inOS2
export FPC=ppos2$(EXEEXT)
else
export FPC=ppc386$(EXEEXT)
endif
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 FPCDIR
FPCDIR=../../..
endif
ifndef PACKAGEDIR
PACKAGEDIR=$(FPCDIR)/packages
endif
ifndef COMPONENTDIR
COMPONENTDIR=$(FPCDIR)/components
endif
override NEEDUNITDIR=../$(OS_TARGET)
# Packages
# Libraries
override NEEDOTHERLIB=1
# 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
override FPCDIR:=$(subst \,/,$(FPCDIR))
ifneq ($(FPCDIR),.)
override RTLDIR=$(FPCDIR)/rtl/$(OS_TARGET)
override FCLDIR=$(FPCDIR)/fcl/$(OS_TARGET)
override UNITSDIR=$(FPCDIR)/units/$(OS_TARGET)
endif
endif
# Where to find other libraries
ifdef inlinux
ifndef OTHERLIBDIR
export OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
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 RTLDIR
override FPCOPT+=-Fu$(RTLDIR)
endif
ifdef UNITSDIR
override FPCOPT+=-Fu$(UNITSDIR)
endif
ifdef NEEDUNITDIR
override FPCOPT+=$(addprefix -Fu,$(NEEDUNITDIR))
endif
# Add Other dirs path if asked
ifdef OTHERLIBDIR
override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
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
# For win32 the options are passed using the environment variable FPCEXTCMD
ifeq ($(OS_SOURCE),win32)
override FPCEXTCMD:=$(FPCOPT)
override FPCOPT:=!FPCEXTCMD
export FPCEXTCMD
endif
# Compiler commandline
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
#####################################################################
# 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=
FPCMADE=fpcmade
# Go32v1
ifeq ($(OS_TARGET),go32v1)
PPUEXT=.pp1
OEXT=.o1
ASMEXT=.s1
SMARTEXT=.sl1
STATICLIBEXT=.a1
SHAREDLIBEXT=.so1
PACKAGESUFFIX=v1
FPCMADE=fpcmade.v1
endif
# Go32v2
ifeq ($(OS_TARGET),go32v2)
PACKAGESUFFIX=go32
FPCMADE=fpcmade.dos
endif
# Linux
ifeq ($(OS_TARGET),linux)
PACKAGESUFFIX=linux
FPCMADE=fpcmade.lnx
endif
# Win32
ifeq ($(OS_TARGET),win32)
PPUEXT=.ppw
OEXT=.ow
ASMEXT=.sw
SMARTEXT=.slw
STATICLIBEXT=.aw
SHAREDLIBEXT=.dll
PACKAGESUFFIX=win32
FPCMADE=fpcmade.w32
endif
# OS/2
ifeq ($(OS_TARGET),os2)
PPUEXT=.ppo
ASMEXT=.so2
OEXT=.oo2
SMARTEXT=.so
STATICLIBEXT=.ao2
SHAREDLIBEXT=.dll
PACKAGESUFFIX=os2
FPCMADE=fpcmade.os2
endif
# library prefix
LIBPREFIX=lib
ifeq ($(OS_TARGET),go32v2)
LIBPREFIX=
endif
ifeq ($(OS_TARGET),go32v1)
LIBPREFIX=
endif
# determine which .pas extension is used
ifndef PASEXT
ifdef EXEOBJECTS
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
else
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
endif
ifeq ($(TESTPAS),)
PASEXT=.pp
else
PASEXT=.pas
endif
endif
#####################################################################
# 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)/$(FPCMADE)),)
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
$(FPCMADE):
@$(ECHO) Compiled > $(FPCMADE)
fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
$(addsuffix _component,$(COMPILECOMPONENTS)) \
$(ALLTARGET) $(FPCMADE)
fpc_debug:
$(MAKE) all DEBUG=1
# General compile rules, available for both possible PASEXT
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
%$(PPUEXT): %.pp
$(COMPILER) $< $(REDIR)
$(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:=$(wildcard $(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:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
endif
endif
fpc_clean: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
ifdef CLEANPPUFILES
-$(DEL) $(CLEANPPUFILES)
endif
ifneq ($(CLEANPPULINKFILES),)
-$(DEL) $(CLEANPPULINKFILES)
endif
ifdef EXTRACLEANFILES
-$(DEL) $(EXTRACLEANFILES)
endif
-$(DEL) $(FPCMADE) $(PPAS) link.res $(REDIRFILE)
fpc_cleanall: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DELTREE) *$(SMARTEXT)
-$(DEL) $(FPCMADE) $(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)

View File

@ -0,0 +1,13 @@
#
# Makefile.fpc for GL demos
#
[targets]
programs=glutdemo
[dirs]
fpcdir=../../..
unitdir=../$(OS_TARGET)
[libs]
libother=1

View File

@ -0,0 +1,154 @@
{
GL units for Free Pascal - GLUT demo
1999 Sebastian Guenther, sguenther@gmx.de
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.

View File

@ -0,0 +1,966 @@
#
# Makefile generated by fpcmake v0.99.13 on 1999-12-23 14:38
#
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
# Compatibility with old makefiles
ifdef PP
export FPC=$(PP)
else
ifdef inOS2
export FPC=ppos2$(EXEEXT)
else
export FPC=ppc386$(EXEEXT)
endif
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 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
override FPCDIR:=$(subst \,/,$(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 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
# For win32 the options are passed using the environment variable FPCEXTCMD
ifeq ($(OS_SOURCE),win32)
override FPCEXTCMD:=$(FPCOPT)
override FPCOPT:=!FPCEXTCMD
export FPCEXTCMD
endif
# Compiler commandline
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
#####################################################################
# 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=
FPCMADE=fpcmade
# Go32v1
ifeq ($(OS_TARGET),go32v1)
PPUEXT=.pp1
OEXT=.o1
ASMEXT=.s1
SMARTEXT=.sl1
STATICLIBEXT=.a1
SHAREDLIBEXT=.so1
PACKAGESUFFIX=v1
FPCMADE=fpcmade.v1
endif
# Go32v2
ifeq ($(OS_TARGET),go32v2)
PACKAGESUFFIX=go32
FPCMADE=fpcmade.dos
endif
# Linux
ifeq ($(OS_TARGET),linux)
PACKAGESUFFIX=linux
FPCMADE=fpcmade.lnx
endif
# Win32
ifeq ($(OS_TARGET),win32)
PPUEXT=.ppw
OEXT=.ow
ASMEXT=.sw
SMARTEXT=.slw
STATICLIBEXT=.aw
SHAREDLIBEXT=.dll
PACKAGESUFFIX=win32
FPCMADE=fpcmade.w32
endif
# OS/2
ifeq ($(OS_TARGET),os2)
PPUEXT=.ppo
ASMEXT=.so2
OEXT=.oo2
SMARTEXT=.so
STATICLIBEXT=.ao2
SHAREDLIBEXT=.dll
PACKAGESUFFIX=os2
FPCMADE=fpcmade.os2
endif
# library prefix
LIBPREFIX=lib
ifeq ($(OS_TARGET),go32v2)
LIBPREFIX=
endif
ifeq ($(OS_TARGET),go32v1)
LIBPREFIX=
endif
# determine which .pas extension is used
ifndef PASEXT
ifdef EXEOBJECTS
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(EXEOBJECTS)))))
else
override TESTPAS:=$(strip $(wildcard $(addsuffix .pas,$(firstword $(UNITOBJECTS)))))
endif
ifeq ($(TESTPAS),)
PASEXT=.pp
else
PASEXT=.pas
endif
endif
#####################################################################
# 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)/$(FPCMADE)),)
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
$(FPCMADE):
@$(ECHO) Compiled > $(FPCMADE)
fpc_all: $(addsuffix _package,$(COMPILEPACKAGES)) \
$(addsuffix _component,$(COMPILECOMPONENTS)) \
$(ALLTARGET) $(FPCMADE)
fpc_debug:
$(MAKE) all DEBUG=1
# General compile rules, available for both possible PASEXT
.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
%$(PPUEXT): %.pp
$(COMPILER) $< $(REDIR)
$(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:=$(wildcard $(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:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)))
endif
endif
fpc_clean: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
ifdef CLEANPPUFILES
-$(DEL) $(CLEANPPUFILES)
endif
ifneq ($(CLEANPPULINKFILES),)
-$(DEL) $(CLEANPPULINKFILES)
endif
ifdef EXTRACLEANFILES
-$(DEL) $(EXTRACLEANFILES)
endif
-$(DEL) $(FPCMADE) $(PPAS) link.res $(REDIRFILE)
fpc_cleanall: $(CLEANTARGET)
ifdef CLEANEXEFILES
-$(DEL) $(CLEANEXEFILES)
endif
-$(DEL) *$(OEXT) *$(PPUEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
-$(DELTREE) *$(SMARTEXT)
-$(DEL) $(FPCMADE) $(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)

View File

@ -0,0 +1,9 @@
#
# Makefile.fpc for Linux dynamic GL units
#
[targets]
units=xlib gl glut
[dirs]
fpcdir=../../..

2147
packages/opengl/linux/gl.pp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -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-12-23 13:51:50 peter
* reorganized, it now doesn't depend on fcl anymore by default
}

View File

@ -0,0 +1,135 @@
{
$Id$
}
unit xlib;
{$MODE objfpc}
{$LINKLIB c}
{$LINKLIB X11}
{$PACKRECORDS C}
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-12-23 13:51:50 peter
* reorganized, it now doesn't depend on fcl anymore by default
Revision 1.1 1999/11/28 17:55:22 sg
* Added new unit generation tools and auto-generated GL units for Linux
Revision 1.1 1999/11/10 14:15:33 sg
* Added to CVS
}