Index: Makefile.iossim =================================================================== --- Makefile.iossim (.../vendor/lablgl/1.04) (revision 0) +++ Makefile.iossim (.../trunk/lablgles) (revision 709) @@ -0,0 +1,4 @@ +# Shortcut to make for iOS Simulator +all preinstall install real-install clean lib libopt: + cp Makefile.config.iossim Makefile.config + $(MAKE) $@ Index: LablGLES.xcodeproj/project.pbxproj =================================================================== --- LablGLES.xcodeproj/project.pbxproj (.../vendor/lablgl/1.04) (revision 0) +++ LablGLES.xcodeproj/project.pbxproj (.../trunk/lablgles) (revision 709) @@ -0,0 +1,257 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXFileReference section */ + 1AA22D92157A9B7D00FA0ADB /* CHANGES */ = {isa = PBXFileReference; lastKnownFileType = text; path = CHANGES; sourceTree = ""; }; + 1AA22D93157A9B7D00FA0ADB /* COPYRIGHT */ = {isa = PBXFileReference; lastKnownFileType = text; path = COPYRIGHT; sourceTree = ""; }; + 1AA22D94157A9B7D00FA0ADB /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 1AA22D95157A9B7D00FA0ADB /* Makefile.common */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.common; sourceTree = ""; }; + 1AA22D97157A9B7D00FA0ADB /* Makefile.config.ios */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.config.ios; sourceTree = ""; }; + 1AA22D98157A9B7D00FA0ADB /* Makefile.ios */ = {isa = PBXFileReference; lastKnownFileType = text; path = Makefile.ios; sourceTree = ""; }; + 1AA22D9A157A9B7D00FA0ADB /* README */ = {isa = PBXFileReference; lastKnownFileType = text; path = README; sourceTree = ""; }; + 1AA22D9F157A9B7D00FA0ADB /* build.ml.in */ = {isa = PBXFileReference; lastKnownFileType = text; path = build.ml.in; sourceTree = ""; }; + 1AA22DA4157A9B7D00FA0ADB /* gl.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = gl.ml; sourceTree = ""; }; + 1AA22DA5157A9B7D00FA0ADB /* gl.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = gl.mli; sourceTree = ""; }; + 1AA22DA9157A9B7D00FA0ADB /* gl_tags.var */ = {isa = PBXFileReference; lastKnownFileType = text; path = gl_tags.var; sourceTree = ""; }; + 1AA22DAD157A9B7D00FA0ADB /* glArray.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glArray.ml; sourceTree = ""; }; + 1AA22DAE157A9B7D00FA0ADB /* glArray.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glArray.mli; sourceTree = ""; }; + 1AA22DB3157A9B7D00FA0ADB /* glClear.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glClear.ml; sourceTree = ""; }; + 1AA22DB4157A9B7D00FA0ADB /* glClear.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glClear.mli; sourceTree = ""; }; + 1AA22DB9157A9B7D00FA0ADB /* glDraw.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glDraw.ml; sourceTree = ""; }; + 1AA22DBA157A9B7D00FA0ADB /* glDraw.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glDraw.mli; sourceTree = ""; }; + 1AA22DBF157A9B7D00FA0ADB /* glFramebuffer.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glFramebuffer.ml; sourceTree = ""; }; + 1AA22DC0157A9B7D00FA0ADB /* glFramebuffer.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glFramebuffer.mli; sourceTree = ""; }; + 1AA22DC5157A9B7D00FA0ADB /* glFunc.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glFunc.ml; sourceTree = ""; }; + 1AA22DC6157A9B7D00FA0ADB /* glFunc.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glFunc.mli; sourceTree = ""; }; + 1AA22DCB157A9B7D00FA0ADB /* glLight.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glLight.ml; sourceTree = ""; }; + 1AA22DCC157A9B7D00FA0ADB /* glLight.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glLight.mli; sourceTree = ""; }; + 1AA22DD1157A9B7D00FA0ADB /* glMat.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glMat.ml; sourceTree = ""; }; + 1AA22DD2157A9B7D00FA0ADB /* glMat.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glMat.mli; sourceTree = ""; }; + 1AA22DD7157A9B7D00FA0ADB /* glMisc.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glMisc.ml; sourceTree = ""; }; + 1AA22DD8157A9B7D00FA0ADB /* glMisc.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glMisc.mli; sourceTree = ""; }; + 1AA22DDD157A9B7D00FA0ADB /* glPix.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glPix.ml; sourceTree = ""; }; + 1AA22DDE157A9B7D00FA0ADB /* glPix.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glPix.mli; sourceTree = ""; }; + 1AA22DE3157A9B7D00FA0ADB /* glTex.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = glTex.ml; sourceTree = ""; }; + 1AA22DE4157A9B7D00FA0ADB /* glTex.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = glTex.mli; sourceTree = ""; }; + 1AA22DEA157A9B7D00FA0ADB /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; path = Makefile; sourceTree = ""; }; + 1AA22DEB157A9B7D00FA0ADB /* ml_gl.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ml_gl.c; sourceTree = ""; }; + 1AA22DEC157A9B7D00FA0ADB /* ml_gl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ml_gl.h; sourceTree = ""; }; + 1AA22DEE157A9B7D00FA0ADB /* ml_glarray.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ml_glarray.c; sourceTree = ""; }; + 1AA22DF0157A9B7D00FA0ADB /* ml_glframe.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ml_glframe.c; sourceTree = ""; }; + 1AA22DF2157A9B7D00FA0ADB /* ml_raw.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = ml_raw.c; sourceTree = ""; }; + 1AA22DF3157A9B7D00FA0ADB /* ml_raw.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ml_raw.h; sourceTree = ""; }; + 1AA22DF8157A9B7D00FA0ADB /* raw.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = raw.ml; sourceTree = ""; }; + 1AA22DF9157A9B7D00FA0ADB /* raw.mli */ = {isa = PBXFileReference; lastKnownFileType = text; path = raw.mli; sourceTree = ""; }; + 1AA22DFC157A9B7D00FA0ADB /* raw_tags.var */ = {isa = PBXFileReference; lastKnownFileType = text; path = raw_tags.var; sourceTree = ""; }; + 1AA22E01157A9B7D00FA0ADB /* var2def.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = var2def.ml; sourceTree = ""; }; + 1AA22E05157A9B7D00FA0ADB /* var2switch.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = var2switch.ml; sourceTree = ""; }; + 1AA22E07157A9B7D00FA0ADB /* varcheck.ml */ = {isa = PBXFileReference; lastKnownFileType = text; path = varcheck.ml; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXGroup section */ + 1A4FCEFD157A98A4008F8191 = { + isa = PBXGroup; + children = ( + 1AA22D92157A9B7D00FA0ADB /* CHANGES */, + 1AA22D93157A9B7D00FA0ADB /* COPYRIGHT */, + 1AA22D94157A9B7D00FA0ADB /* Makefile */, + 1AA22D95157A9B7D00FA0ADB /* Makefile.common */, + 1AA22D97157A9B7D00FA0ADB /* Makefile.config.ios */, + 1AA22D98157A9B7D00FA0ADB /* Makefile.ios */, + 1AA22D9A157A9B7D00FA0ADB /* README */, + 1AA22D9B157A9B7D00FA0ADB /* src */, + ); + sourceTree = ""; + }; + 1AA22D9B157A9B7D00FA0ADB /* src */ = { + isa = PBXGroup; + children = ( + 1AA22D9F157A9B7D00FA0ADB /* build.ml.in */, + 1AA22DA4157A9B7D00FA0ADB /* gl.ml */, + 1AA22DA5157A9B7D00FA0ADB /* gl.mli */, + 1AA22DA9157A9B7D00FA0ADB /* gl_tags.var */, + 1AA22DAD157A9B7D00FA0ADB /* glArray.ml */, + 1AA22DAE157A9B7D00FA0ADB /* glArray.mli */, + 1AA22DB3157A9B7D00FA0ADB /* glClear.ml */, + 1AA22DB4157A9B7D00FA0ADB /* glClear.mli */, + 1AA22DB9157A9B7D00FA0ADB /* glDraw.ml */, + 1AA22DBA157A9B7D00FA0ADB /* glDraw.mli */, + 1AA22DBF157A9B7D00FA0ADB /* glFramebuffer.ml */, + 1AA22DC0157A9B7D00FA0ADB /* glFramebuffer.mli */, + 1AA22DC5157A9B7D00FA0ADB /* glFunc.ml */, + 1AA22DC6157A9B7D00FA0ADB /* glFunc.mli */, + 1AA22DCB157A9B7D00FA0ADB /* glLight.ml */, + 1AA22DCC157A9B7D00FA0ADB /* glLight.mli */, + 1AA22DD1157A9B7D00FA0ADB /* glMat.ml */, + 1AA22DD2157A9B7D00FA0ADB /* glMat.mli */, + 1AA22DD7157A9B7D00FA0ADB /* glMisc.ml */, + 1AA22DD8157A9B7D00FA0ADB /* glMisc.mli */, + 1AA22DDD157A9B7D00FA0ADB /* glPix.ml */, + 1AA22DDE157A9B7D00FA0ADB /* glPix.mli */, + 1AA22DE3157A9B7D00FA0ADB /* glTex.ml */, + 1AA22DE4157A9B7D00FA0ADB /* glTex.mli */, + 1AA22DEA157A9B7D00FA0ADB /* Makefile */, + 1AA22DEB157A9B7D00FA0ADB /* ml_gl.c */, + 1AA22DEC157A9B7D00FA0ADB /* ml_gl.h */, + 1AA22DEE157A9B7D00FA0ADB /* ml_glarray.c */, + 1AA22DF0157A9B7D00FA0ADB /* ml_glframe.c */, + 1AA22DF2157A9B7D00FA0ADB /* ml_raw.c */, + 1AA22DF3157A9B7D00FA0ADB /* ml_raw.h */, + 1AA22DF8157A9B7D00FA0ADB /* raw.ml */, + 1AA22DF9157A9B7D00FA0ADB /* raw.mli */, + 1AA22DFC157A9B7D00FA0ADB /* raw_tags.var */, + 1AA22E01157A9B7D00FA0ADB /* var2def.ml */, + 1AA22E05157A9B7D00FA0ADB /* var2switch.ml */, + 1AA22E07157A9B7D00FA0ADB /* varcheck.ml */, + ); + path = src; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXLegacyTarget section */ + 1AA22E30157A9C4B00FA0ADB /* LablGLES */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "-f Makefile.ios $(ACTION)"; + buildConfigurationList = 1AA22E31157A9C4B00FA0ADB /* Build configuration list for PBXLegacyTarget "LablGLES" */; + buildPhases = ( + ); + buildToolPath = /usr/bin/make; + buildWorkingDirectory = ""; + dependencies = ( + ); + name = LablGLES; + passBuildSettingsInEnvironment = 1; + productName = LablGLES; + }; +/* End PBXLegacyTarget section */ + +/* Begin PBXProject section */ + 1A4FCEFF157A98A4008F8191 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 1A4FCF02157A98A4008F8191 /* Build configuration list for PBXProject "LablGLES" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 1A4FCEFD157A98A4008F8191; + productRefGroup = 1A4FCEFD157A98A4008F8191; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1AA22E30157A9C4B00FA0ADB /* LablGLES */, + ); + }; +/* End PBXProject section */ + +/* Begin XCBuildConfiguration section */ + 1A4FCF13157A98A5008F8191 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = armv6; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1A4FCF14157A98A5008F8191 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = armv6; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_THUMB_SUPPORT = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 1AA22E32157A9C4B00FA0ADB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUGGING_SYMBOLS = YES; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1AA22E33157A9C4B00FA0ADB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1A4FCF02157A98A4008F8191 /* Build configuration list for PBXProject "LablGLES" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A4FCF13157A98A5008F8191 /* Debug */, + 1A4FCF14157A98A5008F8191 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1AA22E31157A9C4B00FA0ADB /* Build configuration list for PBXLegacyTarget "LablGLES" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1AA22E32157A9C4B00FA0ADB /* Debug */, + 1AA22E33157A9C4B00FA0ADB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1A4FCEFF157A98A4008F8191 /* Project object */; +} Property changes on: LablGLES.xcodeproj ___________________________________________________________________ Added: svn:ignore + xcuserdata project.xcworkspace Index: Makefile.config.iossim =================================================================== --- Makefile.config.iossim (.../vendor/lablgl/1.04) (revision 0) +++ Makefile.config.iossim (.../trunk/lablgles) (revision 709) @@ -0,0 +1,89 @@ +# LablGL and Togl configuration file +# +# Please have a look at the config/Makefile in the Objective Caml distribution, +# or at the labltklink script to get the information needed here +# + +##### Adjust these always + +# Uncomment if you have the fast ".opt" compilers +#CAMLC = ocamlc.opt +#CAMLOPT = ocamlopt.opt + +# Compiling setup for iPhone/iPad Simulator +# +OCAMLBINDIR=/usr/local/ocamlxsim/bin +SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator5.1.sdk +CAMLC=$(OCAMLBINDIR)/ocamlc +CAMLOPT=$(OCAMLBINDIR)/ocamlopt +CAMLP4O=$(OCAMLBINDIR)/camlp4o +CSDKOPTS = \ + -ccopt -arch\ + -ccopt i386\ + -ccopt -isysroot\ + -ccopt $(SDK)\ + -ccopt -D__IPHONE_OS_VERSION_MIN_REQUIRED=30100 +COMPILER=$(CAMLC) -c $(CSDKOPTS) +OPTCOMP=$(CAMLOPT) -c $(CSDKOPTS) +LIBRARIAN=$(OCAMLBINDIR)/ocamlmklib -ldopt -Wl,-syslibroot,$(SDK) +VAR2DEF=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2def +VAR2SWITCH=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2switch + +# Where to put the lablgl script +#BINDIR = /usr/local/bin + +# Where to find X headers +#XINCLUDES = -I/usr/X11R6/include +# X libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lX11 -lXi + +# Where to find Tcl/Tk headers +# This must the same version as for LablTk +#TKINCLUDES = -I/usr/local/include +# Tcl/Tk libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#TKLIBS = -L/usr/local/lib -ltk84 -ltcl84 + +# Where to find OpenGL/Mesa/Glut headers and libraries +GLINCLUDES = +GLLIBS = -framework OpenGLES +#GLUTLIBS = -lglut +# The following libraries may be required (try to add them one at a time) +#GLLIBS = -lGL -lGLU -lXmu -lXext -lXi -lcipher -lpthread + +# How to index a library after installing (ranlib required on MacOSX) +#RANLIB = : +RANLIB = ranlib + +##### Uncomment these for windows +#TKLIBS = tk83.lib tcl83.lib gdi32.lib user32.lib +#GLLIBS = opengl32.lib glu32.lib +#TOOLCHAIN = msvc +#XA = .lib +#XB = .bat +#XE = .exe +#XO = .obj +#XS = .dll + +##### Adjust these if non standard + +# The Objective Caml library directory +#LIBDIR = `ocamlc -where` + +# Where to put dlls (if dynamic loading available) +#DLLDIR = `ocamlc -where`/stublibs + +# Install in work tree +DLLDIR = `pwd`/release + +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES + +# Install in work tree +INSTALLDIR = `pwd`/release + +# Where is Togl (default) +#TOGLDIR = Togl + +# C Compiler options +#COPTS = -c -O +COPTS = -DCONFIG_IOSSIM -c -O -isysroot $(SDK) Index: ESVERSION =================================================================== --- ESVERSION (.../vendor/lablgl/1.04) (revision 0) +++ ESVERSION (.../trunk/lablgles) (revision 709) @@ -0,0 +1 @@ +1.1.14 Index: src/glMap.mli =================================================================== --- src/glMap.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glMap.mli (.../trunk/lablgles) (revision 709) @@ -1,39 +0,0 @@ -(* $Id: glMap.mli,v 1.3 2000/04/12 07:40:24 garrigue Exp $ *) - -type target = - [ `vertex_3 - | `vertex_4 - | `index - | `color_4 - | `normal - | `texture_coord_1 - | `texture_coord_2 - | `texture_coord_3 - | `texture_coord_4 ] -val map1 : - target:target -> float * float -> order:int -> [`double] Raw.t -> unit - (* [map1 :target (u1,u2) :order points] defines a 1-dimensional map. - [order] is the number of control points in [points] *) -val map2 : - target:target -> - float * float -> - order:int -> float * float -> order:int -> [`double] Raw.t -> unit - (* [map1 :target (u1,u2) order:uorder (v1,v2) order:vorder points] - defines a 2-dimensional map. - The number of control points in [points] is [uorder*vorder] *) - -val eval_coord1 : float -> unit -val eval_coord2 : float -> float -> unit - (* Evaluate the maps at given coordinates *) - -val grid1 : n:int -> range:float * float -> unit -val grid2 : - n1:int -> range1:float * float -> n2:int -> range2:float * float -> unit - (* Define 1- and 2-dimensional meshes to the maps *) - -val eval_mesh1 : mode:[`line|`point] -> range:(int * int) -> unit -val eval_mesh2 : - mode:[`fill|`line|`point] -> range1:(int * int) -> range2:(int * int) -> unit -val eval_point1 : int -> unit -val eval_point2 : int -> int -> unit - (* Evaluate meshes at given coordinates *) Index: src/gluQuadric.mli =================================================================== --- src/gluQuadric.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gluQuadric.mli (.../trunk/lablgles) (revision 709) @@ -1,30 +0,0 @@ -(* $Id: gluQuadric.mli,v 1.2 1999/11/15 14:32:14 garrigue Exp $ *) - -type t - -val create : unit -> t - -(* If you omit the quadric, a new one will be created *) - -val cylinder : - base:float -> top:float -> - height:float -> slices:int -> stacks:int -> ?quad:t -> unit -> unit - -val disk : - inner:float -> outer:float -> - slices:int -> loops:int -> ?quad:t -> unit -> unit - -val partial_disk : - inner:float -> - outer:float -> - slices:int -> - loops:int -> start:float -> sweep:float -> ?quad:t -> unit -> unit - -val sphere : - radius:float -> slices:int -> stacks:int -> ?quad:t -> unit -> unit - - -val draw_style : t -> [`fill|`line|`point|`silhouette] -> unit -val normals : t -> [`flat|`none|`smooth] -> unit -val orientation : t -> [`inside|`outside] -> unit -val texture : t -> bool -> unit Index: src/gluMisc.mli =================================================================== --- src/gluMisc.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gluMisc.mli (.../trunk/lablgles) (revision 709) @@ -1,15 +0,0 @@ -(* $Id: gluMisc.mli,v 1.3 2001/10/01 02:59:13 garrigue Exp $ *) - -open Gl - -val get_string : [`extensions|`version] -> string - -val build_1d_mipmaps : - ?internal:int -> ([< GlTex.format], [< kind]) GlPix.t -> unit - -val build_2d_mipmaps : - ?internal:int -> ([< GlTex.format], [< kind]) GlPix.t -> unit - -val scale_image : - width:int -> height:int -> - ([< format] as 'a, [< kind] as 'b) GlPix.t -> ('a, 'b) GlPix.t Index: src/glu_tags.var =================================================================== --- src/glu_tags.var (.../vendor/lablgl/1.04) (revision 709) +++ src/glu_tags.var (.../trunk/lablgles) (revision 709) @@ -1,38 +0,0 @@ -(* $Id: glu_tags.var,v 1.5 2002/05/01 03:35:00 garrigue Exp $: tags for GLU library *) - -(* gluGetString *) -version extensions - -(* gluNextContour *) -exterior interior unknown ccw cw - -(* gluNurbsProperty *) -sampling_method path_length parametric_error domain_distance -sampling_tolerance -parametric_tolerance -u_step v_step -display_mode fill -culling auto_load_matrix -polygon -> GLU_OUTLINE_POLYGON -patch -> GLU_OUTLINE_PATCH - -(* gluQuadricDrawStyle *) -line silhouette point -(* gluQuadricNormals *) -none flat smooth -(* gluQuadricOrientation *) -inside outside - -(* gluTessProperty *) -winding_rule -> GLU_TESS_WINDING_RULE -odd -> GLU_TESS_WINDING_ODD -nonzero -> GLU_TESS_WINDING_NONZERO -positive -> GLU_TESS_WINDING_POSITIVE -negative -> GLU_TESS_WINDING_NEGATIVE -abs_geq_two -> GLU_TESS_WINDING_ABS_GEQ_TWO -boundary_only -> GLU_TESS_BOUNDARY_ONLY -tolerance -> GLU_TESS_TOLERANCE - -$$ -(* gluNurbsCurve *) -trim_2 trim_3 Index: src/gluTess.ml =================================================================== --- src/gluTess.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gluTess.ml (.../trunk/lablgles) (revision 709) @@ -1,18 +0,0 @@ -(* $Id: gluTess.ml,v 1.7 2004/07/13 07:55:18 garrigue Exp $ *) -(* Code contributed by Jon Harrop *) - -type winding_rule = [`odd|`nonzero|`positive|`negative|`abs_geq_two] - -type vertices = (float * float * float) list - -external tesselate : - ?winding:winding_rule -> ?boundary_only:bool -> ?tolerance:float -> - vertices list -> unit - = "ml_gluTesselate" - -type triangles = - { singles: vertices list; strips: vertices list; fans: vertices list } - -external tesselate_and_return : - ?winding:winding_rule -> ?tolerance:float -> vertices list -> triangles - = "ml_gluTesselateAndReturn" Index: src/ml_glu.c =================================================================== --- src/ml_glu.c (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_glu.c (.../trunk/lablgles) (revision 709) @@ -1,307 +0,0 @@ -/* $Id: ml_glu.c,v 1.28 2004/11/02 07:03:34 garrigue Exp $ */ - -#ifdef _WIN32 -#include -#endif -#ifdef __APPLE__ -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "gl_tags.h" -#include "glu_tags.h" -#include "ml_gl.h" -#include "ml_glu.h" - -GLenum GLUenum_val(value tag) -{ - switch(tag) - { -#include "glu_tags.c" - } - ml_raise_gl ("Unknown GLU tag"); -} - -/* Does not register the structure with Caml ! -static value Val_addr (void *addr) -{ - value wrapper; - if (!addr) ml_raise_gl ("Bad address"); - wrapper = alloc(1,No_scan_tag); - Field(wrapper,0) = (value) addr; - return wrapper; -} -*/ - -#define Nurb_val(struc) ((GLUnurbsObj *) Field(struc,1)) -#define Quad_val(struc) ((GLUquadricObj *) Field(struc,1)) - -#define Store_addr(struc, addr) Field(struc,1) = (value) addr - - -#define ML_final(cname) \ -static void ml_##cname (value struc) \ -{ cname ((GLvoid *) Field(struc,1)); } - -ML_final (gluDeleteNurbsRenderer) -ML_final (gluDeleteQuadric) - -/* Called from ML */ - -ML_1 (gluBeginCurve, Nurb_val) -ML_1 (gluBeginSurface, Nurb_val) -ML_1 (gluBeginTrim, Nurb_val) - -CAMLprim value ml_gluBuild1DMipmaps (value internal, value width, - value format, value data) -{ - GLenum error; - - error = gluBuild1DMipmaps (GL_TEXTURE_1D, Int_val(internal), - Int_val(width), GLenum_val(format), - Type_raw(data), Void_raw(data)); - if (error) ml_raise_gl((char*)gluErrorString(error)); - return Val_unit; -} - -CAMLprim value ml_gluBuild2DMipmaps (value internal, value width, value height, - value format, value data) -{ - GLint error; - - error = gluBuild2DMipmaps (GL_TEXTURE_2D, Int_val(internal), - Int_val(width), Int_val(height), - GLenum_val(format), - Type_raw(data), Void_raw(data)); - if (error) ml_raise_gl((char*)gluErrorString(error)); - return Val_unit; -} - -ML_6 (gluCylinder, Quad_val, Double_val, Double_val, Double_val, - Int_val, Int_val) -ML_bc6 (ml_gluCylinder) - -ML_5 (gluDisk, Quad_val, Double_val, Double_val, Int_val, Int_val) - -ML_1 (gluEndCurve, Nurb_val) -ML_1 (gluEndSurface, Nurb_val) -ML_1 (gluEndTrim, Nurb_val) - -ML_1_ (gluGetString, GLUenum_val, copy_string_check) - -ML_4 (gluLoadSamplingMatrices, Nurb_val, Float_raw, Float_raw, (GLint*)Int_raw) -ML_3 (gluLookAt, Triple(arg1,Double_val,Double_val,Double_val), - Triple(arg2,Double_val,Double_val,Double_val), - Triple(arg3,Double_val,Double_val,Double_val)) - -CAMLprim value ml_gluNewNurbsRenderer (void) -{ - value struc = alloc_final (2, ml_gluDeleteNurbsRenderer, 1, 32); - Store_addr(struc, gluNewNurbsRenderer()); - return struc; -} - -CAMLprim value ml_gluNewQuadric (void) -{ - value struc = alloc_final (2, ml_gluDeleteQuadric, 1, 32); - Store_addr(struc, gluNewQuadric()); - return struc; -} - -#define Fsize_raw(raw) (Int_val(Size_raw(raw))/sizeof(GLfloat)) - -CAMLprim value ml_gluNurbsCurve (value nurb, value knots, value control, - value order, value type) -{ - GLenum targ = 0U; - int ustride = 0; - - switch (type) { - case MLTAG_vertex_3: - targ = GL_MAP1_VERTEX_3; ustride = 3; break; - case MLTAG_vertex_4: - targ = GL_MAP1_VERTEX_4; ustride = 4; break; - case MLTAG_index: - targ = GL_MAP1_INDEX; ustride = 1; break; - case MLTAG_color_4: - targ = GL_MAP1_COLOR_4; ustride = 4; break; - case MLTAG_normal: - targ = GL_MAP1_NORMAL; ustride = 3; break; - case MLTAG_texture_coord_1: - targ = GL_MAP1_TEXTURE_COORD_1; ustride = 1; break; - case MLTAG_texture_coord_2: - targ = GL_MAP1_TEXTURE_COORD_2; ustride = 2; break; - case MLTAG_texture_coord_3: - targ = GL_MAP1_TEXTURE_COORD_3; ustride = 3; break; - case MLTAG_texture_coord_4: - targ = GL_MAP1_TEXTURE_COORD_4; ustride = 4; break; - case MLTAG_trim_2: - targ = GLU_MAP1_TRIM_2; ustride = 2; break; - case MLTAG_trim_3: - targ = GLU_MAP1_TRIM_3; ustride = 3; break; - } - gluNurbsCurve (Nurb_val(nurb), Fsize_raw(knots), Float_raw(knots), - ustride, Float_raw(control), Int_val(order), targ); - return Val_unit; -} - -CAMLprim value ml_gluNurbsProperty (value nurb, value prop) -{ - GLfloat val; - GLenum property = GLUenum_val (Field(prop,0)); - - switch (property) { - case GLU_SAMPLING_METHOD: - case GLU_DISPLAY_MODE: - val = GLUenum_val (Field(prop,1)); - break; - case GLU_PARAMETRIC_TOLERANCE: - val = Float_val (Field(prop,1)); - break; - default: - val = Int_val (Field(prop,1)); - break; - } - gluNurbsProperty (Nurb_val(nurb), property, val); - return Val_unit; -} - -CAMLprim value ml_gluNurbsSurface (value nurb, value sKnots, value tKnots, - value tStride, value control, value sOrder, - value tOrder, value tag) -{ - GLenum type = 0U; - GLint sStride = 0; - - switch (tag) { - case MLTAG_vertex_3: - type = GL_MAP2_VERTEX_3; sStride = 3; break; - case MLTAG_vertex_4: - type = GL_MAP2_VERTEX_4; sStride = 4; break; - case MLTAG_index: - type = GL_MAP2_INDEX; sStride = 1; break; - case MLTAG_color_4: - type = GL_MAP2_COLOR_4; sStride = 4; break; - case MLTAG_normal: - type = GL_MAP2_NORMAL; sStride = 3; break; - case MLTAG_texture_coord_1: - type = GL_MAP2_TEXTURE_COORD_1; sStride = 1; break; - case MLTAG_texture_coord_2: - type = GL_MAP2_TEXTURE_COORD_2; sStride = 2; break; - case MLTAG_texture_coord_3: - type = GL_MAP2_TEXTURE_COORD_3; sStride = 3; break; - case MLTAG_texture_coord_4: - type = GL_MAP2_TEXTURE_COORD_4; sStride = 4; break; - } - gluNurbsSurface (Nurb_val(nurb), Fsize_raw(sKnots), Float_raw(sKnots), - Fsize_raw(tKnots), Float_raw(tKnots), sStride, - Int_val(tStride), Float_raw(control), - Int_val(sOrder), Int_val(tOrder), type); - return Val_unit; -} - -ML_bc8 (ml_gluNurbsSurface) - -ML_4 (gluOrtho2D, Double_val, Double_val, Double_val, Double_val) - -ML_7 (gluPartialDisk, Quad_val, Double_val, Double_val, Int_val, Int_val, - Double_val, Double_val) -ML_bc7 (ml_gluPartialDisk) -ML_4 (gluPerspective, Double_val, Double_val, Double_val, Double_val) - -CAMLprim value ml_gluPickMatrix (value x, value y, value delX, value delY) -{ - GLint viewport[4]; - - glGetIntegerv (GL_VIEWPORT, viewport); - gluPickMatrix (Double_val(x), Double_val(y), Double_val(delX), - Double_val(delY), viewport); - return Val_unit; -} - -CAMLprim value ml_gluProject (value object) -{ - CAMLparam0(); - GLdouble model[16]; - GLdouble proj[16]; - GLint viewport[4]; - GLdouble winX, winY, winZ; - CAMLlocal3(win0, win1, win2); - value win; - - glGetDoublev (GL_MODELVIEW_MATRIX, model); - glGetDoublev (GL_PROJECTION_MATRIX, proj); - glGetIntegerv (GL_VIEWPORT, viewport); - gluProject (Double_val(Field(object,0)), Double_val(Field(object,1)), - Double_val(Field(object,2)), model, proj, viewport, - &winX, &winY, &winZ); - win0 = copy_double(winX); - win1 = copy_double(winY); - win2 = copy_double(winZ); - win = alloc_small(3, 0); - Field(win,0) = win0; - Field(win,1) = win1; - Field(win,2) = win2; - CAMLreturn(win); -} - -CAMLprim value ml_gluPwlCurve (value nurbs, value count, value data, value tag) -{ - GLenum type = 0U; - GLint stride = 0; - - switch (tag) { - case MLTAG_trim_2: - type = GLU_MAP1_TRIM_2; stride = 2; break; - case MLTAG_trim_3: - type = GLU_MAP1_TRIM_3; stride = 3; break; - } - gluPwlCurve (Nurb_val(nurbs), Int_val(count), Float_raw(data), - stride, type); - return Val_unit; -} - -ML_2 (gluQuadricDrawStyle, Quad_val, GLUenum_val) -ML_2 (gluQuadricNormals, Quad_val, GLUenum_val) -ML_2 (gluQuadricOrientation, Quad_val, GLUenum_val) -ML_2 (gluQuadricTexture, Quad_val, Int_val) - -ML_7 (gluScaleImage, GLenum_val, Int_val, Int_val, - Split(arg4,Type_raw,Void_raw), Int_val, Int_val, - Split(arg7,Type_raw,Void_raw)) -ML_bc7 (ml_gluScaleImage) -ML_4 (gluSphere, Quad_val, Double_val, Int_val, Int_val) - -CAMLprim value ml_gluUnProject (value win) -{ - CAMLparam0(); - GLdouble model[16]; - GLdouble proj[16]; - GLint viewport[4]; - GLdouble objX, objY, objZ; - GLint ok; - CAMLlocal3(obj0,obj1,obj2); - value obj; - - glGetDoublev (GL_MODELVIEW_MATRIX, model); - glGetDoublev (GL_PROJECTION_MATRIX, proj); - glGetIntegerv (GL_VIEWPORT, viewport); - ok = gluUnProject (Double_val(Field(win,0)), Double_val(Field(win,1)), - Double_val(Field(win,2)), model, proj, viewport, - &objX, &objY, &objZ); - if (!ok) ml_raise_gl ("Glu.unproject : point out of window"); - obj0 = copy_double(objX); - obj1 = copy_double(objY); - obj2 = copy_double(objZ); - obj = alloc_small (3, 0); - Field(obj,0) = obj0; - Field(obj,1) = obj1; - Field(obj,2) = obj2; - CAMLreturn(obj); -} Index: src/ml_glu.h =================================================================== --- src/ml_glu.h (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_glu.h (.../trunk/lablgles) (revision 709) @@ -1,17 +0,0 @@ -#ifndef _ml_glu_ -#define _ml_glu_ - -GLenum GLUenum_val(value tag); - -#if !defined(GLU_VERSION_1_2) && !defined(GLU_TESS_WINDING_RULE) -#define GLU_TESS_WINDING_RULE -#define GLU_TESS_WINDING_ODD -#define GLU_TESS_WINDING_NONZERO -#define GLU_TESS_WINDING_POSITIVE -#define GLU_TESS_WINDING_NEGATIVE -#define GLU_TESS_WINDING_ABS_GEQ_TWO -#define GLU_TESS_BOUNDARY_ONLY -#define GLU_TESS_TOLERANCE -#endif - -#endif Index: src/gluQuadric.ml =================================================================== --- src/gluQuadric.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gluQuadric.ml (.../trunk/lablgles) (revision 709) @@ -1,40 +0,0 @@ -(* $Id: gluQuadric.ml,v 1.5 2000/04/12 07:40:26 garrigue Exp $ *) - -type t - -external create : unit -> t = "ml_gluNewQuadric" - -external cylinder : - t -> base:float -> top:float -> height:float -> - slices:int -> stacks:int -> unit - = "ml_gluCylinder_bc" "ml_gluCylinder" -let cylinder ~base ~top ~height ~slices ~stacks ?(quad = create ()) () = - cylinder ~base ~top ~height ~slices ~stacks quad - -external disk : - t -> inner:float -> outer:float -> slices:int -> loops:int -> unit - = "ml_gluDisk" -let disk ~inner ~outer ~slices ~loops ?(quad = create ()) () = - disk ~inner ~outer ~slices ~loops quad - -external partial_disk : - t -> inner:float -> outer:float -> - slices:int -> loops:int -> start:float -> sweep:float -> unit - = "ml_gluPartialDisk_bc" "ml_gluPartialDisk" -let partial_disk ~inner ~outer ~slices ~loops ~start ~sweep - ?(quad = create ()) () = - partial_disk ~inner ~outer ~slices ~loops ~start ~sweep quad - -external draw_style : t -> [`fill|`line|`silhouette|`point] -> unit - = "ml_gluQuadricDrawStyle" -external normals : t -> [`none|`flat|`smooth] -> unit - = "ml_gluQuadricNormals" -external orientation : t -> [`inside|`outside] -> unit - = "ml_gluQuadricOrientation" -external texture : t -> bool -> unit - = "ml_gluQuadricTexture" - -external sphere : t -> radius:float -> slices:int -> stacks:int -> unit - = "ml_gluSphere" -let sphere ~radius ~slices ~stacks ?(quad = create ()) () = - sphere ~radius ~slices ~stacks quad Index: src/glMap.ml =================================================================== --- src/glMap.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glMap.ml (.../trunk/lablgles) (revision 709) @@ -1,38 +0,0 @@ -(* $Id: glMap.ml,v 1.4 2008/01/10 05:50:37 garrigue Exp $ *) - -external eval_coord1 : float -> unit = "ml_glEvalCoord1d" -external eval_coord2 : float -> float -> unit = "ml_glEvalCoord2d" -external eval_mesh1 : mode:[`point|`line] -> int -> int -> unit - = "ml_glEvalMesh1" -let eval_mesh1 ~mode ~range:(u1,u2) = eval_mesh1 ~mode u1 u2 -external eval_mesh2 : - mode:[`point|`line|`fill] -> int -> int -> int -> int -> unit - = "ml_glEvalMesh2" -let eval_mesh2 ~mode ~range1:(u1,u2) ~range2:(v1,v2) = - eval_mesh2 ~mode u1 u2 v1 v2 -external eval_point1 : int -> unit = "ml_glEvalPoint1" -external eval_point2 : int -> int -> unit = "ml_glEvalPoint2" - -type target = - [ `vertex_3 - | `vertex_4 - | `index - | `color_4 - | `normal - | `texture_coord_1 - | `texture_coord_2 - | `texture_coord_3 - | `texture_coord_4 ] -external map1 : - target:target -> (float*float) -> order:int -> [`double] Raw.t -> unit - = "ml_glMap1d" -external map2 : - target:target -> (float*float) -> order:int -> - (float*float) -> order:int -> [`double] Raw.t -> unit - = "ml_glMap2d_bc" "ml_glMap2d" -external grid1 : n:int -> range:(float * float) -> unit - = "ml_glMapGrid1d" -external grid2 : - n1:int -> range1:(float * float) -> - n2:int -> range2:(float * float) -> unit - = "ml_glMapGrid2d" Index: src/gluNurbs.ml =================================================================== --- src/gluNurbs.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gluNurbs.ml (.../trunk/lablgles) (revision 709) @@ -1,77 +0,0 @@ -(* $Id: gluNurbs.ml,v 1.6 2001/10/01 02:59:13 garrigue Exp $ *) - -open Gl - -type t - -external begin_curve : t -> unit = "ml_gluBeginCurve" -external begin_surface : t -> unit = "ml_gluBeginSurface" -external begin_trim : t -> unit = "ml_gluBeginTrim" - -external end_curve : t -> unit = "ml_gluEndCurve" -external end_surface : t -> unit = "ml_gluEndSurface" -external end_trim : t -> unit = "ml_gluEndTrim" - -external load_sampling_matrices : - t -> model:[`float] Raw.t -> - persp:[`float] Raw.t -> view:[`int] Raw.t -> unit - = "ml_gluLoadSamplingMatrices" - -external create : unit -> t = "ml_gluNewNurbsRenderer" - -external curve : - t -> knots:[`float] Raw.t -> control:[`float] Raw.t -> - order:int -> kind:[< GlMap.target] -> unit - = "ml_gluNurbsCurve" -let curve nurb ~knots ~control ~order ~kind:t = - let arity = target_size t in - if (Array.length knots - order) * arity <> Array.length control - then invalid_arg "GluNurbs.curve"; - let knots = Raw.of_float_array ~kind:`float knots - and control = Raw.of_float_array ~kind:`float control in - curve nurb ~knots ~control ~order ~kind:t - -type property = [ - `sampling_method of [`path_length|`parametric_error|`domain_distance] - | `sampling_tolerance of int - | `parametric_tolerance of float - | `u_step of int - | `v_step of int - | `display_mode of [`fill|`polygon|`patch] - | `culling of bool - | `auto_load_matrix of bool -] -external property : t -> property -> unit - = "ml_gluNurbsProperty" - -external surface : - t -> sknots:[`float] Raw.t -> tknots:[`float] Raw.t -> - tstride:int -> control:[`float] Raw.t -> - sorder:int -> torder:int -> target:[< target] -> unit - = "ml_gluNurbsSurface_bc" "ml_gluNurbsSurface" -let surface t ~sknots ~tknots ~control ~sorder ~torder ~target = - let cl = Array.length control in - if cl = 0 then invalid_arg "GluNurb.curve"; - let tstride = Array.length control.(0) in - let sl = Array.length sknots and tl = Array.length tknots in - if tl <> cl + torder or (sl - sorder) * target_size target <> tstride - then invalid_arg "GluNurb.curve"; - let sknots = Raw.of_float_array ~kind:`float sknots in - let tknots = Raw.of_float_array ~kind:`float tknots in - let co = Raw.create `float ~len:(cl * tstride) in - for i = 0 to cl - 1 do - if Array.length control.(i) <> tstride then invalid_arg "GluNurb.curve"; - Raw.sets_float co ~pos:(i*tstride) control.(i) - done; - surface t ~sknots ~tknots ~tstride ~control:co - ~sorder ~torder ~target - -external pwl_curve : - t -> count:int -> [`float] Raw.t -> kind:[`trim_2|`trim_3] -> unit - = "ml_gluPwlCurve" -let pwl_curve nurb ~kind:t data = - let len = Array.length data - and raw = Raw.of_float_array ~kind:`float data - and stride = match t with `trim_2 -> 2 | `trim_3 -> 3 in - if len mod stride <> 0 then invalid_arg "GluNurb.pwl_curve"; - pwl_curve nurb ~count:(len/stride) raw ~kind:t Index: src/glList.mli =================================================================== --- src/glList.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glList.mli (.../trunk/lablgles) (revision 709) @@ -1,30 +0,0 @@ -(* $Id: glList.mli,v 1.4 2000/04/03 02:57:41 garrigue Exp $ *) - -type t - -val create : [`compile|`compile_and_execute] -> t - (* [create mode] creates a new display list in given mode. - It is equivalent to - [let base = gen_lists len:1 in begins (nth base pos:0)] *) -val ends : unit -> unit - (* glEndList: end a display list started by create or begins *) -val call : t -> unit -val delete : t -> unit - -type base - -val nth : base -> pos:int -> t - (* [nth base :pos] returns the index of the list at base+pos *) -val is_list : t -> bool - (* [is_list l] is true if l indexes a display list *) -val gen_lists : len:int -> base - (* Generate len new display lists. They are indexed by - [nth base pos:0] to [nth base pos:(len-1)] *) -val begins : t -> mode:[`compile|`compile_and_execute] -> unit - (* glNewList: start the definition of a display list in given mode *) -val delete_lists : base -> len:int -> unit - (* Delete len lists starting at base *) -val call_lists : ?base:base -> [ `byte of string | `int of int array] -> unit - (* Call the lists whose indexes are given either by a string - (code of each character) or an array. - If the base is omited, the base given in a previous call is assumed *) Index: src/gluNurbs.mli =================================================================== --- src/gluNurbs.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gluNurbs.mli (.../trunk/lablgles) (revision 709) @@ -1,42 +0,0 @@ -(* $Id: gluNurbs.mli,v 1.5 2001/10/01 02:59:13 garrigue Exp $ *) - -type t - -val create : unit -> t - -val begin_curve : t -> unit -val begin_surface : t -> unit -val begin_trim : t -> unit - -val end_curve : t -> unit -val end_surface : t -> unit -val end_trim : t -> unit - -val load_sampling_matrices : - t -> - model:[`float] Raw.t -> persp:[`float] Raw.t -> view:[`int] Raw.t -> unit - -val curve : - t -> knots:float array -> - control:float array -> order:int -> kind:[< GlMap.target] -> unit - -val pwl_curve : t -> kind:[`trim_2|`trim_3] -> float array -> unit - -val surface : - t -> - sknots:float array -> - tknots:float array -> - control:float array array -> - sorder:int -> torder:int -> target:[< Gl.target] -> unit - -type property = [ - `sampling_method of [`path_length|`parametric_error|`domain_distance] - | `sampling_tolerance of int - | `parametric_tolerance of float - | `u_step of int - | `v_step of int - | `display_mode of [`fill|`polygon|`patch] - | `culling of bool - | `auto_load_matrix of bool -] -val property : t -> property -> unit Index: src/ml_glutess.c =================================================================== --- src/ml_glutess.c (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_glutess.c (.../trunk/lablgles) (revision 709) @@ -1,230 +0,0 @@ -/* $Id: ml_glutess.c,v 1.7 2008/02/25 01:52:20 garrigue Exp $ */ -/* Code contributed by Jon Harrop */ - -#include -#include -#ifdef _WIN32 -#include -#endif -#ifdef __APPLE__ -#include -#include -#else -#include -#include -#endif -#include -#include -#include -#include -#include "gl_tags.h" -#include "glu_tags.h" -#include "ml_gl.h" -#include "ml_glu.h" - -#ifndef GLU_VERSION_1_2 -#define ML_fail(cname) \ -CAMLprim value ml_##cname (value any) \ -{ ml_raise_gl ("Function not available: "#cname); } -ML_fail (gluTesselate) -ML_fail (gluTesselateAndReturn) - -#else - -/* Apparently this is used under Windows, according to the Red Book. */ -#ifndef CALLBACK -#define CALLBACK -#endif -#define AS_CB (GLvoid(CALLBACK *)()) - -static void CALLBACK errorCallback(GLenum error) -{ - ml_raise_gl((char*)gluErrorString(error)); -} - -typedef struct chunklist -{ - struct chunklist *next; - int current; - int size; - GLdouble data[32][3]; -} chunklist; - -static chunklist *rootchunk=NULL; - -static GLdouble *new_vertex(GLdouble x, GLdouble y, GLdouble z) -{ - GLdouble *vert; - if (rootchunk == NULL || rootchunk->current >= rootchunk->size) { - chunklist *tmp = rootchunk; - rootchunk = (chunklist*)malloc(sizeof(chunklist)); - rootchunk->next = tmp; - rootchunk->current = 0; - rootchunk->size = 32; - } - vert = rootchunk->data[rootchunk->current++]; - vert[0] = x; - vert[1] = y; - vert[2] = z; - return vert; -} - -static void free_chunks() -{ - while (rootchunk != NULL) { - chunklist *next = rootchunk->next; - free(rootchunk); - rootchunk = next; - } -} - -static void CALLBACK combineCallback(GLdouble coords[3], - GLdouble *vertex_data[4], - GLfloat weight[4], - GLdouble **data) -{ - *data = new_vertex(coords[0],coords[1],coords[2]); -} - -/* prim is only valid during callbacks */ -static value *prim; -static int kind = 0; - -static void push_vert(value root, double x, double y, double z) -{ - CAMLparam1(root); - CAMLlocal4(vert, xx, yy, zz); - value cons; - xx = copy_double(x); yy = copy_double(y); zz = copy_double(z); - vert = alloc_tuple(3); - Field(vert,0) = xx; - Field(vert,1) = yy; - Field(vert,2) = zz; - cons = alloc_tuple(2); - Field(cons, 0) = vert; - Field(cons, 1) = Field(root,0); - modify(&Field(root,0), cons); - CAMLreturn0; -} - -static void push_list() -{ - value cons = alloc_tuple(2); - Field(cons,0) = Val_unit; - Field(cons,1) = Field(*prim,kind); - modify(&Field(*prim,kind), cons); -} - -static void CALLBACK beginCallback(GLenum type) -{ - switch (type) - { - case GL_TRIANGLES : kind = 0; break; - case GL_TRIANGLE_FAN : kind = 1; break; - case GL_TRIANGLE_STRIP : kind = 2; break; - default: { - char msg[80]; - sprintf(msg, "Unknown primitive format %d in tesselation.\n", (int)type); - ml_raise_gl(msg); - } - } - push_list(); -} - -static void CALLBACK vertexCallback(void *vertex_data) -{ - GLdouble *verts=(GLdouble *)vertex_data; - push_vert(Field(*prim,kind), verts[0], verts[1], verts[2]); -} - -static void CALLBACK endCallback() -{ - kind = 0; -} - -static GLUtesselator *tobj=NULL; - - -static void iniTesselator(value winding, value by_only, value tolerance) -{ - if (!tobj) { - tobj=gluNewTess(); - if (!tobj) ml_raise_gl("Failed to initialise the GLU tesselator."); - } - gluTessNormal(tobj, 0.0, 0.0, 1.0); - gluTessProperty(tobj, GLU_TESS_WINDING_RULE, - (winding != Val_unit ? GLUenum_val(Field(winding,0)) - : GLU_TESS_WINDING_ODD)); - gluTessProperty(tobj, GLU_TESS_BOUNDARY_ONLY, - (by_only != Val_unit && Field(by_only,0) != Val_unit)); - gluTessProperty(tobj, GLU_TESS_TOLERANCE, - (tolerance != Val_unit ? Float_val(Field(by_only,0)) : 0)); -} - -static void runTesselator(value contours) -{ - CAMLparam1(contours); - - gluTessBeginPolygon(tobj, NULL); - while (contours != Val_int(0)) { - value contour=Field(contours, 0); - gluTessBeginContour(tobj); - while (contour != Val_int(0)) { - value v=Field(contour, 0); - GLdouble *r = - new_vertex(Double_val(Field(v, 0)), - Double_val(Field(v, 1)), - Double_val(Field(v, 2))); - gluTessVertex(tobj, r, (void *)r); - contour = Field(contour, 1); - } - contours = Field(contours, 1); - gluTessEndContour(tobj); - } - gluTessEndPolygon(tobj); - - gluDeleteTess(tobj); - tobj = NULL; - free_chunks(); - CAMLreturn0; -} - -CAMLprim value ml_gluTesselateAndReturn(value winding, value tolerance, - value contours) -{ - CAMLparam1(contours); - CAMLlocal1(res); - - res = alloc_tuple(3); - Field(res,0) = Field(res,1) = Field(res,2) = Val_unit; - prim = &res; - - iniTesselator(winding, Val_unit, tolerance); - gluTessCallback(tobj, GLU_TESS_BEGIN, AS_CB beginCallback); - gluTessCallback(tobj, GLU_TESS_VERTEX, AS_CB vertexCallback); - gluTessCallback(tobj, GLU_TESS_END, AS_CB endCallback); - gluTessCallback(tobj, GLU_TESS_ERROR, AS_CB errorCallback); - gluTessCallback(tobj, GLU_TESS_COMBINE, AS_CB combineCallback); - - runTesselator(contours); - - CAMLreturn (res); -} - -CAMLprim value ml_gluTesselate (value winding, value by_only, - value tolerance, value contours) -{ - iniTesselator(winding, by_only, tolerance); - - gluTessCallback(tobj, GLU_TESS_BEGIN, AS_CB glBegin); - gluTessCallback(tobj, GLU_TESS_VERTEX, AS_CB glVertex3dv); - gluTessCallback(tobj, GLU_TESS_END, AS_CB glEnd); - gluTessCallback(tobj, GLU_TESS_ERROR, AS_CB errorCallback); - gluTessCallback(tobj, GLU_TESS_COMBINE, AS_CB combineCallback); - - runTesselator(contours); - - return Val_unit; -} - -#endif Index: src/gluMat.ml =================================================================== --- src/gluMat.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gluMat.ml (.../trunk/lablgles) (revision 709) @@ -1,28 +0,0 @@ -(* $Id: gluMat.ml,v 1.2 2000/04/12 07:40:25 garrigue Exp $ *) - -open Gl - -external look_at : - eye:(float * float * float) -> - center:(float * float * float) -> - up:(float * float * float) -> unit - = "ml_gluLookAt" - -external ortho2d : - left:float -> right:float -> bottom:float -> top:float -> unit - = "ml_gluOrtho2D" -let ortho2d ~x:(left,right) ~y:(bottom,top) = - ortho2d ~left ~right ~bottom ~top - -external perspective : - fovy:float -> aspect:float -> znear:float -> zfar:float -> unit - = "ml_gluPerspective" -let perspective ~fovy ~aspect ~z:(znear,zfar) = - perspective ~fovy ~aspect ~znear ~zfar - -external pick_matrix : - x:float -> y:float -> width:float -> height:float -> unit - = "ml_gluPickMatrix" - -external project : point3 -> point3 = "ml_gluProject" -external unproject : point3 -> point3 = "ml_gluUnProject" Index: src/glList.ml =================================================================== --- src/glList.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glList.ml (.../trunk/lablgles) (revision 709) @@ -1,29 +0,0 @@ -(* $Id: glList.ml,v 1.4 2000/04/12 07:40:24 garrigue Exp $ *) - -type t = int -type base = int - -external is_list : t -> bool = "ml_glIsList" -external gen_lists : len:int -> base = "ml_glGenLists" -external delete_lists : base -> len:int -> unit = "ml_glDeleteLists" -external begins : t -> mode:[`compile|`compile_and_execute] -> unit - = "ml_glNewList" -external ends : unit -> unit = "ml_glEndList" -external call : t -> unit = "ml_glCallList" -external call_lists : [ `byte of string | `int of int array] -> unit - = "ml_glCallLists" -external list_base : base -> unit = "ml_glListBase" - -let nth base ~pos = base + pos - -let create mode = - let l = gen_lists ~len:1 in begins l ~mode; l - -let delete l = - delete_lists l ~len:1 - -let call_lists ?base lists = - begin match base with None -> () - | Some base -> list_base base - end; - call_lists lists Index: src/gluTess.mli =================================================================== --- src/gluTess.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gluTess.mli (.../trunk/lablgles) (revision 709) @@ -1,20 +0,0 @@ -(* $Id: gluTess.mli,v 1.8 2004/07/13 09:44:03 garrigue Exp $ *) -(* Code contributed by Jon Harrop *) - -type winding_rule = [`odd|`nonzero|`positive|`negative|`abs_geq_two] - -type vertices = (float * float * float) list - -val tesselate : - ?winding:winding_rule -> ?boundary_only:bool -> ?tolerance:float -> - vertices list -> unit -(** Render directly to current screen. - Each [vertices] in the input is a contour in the single polygon - represented by [vertices list]. *) - -type triangles = - { singles: vertices list; strips: vertices list; fans: vertices list } - -val tesselate_and_return : - ?winding:winding_rule -> ?tolerance:float -> vertices list -> triangles -(** Return 3 lists of triangles instead of rendering directly *) Index: src/gluMat.mli =================================================================== --- src/gluMat.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gluMat.mli (.../trunk/lablgles) (revision 709) @@ -1,16 +0,0 @@ -(* $Id: gluMat.mli,v 1.1 1998/01/29 11:46:06 garrigue Exp $ *) - -open Gl - -val look_at : - eye:point3 -> center:point3 -> up:vect3 -> unit - -val ortho2d : x:float * float -> y:float * float -> unit - -val perspective : fovy:float -> aspect:float -> z:float * float -> unit - -val pick_matrix : - x:float -> y:float -> width:float -> height:float -> unit - -val project : point3 -> point3 -val unproject : point3 -> point3 Index: src/gluMisc.ml =================================================================== --- src/gluMisc.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gluMisc.ml (.../trunk/lablgles) (revision 709) @@ -1,38 +0,0 @@ -(* $Id: gluMisc.ml,v 1.6 2003/02/06 18:19:12 furuse Exp $ *) - -open Gl -open GlPix - -external build_1d_mipmaps : - internal:int -> - width:int -> format:[< GlTex.format] -> [< kind] Raw.t -> unit - = "ml_gluBuild1DMipmaps" -let build_1d_mipmaps ?internal:i img = - let internal = match i with None -> format_size (format img) | Some i -> i in - if height img < 1 then - raise (GLerror "GluMisc.build_1d_mipmaps : bad height"); - build_1d_mipmaps ~internal - ~width:(width img) ~format:(format img) (to_raw img) - -external build_2d_mipmaps : - internal:int -> width:int -> - height:int -> format:[< GlTex.format] -> [< kind] Raw.t -> unit - = "ml_gluBuild2DMipmaps" -let build_2d_mipmaps ?internal:i img = - let internal = match i with None -> format_size (format img) | Some i -> i in - build_2d_mipmaps ~internal - ~width:(width img) ~height:(height img) ~format:(format img) (to_raw img) - -external get_string : [`version|`extensions] -> string = "ml_gluGetString" - -external scale_image : - format:[< Gl.format] -> - w:int -> h:int -> data:[< kind] Raw.t -> - w:int -> h:int -> data:[< kind] Raw.t -> unit - = "ml_gluScaleImage_bc" "ml_gluScaleImage" -let scale_image ~width ~height img = - let k = Raw.kind (to_raw img) and format = format img in - let new_img = GlPix.create k ~format ~height ~width in - scale_image ~format ~w:(GlPix.width img) ~h:(GlPix.height img) - ~data:(to_raw img) ~w:width ~h:height ~data:(to_raw new_img); - new_img Index: src/ml_gl.h =================================================================== --- src/ml_gl.h (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_gl.h (.../trunk/lablgles) (revision 709) @@ -7,7 +7,9 @@ void ml_raise_gl (const char *errmsg) Noreturn; #define copy_string_check lablgl_copy_string_check -value copy_string_check (const char *str); +value copy_string_check (const unsigned char *str); +#define copy_string_lenient lablgl_copy_string_lenient +value copy_string_lenient (const unsigned char *str); GLenum GLenum_val (value); Index: src/glClear.ml =================================================================== --- src/glClear.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glClear.ml (.../trunk/lablgles) (revision 709) @@ -2,12 +2,7 @@ open Gl -external accum : float -> float -> float -> float -> unit - = "ml_glClearAccum" -let accum ?(alpha=1.) (r,g,b : rgb) = - accum r g b alpha - -type buffer = [`color|`depth|`accum|`stencil] +type buffer = [`color|`depth|`stencil] external clear : buffer list -> unit = "ml_glClear" external color : @@ -15,6 +10,5 @@ = "ml_glClearColor" let color ?(alpha=1.) (red, green, blue : rgb) = color ~red ~green ~blue ~alpha -external depth : clampf -> unit = "ml_glClearDepth" -external index : float -> unit = "ml_glClearIndex" +external depth : clampf -> unit = "ml_glClearDepthf" external stencil : int -> unit = "ml_glClearStencil" Index: src/glMat.mli =================================================================== --- src/glMat.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glMat.mli (.../trunk/lablgles) (revision 709) @@ -4,18 +4,16 @@ type t -val of_raw : [`double] Raw.t -> t -external to_raw : t -> [`double] Raw.t = "%identity" +val of_raw : [`float] Raw.t -> t +external to_raw : t -> [`float] Raw.t = "%identity" (* Those two functions are just the identity, and keep sharing. - [double] Raw.t is a raw array of 16 floating point values + [`float] Raw.t is a raw array of 16 floating point values representing as 4x4 matrix *) val of_array : float array array -> t val to_array : t -> float array array val load : t -> unit -val load_transpose : t -> unit val mult : t -> unit -val mult_transpose : t -> unit val load_identity : unit -> unit val push : unit -> unit Index: src/glMisc.ml =================================================================== --- src/glMisc.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glMisc.ml (.../trunk/lablgles) (revision 709) @@ -21,43 +21,15 @@ type equation = float * float * float * float external clip_plane : plane:int -> equation -> unit - = "ml_glClipPlane" + = "ml_glClipPlanef" let clip_plane ~plane equation = if plane < 0 or plane > 5 then invalid_arg "Gl.clip_plane"; clip_plane ~plane equation type hint_target = - [`fog|`line_smooth|`perspective_correction|`point_smooth|`polygon_smooth] + [`fog|`line_smooth|`perspective_correction|`point_smooth|`generate_mipmap] external hint : hint_target -> [`fastest|`nicest|`dont_care] -> unit = "ml_glHint" -external init_names : unit -> unit = "ml_glInitNames" -external load_name : int -> unit = "ml_glLoadName" -external pop_name : unit -> unit = "ml_glPopName" -external push_name : int -> unit = "ml_glPushName" - -external pop_attrib : unit -> unit = "ml_glPopAttrib" -type attrib = - [ `accum_buffer|`color_buffer|`current|`depth_buffer|`enable|`eval|`fog - | `hint|`lighting|`line|`list|`pixel_mode|`point|`polygon|`polygon_stipple - | `scissor|`stencil_buffer|`texture|`transform|`viewport ] -external push_attrib : attrib list -> unit = "ml_glPushAttrib" - -external pass_through : float -> unit = "ml_glPassThrough" -external render_mode : [`render|`select|`feedback] -> int = "ml_glRenderMode" -external select_buffer : int -> [`uint] Raw.t -> unit = "ml_glSelectBuffer" -let select_buffer raw = - if not (Raw.static raw) then - invalid_arg "GlMisc.select_buffer : buffer must be static"; - select_buffer (Raw.length raw) raw -type feedback_mode = - [`_2d |`_3d |`_3d_color |`_3d_color_texture |`_4d_color_texture] -external feedback_buffer : int -> feedback_mode -> [`float] Raw.t -> unit - = "ml_glFeedbackBuffer" -let feedback_buffer ~mode buf = - if not (Raw.static buf) then - invalid_arg "GlMisc.feedback_buffer : buffer must be static"; - feedback_buffer (Raw.length buf) mode buf - external scissor : x:int -> y:int -> width:int -> height:int -> unit = "ml_glScissor" Index: src/glFunc.ml =================================================================== --- src/glFunc.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glFunc.ml (.../trunk/lablgles) (revision 709) @@ -2,8 +2,6 @@ open Gl -external accum : op:[`accum|`load|`add|`mult|`return] -> float -> unit - = "ml_glAccum" external alpha_func : cmp_func -> ref:clampf -> unit = "ml_glAlphaFunc" type sfactor = [ @@ -36,25 +34,13 @@ external depth_func : cmp_func -> unit = "ml_glDepthFunc" external depth_mask : bool -> unit = "ml_glDepthMask" -external depth_range : near:float -> far:float -> unit = "ml_glDepthRange" +external depth_range : near:float -> far:float -> unit = "ml_glDepthRangef" -type draw_buffer = - [`none|`front_left|`front_right|`back_left|`back_right - |`front|`back|`left|`right|`front_and_back|`aux of int] -external draw_buffer : draw_buffer -> unit = "ml_glDrawBuffer" - -external index_mask : int -> unit = "ml_glIndexMask" - type logic_op = [`clear|`set|`copy|`copy_inverted|`noop|`invert|`And|`nand|`Or|`nor |`xor|`equiv|`and_reverse|`and_inverted|`or_reverse|`or_inverted] external logic_op : logic_op -> unit = "ml_glLogicOp" -type read_buffer = - [`front_left|`front_right|`back_left|`back_right|`front|`back - |`left|`right|`aux of int] -external read_buffer : read_buffer -> unit = "ml_glReadBuffer" - external stencil_func : cmp_func -> ref:int -> mask:int -> unit = "ml_glStencilFunc" external stencil_mask : int -> unit = "ml_glStencilMask" Index: src/ml_glframe.c =================================================================== --- src/ml_glframe.c (.../vendor/lablgl/1.04) (revision 0) +++ src/ml_glframe.c (.../trunk/lablgles) (revision 709) @@ -0,0 +1,357 @@ +/* ml_glframe.c Wrappers for framebuffer object extension + * + * http://khronos.org/registry/gles/extensions/OES/OES_framebuffer_object.txt + */ +#ifdef _WIN32 +#include +#endif +#include +#include +#include +#include +#include +#include +#ifdef __APPLE__ +#include +#include +#else +#include +#include +#endif +#include "ml_gl.h" +#include "gl_tags.h" + +#if GL_OES_framebuffer_object + +ML_1_ (glIsRenderbufferOES, (GLuint) Int32_val, Val_bool) +ML_2 (glBindRenderbufferOES, GLenum_val, (GLuint) Int32_val) + +CAMLprim value ml_glDeleteRenderbuffer(value rbid) +{ + GLuint id = Int32_val(rbid); + glDeleteRenderbuffersOES(1, &id); + return Val_unit; +} + +CAMLprim value ml_glGenRenderbuffer(value unit) +{ + GLuint id; + glGenRenderbuffersOES(1, &id); + return copy_int32(id); +} + +CAMLprim value ml_glRenderbufferStorageOES(value target, value internal, + value width, value height) +{ + /* We translate the internal format by hand because some values are + * optional (i.e., not defined in every implementation). + */ + GLenum i; + switch(internal) { +#if GL_OES_rgb8_rgba8 + case MLTAG_rgba8: i = GL_RGBA8_OES; break; + case MLTAG_rgb8: i = GL_RGB8_OES; break; +#endif +#if GL_OES_depth24 + case MLTAG_depth_component24: i = GL_DEPTH_COMPONENT24_OES; break; +#endif +#if GL_OES_depth32 + case MLTAG_depth_component32: i = GL_DEPTH_COMPONENT32_OES; break; +#endif +#if GL_OES_stencil1 + case MLTAG_stencil_index1: i = GL_STENCIL_INDEX1_OES; break; +#endif +#if GL_OES_stencil4 + case MLTAG_stencil_index4: i = GL_STENCIL_INDEX4_OES; break; +#endif +#if GL_OES_stencil8 + case MLTAG_stencil_index8: i = GL_STENCIL_INDEX8_OES; break; +#endif + /* The default case catches all the required internal formats. + */ + default: i = GLenum_val(internal); break; + } + glRenderbufferStorageOES(GLenum_val(target), i, Int_val(width), + Int_val(height)); + return Val_unit; +} + +CAMLprim value ml_glGetRenderbufferParameter(value target, value param) +{ + /* The parameter returns a single GLint value. + * + * We translate by hand to renderbuffer enums because the names are + * generic. (E.g., width should correspond to GL_WIDTH.) + */ + GLint i; + GLenum p; + switch(param) { + case MLTAG_width: p = GL_RENDERBUFFER_WIDTH_OES; break; + case MLTAG_height: p = GL_RENDERBUFFER_HEIGHT_OES; break; + case MLTAG_red_size: p = GL_RENDERBUFFER_RED_SIZE_OES; break; + case MLTAG_green_size: p = GL_RENDERBUFFER_GREEN_SIZE_OES; break; + case MLTAG_blue_size: p = GL_RENDERBUFFER_BLUE_SIZE_OES; break; + case MLTAG_alpha_size: p = GL_RENDERBUFFER_ALPHA_SIZE_OES; break; + case MLTAG_depth_size: p = GL_RENDERBUFFER_DEPTH_SIZE_OES; break; + case MLTAG_stencil_size: p = GL_RENDERBUFFER_STENCIL_SIZE_OES; break; + default: ml_raise_gl("glGetRenderbufferParameter: unknown param"); + } + glGetRenderbufferParameterivOES(GLenum_val(target), p, &i); + return Val_int(i); +} + +CAMLprim value ml_glGetRenderbufferParameter_fmt(value target, value param) +{ + /* The parameter returns a renderbuffer internal format. + */ + GLint i; + GLenum p; + switch(param) { + case MLTAG_internal_format: p = GL_RENDERBUFFER_INTERNAL_FORMAT_OES; break; + default: ml_raise_gl("glGetRenderbufferParameter: unknown param"); + } + glGetRenderbufferParameterivOES(GLenum_val(target), p, &i); + switch(i) { + case GL_RGB565_OES: return MLTAG_rgb565; + case GL_RGBA4_OES: return MLTAG_rgba4; + case GL_RGB5_A1_OES: return MLTAG_rgb5_a1; + case GL_DEPTH_COMPONENT16_OES: return MLTAG_depth_component16; + +#if GL_OES_rgb8_rgba8 + case GL_RGBA8_OES: return MLTAG_rgba8; + case GL_RGB8_OES: return MLTAG_rgb8; +#endif +#if GL_OES_depth24 + case GL_DEPTH_COMPONENT24_OES: return MLTAG_depth_component24; +#endif +#if GL_OES_depth32 + case GL_DEPTH_COMPONENT32_OES: return MLTAG_depth_component32; +#endif +#if GL_OES_stencil1 + case GL_STENCIL_INDEX1_OES: return MLTAG_stencil_index1; +#endif +#if GL_OES_stencil4 + case GL_STENCIL_INDEX4_OES: return MLTAG_stencil_index4; +#endif +#if GL_OES_stencil8 + case GL_STENCIL_INDEX8_OES: return MLTAG_stencil_index8; +#endif + } + ml_raise_gl("glGetRenderbufferParameter: unknown internal format"); +} + +ML_1_ (glIsFramebufferOES, (GLuint) Int32_val, Val_bool) +ML_2 (glBindFramebufferOES, GLenum_val, (GLuint) Int32_val) + +CAMLprim value ml_glDeleteFramebuffer(value fbid) +{ + GLuint id = Int32_val(fbid); + glDeleteFramebuffersOES(1, &id); + return Val_unit; +} + +CAMLprim value ml_glGenFramebuffer(value unit) +{ + GLuint id; + glGenFramebuffersOES(1, &id); + return copy_int32(id); +} + +CAMLprim value ml_glCheckFramebufferStatus(value target) +{ + GLenum status = glCheckFramebufferStatusOES(GLenum_val(target)); + switch(status) { + case GL_FRAMEBUFFER_COMPLETE_OES: + return MLTAG_complete; + case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES: + return MLTAG_incomplete_attachment; + case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES: + return MLTAG_incomplete_missing_attachment; + case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES: + return MLTAG_incomplete_dimensions; + case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES: + return MLTAG_incomplete_formats; + case GL_FRAMEBUFFER_UNSUPPORTED_OES: + return MLTAG_unsupported; + } + ml_raise_gl("glCheckFramebufferStatus: unknown status"); +} + +CAMLprim value ml_glFramebufferRenderbuffer(value target, value attachment, + value rendertarget, value rbid) +{ + GLenum att; + + switch(attachment) { + case MLTAG_color0: att = GL_COLOR_ATTACHMENT0_OES; break; + case MLTAG_depth: att = GL_DEPTH_ATTACHMENT_OES; break; + case MLTAG_stencil: att = GL_STENCIL_ATTACHMENT_OES; break; + default: ml_raise_gl("glFramebufferRenderbuffer: unknown attachment"); + } + glFramebufferRenderbufferOES(GLenum_val(target), att, + GLenum_val(rendertarget), Int32_val(rbid)); + return Val_unit; +} + +CAMLprim value ml_glFramebufferTexture2D(value target, value attachment, + value textarget, value texid, value level) +{ + GLenum att; + + switch(attachment) { + case MLTAG_color0: att = GL_COLOR_ATTACHMENT0_OES; break; + case MLTAG_depth: att = GL_DEPTH_ATTACHMENT_OES; break; + case MLTAG_stencil: att = GL_STENCIL_ATTACHMENT_OES; break; + default: ml_raise_gl("glFramebufferTexture2D: unknown attachment"); + } + glFramebufferTexture2DOES(GLenum_val(target), att, GLenum_val(textarget), + Int32_val(texid), Int_val(level)); + return Val_unit; +} + +#ifndef GL_NONE_OES +#define GL_NONE_OES 0 +#endif + +CAMLprim value ml_glGetAttachmentType(value target, value attachment) +{ + CAMLparam2(target, attachment); + GLenum targ = GLenum_val(target); + CAMLlocal1(result); + GLenum a; + GLint i; + switch(attachment) { + case MLTAG_color0: a = GL_COLOR_ATTACHMENT0_OES; break; + case MLTAG_depth: a = GL_DEPTH_ATTACHMENT_OES; break; + case MLTAG_stencil: a = GL_STENCIL_ATTACHMENT_OES; break; + default: + ml_raise_gl("glGetFramebufferAttachmentType: unknown attachment type"); + break; + } + i = 0; + glGetFramebufferAttachmentParameterivOES(targ, a, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES, &i); + switch(i) { + case GL_NONE_OES: + result = MLTAG_none; + break; + case GL_TEXTURE: + case GL_RENDERBUFFER_OES: + result = caml_alloc(2, 0); + Store_field(result, 0, + i == GL_TEXTURE ? MLTAG_texture : MLTAG_renderbuffer); + i = 0; + glGetFramebufferAttachmentParameterivOES(targ, a, + GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES, &i); + Store_field(result, 1, caml_copy_int32(i)); + break; + default: + ml_raise_gl("glGetFramebufferAttachmentType: unknown object type"); + break; + } + CAMLreturn(result); +} + +ML_1 (glGenerateMipmapOES, GLenum_val) + +CAMLprim value ml_glTranslateEnum(value glenum) +{ + return Val_int(GLenum_val(glenum)); +} + +#else /* !GL_OES_framebuffer_object */ + +/* Framebuffer object functions fail at runtime if not supported. + */ + +CAMLprim value ml_glIsRenderbufferOES(value arg1) +{ + ml_raise_gl("Function: glIsRenderbufferOES not available"); +} + +CAMLprim value ml_glBindRenderbufferOES(value arg1, value arg2) +{ + ml_raise_gl("Function: glBindRenderbufferOES not available"); +} + +CAMLprim value ml_glDeleteRenderbuffer(value rbid) +{ + ml_raise_gl("Function: glDeleteRenderbuffersOES not available"); +} + +CAMLprim value ml_glGenRenderbuffer(value unit) +{ + ml_raise_gl("Function: glGenRenderbuffersOES not available"); +} + +CAMLprim value ml_glRenderbufferStorageOES(value arg1, value arg2, + value arg3, value arg4) +{ + ml_raise_gl("Function: glRenderbufferStorageOES not available"); +} + +CAMLprim value ml_glGetRenderbufferParameter(value target, value param) +{ + ml_raise_gl("Function: glGetRenderbufferParameterivOES not available"); +} + +CAMLprim value ml_glGetRenderbufferParameter_fmt(value target, value param) +{ + ml_raise_gl("Function: glGetRenderbufferParameterivOES not available"); +} + +CAMLprim value ml_glIsFramebufferOES(value arg1) +{ + ml_raise_gl("Function: glIsFramebufferOES not available"); +} + +CAMLprim value ml_glBindFramebufferOES(value arg1, value arg2) +{ + ml_raise_gl("Function: glBindFramebufferOES not available"); +} + +CAMLprim value ml_glDeleteFramebuffer(value fbid) +{ + ml_raise_gl("Function: glDeleteFramebuffersOES not available"); +} + +CAMLprim value ml_glGenFramebuffer(value unit) +{ + ml_raise_gl("Function: glGenFramebuffersOES not available"); +} + +CAMLprim value ml_glCheckFramebufferStatus(value target) +{ + ml_raise_gl("Function: glCheckFramebufferStatusOES not available"); +} + +CAMLprim value ml_glFramebufferRenderbuffer(value target, value attachment, + value rendertarget, value rbid) +{ + ml_raise_gl("Function: glFramebufferRenderbufferOES not available"); +} + +CAMLprim value ml_glFramebufferTexture2D(value target, value attachment, + value textarget, value texid, value level) +{ + ml_raise_gl("Function: glFramebufferTexture2DOES not available"); +} + +CAMLprim value ml_glGetAttachmentType(value target, value attachment) +{ + ml_raise_gl("Function: glGetFramebufferAttachmentParameterivOES not available"); +} + +CAMLprim value ml_glGenerateMipmapOES(value arg1) +{ + ml_raise_gl("Function: glGenerateMipmapOES not available"); +} + +CAMLprim value ml_glTranslateEnum(value glenum) +{ + /* This doesn't actually require any OpenGL functionality at all, + * but make it undefined for consistency. + */ + ml_raise_gl("Function: glTranslateEnum not available"); +} +#endif /* !GL_OES_framebuffer_object */ Index: src/glClear.mli =================================================================== --- src/glClear.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glClear.mli (.../trunk/lablgles) (revision 709) @@ -1,12 +1,10 @@ (* $Id: glClear.mli,v 1.3 1999/11/15 09:55:05 garrigue Exp $ *) -type buffer = [`accum|`color|`depth|`stencil] +type buffer = [`color|`depth|`stencil] val clear : buffer list -> unit (* glClear: clear the specified buffers *) -val accum : ?alpha:float -> Gl.rgb -> unit val color : ?alpha:float -> Gl.rgb -> unit val depth : Gl.clampf -> unit -val index : float -> unit val stencil : int -> unit - (* Set the clear value for each buffer: glClearAccum etc *) + (* Set the clear value for each buffer: glClearColor etc *) Index: src/glTex.ml =================================================================== --- src/glTex.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glTex.ml (.../trunk/lablgles) (revision 709) @@ -3,83 +3,80 @@ open Gl open GlPix -external coord1 : float -> unit = "ml_glTexCoord1d" -external coord2 : float -> float -> unit = "ml_glTexCoord2d" -external coord3 : float -> float -> float -> unit = "ml_glTexCoord3d" -external coord4 : float -> float -> float -> float -> unit - = "ml_glTexCoord4d" - -(*external multi_coord2 : *) - -let default x = function Some x -> x | None -> x -let coord ~s ?t ?r ?q () = - match q with - Some q -> coord4 s (default 0.0 t) (default 0.0 r) q - | None -> match r with - Some r -> coord3 s (default 0.0 t) r - | None -> match t with - Some t -> coord2 s t - | None -> coord1 s -let coord2 (s,t) = coord2 s t -let coord3 (s,t,r) = coord3 s t r -let coord4 (s,t,r,q) = coord4 s t r q type env_param = [ `mode of [`modulate|`decal|`blend|`replace] | `color of rgba ] external env : env_param -> unit = "ml_glTexEnv" -type coord = [`s|`t|`r|`q] -type gen_param = [ - `mode of [`object_linear|`eye_linear|`sphere_map] - | `object_plane of point4 - | `eye_plane of point4 -] -external gen : coord:coord -> gen_param -> unit = "ml_glTexGen" +let is_pow2 n = + n land (n - 1) = 0 + let npot = ref None let check_pow2 n = if !npot = None then - npot := Some (GlMisc.check_extension "GL_ARB_texture_non_power_of_two"); - (!npot = Some true) || (n land (n - 1) = 0) + npot := Some (GlMisc.check_extension "GL_OES_texture_npot"); + (!npot = Some true) || is_pow2 n type format = [ - `color_index - | `red - | `green - | `blue | `alpha | `rgb | `rgba | `luminance | `luminance_alpha + | `bgra ] -external image1d : - proxy:bool -> level:int -> internal:int -> - width:int -> border:int -> format:[< format] -> [< kind] Raw.t -> unit - = "ml_glTexImage1D_bc""ml_glTexImage1D" -let image1d ?(proxy=false) ?(level=0) ?internal:i ?(border=false) img = - let internal = match i with None -> format_size (format img) | Some i -> i in - let border = if border then 1 else 0 in - if not (check_pow2 (width img - 2 * border)) then - raise (GLerror "Gl.image1d : bad width"); - if height img < 1 then raise (GLerror "Gl.image1d : bad height"); - image1d ~proxy ~level ~internal ~width:(width img) ~border - ~format:(format img) (to_raw img) +type compressed_format = [ + `palette4_rgb8 + | `palette4_rgba8 + | `palette4_r5_g6_b5 + | `palette4_rgba4 + | `palette4_rgb5_a1 + | `palette8_rgb8 + | `palette8_rgba8 + | `palette8_r5_g6_b5 + | `palette8_rgba4 + | `palette8_rg5b_a1 + | `rgb_pvrtc_4bppv1 + | `rgb_pvrtc_2bppv1 + | `rgba_pvrtc_4bppv1 + | `rgba_pvrtc_2bppv1 +] + external image2d : - proxy:bool -> level:int -> internal:int -> width:int -> - height:int -> border:int -> format:[< format] -> [< kind] Raw.t -> unit - = "ml_glTexImage2D_bc""ml_glTexImage2D" -let image2d ?(proxy=false) ?(level=0) ?internal:i ?(border=false) img = - let internal = match i with None -> format_size (format img) | Some i -> i in + level:int -> internal:[ width:int -> height:int -> + border:int -> format:[< format] -> [< kind] Raw.t -> unit + = "ml_glTexImage2D_bc" "ml_glTexImage2D" +let image2d ?(level=0) ?internal:i ?(border=false) img = + let internal = match i with None -> (format img) | Some f -> f in let border = if border then 1 else 0 in if not (check_pow2 (width img - 2 * border)) then - raise (GLerror "Gl.image2d : bad width"); + raise (GLerror "GlTex.image2d : bad width"); if not (check_pow2 (height img - 2 * border)) then - raise (GLerror "Gl.image2d : bad height"); - image2d ~proxy ~level ~internal ~border + raise (GLerror "GlTex.image2d : bad height"); + image2d ~level ~internal ~border ~width:(width img) ~height:(height img) ~format:(format img) (to_raw img) +external sub_image2d : + level:int -> xoffset:int -> yoffset:int -> width:int -> height:int -> + format:[< format] -> [< kind] Raw.t -> unit + = "ml_glTexSubImage2D_bc" "ml_glTexSubImage2D" +let sub_image2d ?(level=0) xoffset yoffset img = + sub_image2d ~level ~xoffset ~yoffset + ~width:(width img) ~height:(height img) ~format:(format img) (to_raw img) +external compressed_image2d : + level:int -> internal:[< compressed_format] -> width:int -> height:int -> + border:int -> [`ubyte] Raw.t -> unit + = "ml_glCompressedTexImage2D_bc" "ml_glCompressedTexImage2D" +let compressed_image2d ?(level=0) ?(border=false) internal width height raw = + let border = if border then 1 else 0 in + if not (is_pow2 (width - 2 * border)) then + raise (GLerror "GlTex.compressed_image2d : bad width"); + if not (is_pow2 (height - 2 * border)) then + raise (GLerror "GlTex.compressed_image2d : bad height"); + compressed_image2d ~level ~internal ~width ~height ~border raw + type filter = [ `nearest | `linear @@ -88,20 +85,19 @@ | `nearest_mipmap_linear | `linear_mipmap_linear ] -type wrap = [`clamp|`repeat] +type wrap = [`repeat|`clamp_to_edge] type parameter = [ `min_filter of filter | `mag_filter of [`nearest|`linear] | `wrap_s of wrap | `wrap_t of wrap - | `border_color of rgba - | `priority of clampf | `generate_mipmap of bool ] -external parameter : target:[`texture_1d|`texture_2d] -> parameter -> unit +external parameter : target:[`texture_2d] -> parameter -> unit = "ml_glTexParameter" type texture_id = nativeint +let texture0 = 0n external _gen_textures : int -> [`uint] Raw.t -> unit = "ml_glGenTextures" let gen_textures ~len = let raw = Raw.create `uint ~len in @@ -113,7 +109,7 @@ arr let gen_texture () = (gen_textures 1).(0) -external bind_texture : target:[`texture_1d|`texture_2d] -> texture_id -> unit +external bind_texture : target:[`texture_2d] -> texture_id -> unit = "ml_glBindTexture" external delete_texture : texture_id -> unit = "ml_glDeleteTexture" let delete_textures a = Array.iter (fun id -> delete_texture id) a Index: src/glPix.ml =================================================================== --- src/glPix.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glPix.ml (.../trunk/lablgles) (revision 709) @@ -32,71 +32,12 @@ let line = stride * width in fun ~x ~y -> x * stride + y * line -external bitmap : - width:int -> height:int -> orig:point2 -> move:point2 -> - [`bitmap] Raw.t -> unit - = "ml_glBitmap" -type bitmap = ([`color_index], [`bitmap]) t -let bitmap (img : bitmap) = - bitmap ~width:img.width ~height:img.height img.raw - -external copy : - x:int -> y:int -> width:int -> height:int -> - buffer:[`color|`depth|`stencil] -> unit - = "ml_glCopyPixels" - -external draw : - width:int -> height:int -> format:[< format] -> [< Gl.kind] Raw.t -> unit - = "ml_glDrawPixels" -let draw img = - draw img.raw ~width:img.width ~height:img.height ~format:img.format - -type map = - [`i_to_i|`i_to_r|`i_to_g|`i_to_b|`i_to_a - |`s_to_s|`r_to_r|`g_to_g|`b_to_b|`a_to_a] -external map : map -> [`float] Raw.t -> unit - = "ml_glPixelMapfv" - type store_param = [ - `pack_swap_bytes of bool - | `pack_lsb_first of bool - | `pack_row_length of int - | `pack_skip_pixels of int - | `pack_skip_rows of int | `pack_alignment of int - | `unpack_swap_bytes of bool - | `unpack_lsb_first of bool - | `unpack_row_length of int - | `unpack_skip_pixels of int - | `unpack_skip_rows of int | `unpack_alignment of int ] external store : store_param -> unit = "ml_glPixelStorei" -type transfer_param = [ - `map_color of bool - | `map_stencil of bool - | `index_shift of int - | `index_offset of int - | `red_scale of float - | `red_bias of float - | `green_scale of float - | `green_bias of float - | `blue_scale of float - | `blue_bias of float - | `alpha_scale of float - | `alpha_bias of float - | `depth_scale of float - | `depth_bias of float -] -external transfer : transfer_param -> unit = "ml_glPixelTransfer" - -external zoom : x:float -> y:float -> unit = "ml_glPixelZoom" - -external raster_pos : - x:float -> y:float -> ?z:float -> ?w:float -> unit -> unit - = "ml_glRasterPos" - external read : x:int -> y:int -> width:int -> height:int -> format:[< format] -> [< Gl.kind] Raw.t -> unit Index: src/glDraw.mli =================================================================== --- src/glDraw.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glDraw.mli (.../trunk/lablgles) (revision 709) @@ -4,21 +4,13 @@ val color : ?alpha:float -> rgb -> unit (* Sets the current color *) -val index : float -> unit - (* Sets the current index *) val cull_face : face -> unit (* Specifies which faces are candidates for culling *) val front_face : [`ccw|`cw] -> unit (* Specifies wether front faces are clockwise or not *) -val edge_flag : bool -> unit val line_width : float -> unit -val line_stipple : ?factor:int -> short -> unit - (* [line_stipple :factor pattern] sets the line stipple to the - 16-bit integer [pattern]. Each bit is used [factor] times *) val point_size : float -> unit val polygon_offset : factor:float -> units:float -> unit -val polygon_mode : face:face -> [`fill|`line|`point] -> unit -val polygon_stipple : GlPix.bitmap -> unit val shade_model : [`flat|`smooth] -> unit @@ -26,17 +18,8 @@ val normal3 : vect3 -> unit (* [glNormal] *) -val rect : point2 -> point2 -> unit - type shape = - [`line_loop|`line_strip|`lines|`points|`polygon|`quad_strip|`quads + [`line_loop|`line_strip|`lines|`points |`triangle_fan|`triangle_strip|`triangles] -val begins : shape -> unit -val ends : unit -> unit -val vertex : x:float -> y:float -> ?z:float -> ?w:float -> unit -> unit -val vertex2 : point2 -> unit -val vertex3 : point3 -> unit -val vertex4 : point4 -> unit - val viewport : x:int -> y:int -> w:int -> h:int -> unit Index: src/glTex.mli =================================================================== --- src/glTex.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glTex.mli (.../trunk/lablgles) (revision 709) @@ -2,52 +2,44 @@ open Gl -val coord : s:float -> ?t:float -> ?r:float -> ?q:float -> unit -> unit -val coord2 : float * float -> unit -val coord3 : float * float * float -> unit -val coord4 : float * float * float * float -> unit - type env_param = [ `mode of [`modulate|`decal|`blend|`replace] | `color of rgba] val env : env_param -> unit -type coord = [`s|`t|`r|`q] -type gen_param = [ - `mode of [`object_linear|`eye_linear|`sphere_map] - | `object_plane of point4 - | `eye_plane of point4 -] -val gen : coord:coord -> gen_param -> unit - type format = - [`color_index|`red|`green|`blue|`alpha|`rgb|`rgba - |`luminance|`luminance_alpha] -val image1d : - ?proxy:bool -> ?level:int -> ?internal:int -> ?border:bool -> - ([< format], [< kind]) GlPix.t -> unit + [`alpha|`rgb|`rgba|`luminance|`luminance_alpha|`bgra] +type compressed_format = + [`palette4_rgb8|`palette4_rgba8|`palette4_r5_g6_b5|`palette4_rgba4 + |`palette4_rgb5_a1|`palette8_rgb8|`palette8_rgba8|`palette8_r5_g6_b5 + |`palette8_rgba4|`palette8_rg5b_a1|`rgb_pvrtc_4bppv1|`rgb_pvrtc_2bppv1 + |`rgba_pvrtc_4bppv1|`rgba_pvrtc_2bppv1] val image2d : - ?proxy:bool -> ?level:int -> ?internal:int -> ?border:bool -> - ([< format], [< kind]) GlPix.t -> unit + ?level:int -> ?internal:([< format] as 'a) -> ?border:bool -> + ('a, [< kind]) GlPix.t -> unit +val sub_image2d : + ?level:int -> int -> int -> ([< format], [< kind]) GlPix.t -> unit +val compressed_image2d : + ?level:int -> ?border:bool -> [< compressed_format] -> int -> int -> + [`ubyte] Raw.t -> unit type filter = [`nearest|`linear|`nearest_mipmap_nearest|`linear_mipmap_nearest |`nearest_mipmap_linear|`linear_mipmap_linear] -type wrap = [`clamp|`repeat] +type wrap = [`repeat|`clamp_to_edge] type parameter = [ `min_filter of filter | `mag_filter of [`nearest|`linear] | `wrap_s of wrap | `wrap_t of wrap - | `border_color of rgba - | `priority of clampf | `generate_mipmap of bool ] -val parameter : target:[`texture_1d|`texture_2d] -> parameter -> unit +val parameter : target:[`texture_2d] -> parameter -> unit type texture_id +val texture0 : texture_id (* Default texture id *) val gen_texture : unit -> texture_id val gen_textures : len:int -> texture_id array -val bind_texture : target:[`texture_1d|`texture_2d] -> texture_id -> unit +val bind_texture : target:[`texture_2d] -> texture_id -> unit val delete_texture : texture_id -> unit val delete_textures : texture_id array -> unit Index: src/glPix.mli =================================================================== --- src/glPix.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glPix.mli (.../trunk/lablgles) (revision 709) @@ -27,54 +27,8 @@ height:int -> format:([< Gl.format] as 'a) -> kind:([< Gl.kind] as 'b) -> ('a, 'b) t -type bitmap = ([`color_index], [`bitmap]) t -val bitmap : - bitmap -> orig:Gl.point2 -> move:Gl.point2 -> unit - -val draw : ([< Gl.format], [< Gl.kind]) t -> unit - -type map = - [`a_to_a|`b_to_b|`g_to_g|`i_to_a|`i_to_b - |`i_to_g|`i_to_i|`i_to_r|`r_to_r|`s_to_s] -val map : map -> [`float] Raw.t -> unit - type store_param = [ - `pack_swap_bytes of bool - | `pack_lsb_first of bool - | `pack_row_length of int - | `pack_skip_pixels of int - | `pack_skip_rows of int | `pack_alignment of int - | `unpack_swap_bytes of bool - | `unpack_lsb_first of bool - | `unpack_row_length of int - | `unpack_skip_pixels of int - | `unpack_skip_rows of int | `unpack_alignment of int ] val store : store_param -> unit - -type transfer_param = [ - `map_color of bool - | `map_stencil of bool - | `index_shift of int - | `index_offset of int - | `red_scale of float - | `red_bias of float - | `green_scale of float - | `green_bias of float - | `blue_scale of float - | `blue_bias of float - | `alpha_scale of float - | `alpha_bias of float - | `depth_scale of float - | `depth_bias of float -] -val transfer : transfer_param -> unit - -val zoom : x:float -> y:float -> unit -val raster_pos : x:float -> y:float -> ?z:float -> ?w:float -> unit -> unit - -val copy : - x:int -> - y:int -> width:int -> height:int -> buffer:[`color|`depth|`stencil] -> unit Index: src/gl_tags.var =================================================================== --- src/gl_tags.var (.../vendor/lablgl/1.04) (revision 709) +++ src/gl_tags.var (.../trunk/lablgles) (revision 709) @@ -1,28 +1,17 @@ (* GLenum *) -color -depth -accum -stencil points lines -polygon triangles -quads line_strip line_loop triangle_strip triangle_fan -quad_strip front back both -> GL_FRONT_AND_BACK -point -line -fill - cw ccw @@ -36,21 +25,13 @@ (* glEnable *) alpha_test -auto_normal blend -clip_plane0 -clip_plane1 -clip_plane2 -clip_plane3 -clip_plane4 -clip_plane5 (* color_logic_op *) color_material cull_face depth_test dither fog -(* index_logic_op *) light0 light1 light2 @@ -61,43 +42,18 @@ light7 lighting line_smooth -line_stipple -logic_op -index_logic_op color_logic_op -map1_color_4 -map1_index -map1_normal -map1_texture_coord_1 -map1_texture_coord_2 -map1_texture_coord_3 -map1_texture_coord_4 -map1_vertex_3 -map1_vertex_4 -map2_color_4 -map2_index -map2_normal -map2_texture_coord_1 -map2_texture_coord_2 -map2_texture_coord_3 -map2_texture_coord_4 -map2_vertex_3 -map2_vertex_4 normalize point_smooth polygon_offset_fill -polygon_offset_line -polygon_offset_point -polygon_smooth -polygon_stipple scissor_test stencil_test -texture_1d texture_2d -texture_gen_q -texture_gen_r -texture_gen_s -texture_gen_t +rescale_normal +multisample +sample_alpha_to_coverage +sample_alpha_to_one +sample_coverage (* glShadeModel *) flat @@ -122,7 +78,6 @@ emission shininess ambient_and_diffuse -color_indexes (* glDepthFunc, glAlphaFunc *) never less equal lequal greater notequal gequal always @@ -143,22 +98,15 @@ (* glFog *) linear exp exp2 -(* glNewList *) -compile compile_and_execute - (* data types *) -bitmap byte short int float double +byte short float ubyte -> GL_UNSIGNED_BYTE ushort -> GL_UNSIGNED_SHORT -uint -> GL_UNSIGNED_INT -(* glAccum *) -load add mult return +(* glTexImage2D *) +rgba +alpha rgb luminance luminance_alpha -(* glDrawPixels *) -color_index stencil_index depth_component rgba -red green blue alpha rgb luminance luminance_alpha - (* glHint *) dont_care fastest nicest @@ -166,115 +114,103 @@ clear set copy copy_inverted noop invert And nand Or nor xor equiv and_reverse and_inverted or_reverse or_inverted -(* glPixelTransfer *) -alpha_bias -alpha_scale -blue_bias -blue_scale -depth_bias -depth_scale -green_bias -green_scale -index_offset -index_shift -map_color -map_stencil -red_bias -red_scale - -(* glPixelMap *) -i_to_i -> GL_PIXEL_MAP_I_TO_I -i_to_r -> GL_PIXEL_MAP_I_TO_R -i_to_g -> GL_PIXEL_MAP_I_TO_G -i_to_b -> GL_PIXEL_MAP_I_TO_B -i_to_a -> GL_PIXEL_MAP_I_TO_A -s_to_s -> GL_PIXEL_MAP_S_TO_S -r_to_r -> GL_PIXEL_MAP_R_TO_R -g_to_g -> GL_PIXEL_MAP_G_TO_G -b_to_b -> GL_PIXEL_MAP_B_TO_B -a_to_a -> GL_PIXEL_MAP_A_TO_A - (* glPixelStore *) -pack_swap_bytes -pack_lsb_first -pack_row_length -pack_skip_pixels -pack_skip_rows pack_alignment -unpack_swap_bytes -unpack_lsb_first -unpack_row_length -unpack_skip_pixels -unpack_skip_rows unpack_alignment -(* glReadBuffer *) -front_left front_right back_left back_right left right - -(* glDrawBuffer *) -none - (* glStencilOp *) keep replace incr decr (* glTexEnv *) -modulate decal +modulate decal add +alpha_scale -(* glTexGen *) -s t r q -object_plane eye_plane -eye_linear object_linear sphere_map - (* glTexParameter *) min_filter -> GL_TEXTURE_MIN_FILTER mag_filter -> GL_TEXTURE_MAG_FILTER wrap_s -> GL_TEXTURE_WRAP_S wrap_t -> GL_TEXTURE_WRAP_T -border_color -> GL_TEXTURE_BORDER_COLOR -priority -> GL_TEXTURE_PRIORITY nearest nearest_mipmap_nearest linear_mipmap_nearest nearest_mipmap_linear linear_mipmap_linear generate_mipmap -clamp repeat +repeat clamp_to_edge (* glGetString *) vendor renderer version extensions -(* glRenderMode *) -render select feedback +(* glFramebuffer *) +renderbuffer -> GL_RENDERBUFFER_OES +rgb565 -> GL_RGB565_OES +rgba4 -> GL_RGBA4_OES +rgb5_a1 -> GL_RGB5_A1_OES +depth_component16 -> GL_DEPTH_COMPONENT16_OES +framebuffer -> GL_FRAMEBUFFER_OES -(* glFeedBackBuffer *) -_2d -> GL_2D -_3d -> GL_3D -_3d_color -> GL_3D_COLOR -_3d_color_texture -> GL_3D_COLOR_TEXTURE -_4d_color_texture -> GL_4D_COLOR_TEXTURE +(* glCompressedTexImage2D *) +palette4_rgb8 -> GL_PALETTE4_RGB8_OES +palette4_rgba8 -> GL_PALETTE4_RGBA8_OES +palette4_r5_g6_b5 -> GL_PALETTE4_R5_G6_B5_OES +palette4_rgba4 -> GL_PALETTE4_RGBA4_OES +palette4_rgb5_a1 -> GL_PALETTE4_RGB5_A1_OES +palette8_rgb8 -> GL_PALETTE8_RGB8_OES +palette8_rgba8 -> GL_PALETTE8_RGBA8_OES +palette8_r5_g6_b5 -> GL_PALETTE8_R5_G6_B5_OES +palette8_rgba4 -> GL_PALETTE8_RGBA4_OES +palette8_rg5b_a1 -> GL_PALETTE8_RGB5_A1_OES $$ +(* glClear, glEnableClientState, glFramebufferRenderbufferOES, etc. *) +color +depth +stencil + (* glLightModel *) -local_viewer two_side mode density start index End -color_control separate_specular_color single_color +two_side mode density start End (* glHint *) perspective_correction -(* glMap1, glMap2 *) -vertex_3 vertex_4 color_4 normal texture_coord_1 texture_coord_2 -texture_coord_3 texture_coord_4 - -(* glPushAttrib *) -accum_buffer color_buffer current depth_buffer enable eval -hint list pixel_mode scissor stencil_buffer transform viewport - -(* glReadBuffer *) -aux - (* glArray *) -edge_flag texture_coord vertex +point_size normal texture_coord vertex two three four (* glGetError *) no_error invalid_enum invalid_value invalid_operation stack_overflow stack_underflow -out_of_memory table_too_large +out_of_memory + +(* glFramebuffer *) +width +height +red_size +green_size +blue_size +alpha_size +depth_size +stencil_size +internal_format +none +color0 +complete +incomplete_attachment +incomplete_missing_attachment +incomplete_dimensions +incomplete_formats +unsupported +rgba8 +rgb8 +depth_component24 +depth_component32 +stencil_index1 +stencil_index4 +stencil_index8 + +(* IMG_texture_compression_pvrtc extension *) +rgb_pvrtc_4bppv1 +rgb_pvrtc_2bppv1 +rgba_pvrtc_4bppv1 +rgba_pvrtc_2bppv1 + +(* IMG_texture_format_BGRA8888 extension *) +bgra Index: src/glArray.ml =================================================================== --- src/glArray.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glArray.ml (.../trunk/lablgles) (revision 709) @@ -3,39 +3,33 @@ open Gl open Raw -type kind = [`edge_flag | `texture_coord | `color | `index | `normal | `vertex ] +type kind = [`point_size | `texture_coord | `color | `normal | `vertex ] let check_static func f raw = if not (Raw.static raw) then invalid_arg ("GlArray." ^ func ^ " : buffer must be static"); f raw -external _edge_flag : [< `bitmap] Raw.t -> unit = "ml_glEdgeFlagPointer" -let edge_flag raw = check_static "edge_flag" _edge_flag raw +external pointsize : + [ `float ] Raw.t -> unit + = "ml_glPointSizePointerOES" external _tex_coord : - [< `one | `two | `three | `four] -> - [< `short | `int | `float | `double] Raw.t -> unit + [< `two | `three | `four] -> [< `ubyte | `short | `float] Raw.t -> unit = "ml_glTexCoordPointer" let tex_coord n = check_static "tex_coord" (_tex_coord n) external _color : - [< `three | `four] -> - [< `byte | `ubyte | `short | `ushort | `int | `uint | `float | `double] Raw.t - -> unit + [< `four] -> [< `ubyte | `float] Raw.t -> unit = "ml_glColorPointer" let color n = check_static "color" (_color n) -external _index : [< `ubyte | `short | `int | `float | `double] Raw.t -> unit - = "ml_glIndexPointer" -let index raw = check_static "index" _index raw - -external _normal : [< `byte | `short | `int | `float | `double] Raw.t -> unit +external _normal : [< `byte | `short | `float] Raw.t -> unit = "ml_glNormalPointer" let normal raw = check_static "normal" _normal raw external _vertex : - [< `two | `three | `four] -> [< `short | `int | `float | `double] Raw.t + [< `two | `three | `four] -> [< `byte | `short | `float] Raw.t -> unit = "ml_glVertexPointer" let vertex n = check_static "vertex" (_vertex n) @@ -44,8 +38,6 @@ external disable : kind -> unit = "ml_glDisableClientState" -external element : int -> unit = "ml_glArrayElement" - external draw_arrays : GlDraw.shape -> first:int -> count:int -> unit = "ml_glDrawArrays" Index: src/glLight.mli =================================================================== --- src/glLight.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glLight.mli (.../trunk/lablgles) (revision 709) @@ -2,16 +2,11 @@ open Gl -type color_material = - [`emission|`ambient|`diffuse|`specular|`ambient_and_diffuse] -val color_material : face:face -> color_material -> unit - type fog_param = [ `mode of [`linear|`exp|`exp2] | `density of float | `start of float | `End of float - | `index of float | `color of rgba ] val fog : fog_param -> unit @@ -32,9 +27,7 @@ val light_model : [ `ambient of rgba - | `local_viewer of bool | `two_side of bool - | `color_control of [`separate_specular_color|`single_color] ] -> unit type material_param = [ @@ -44,6 +37,5 @@ | `emission of rgba | `shininess of float | `ambient_and_diffuse of rgba - | `color_indexes of (float * float * float) ] val material : face:face -> material_param -> unit Index: src/ml_glarray.c =================================================================== --- src/ml_glarray.c (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_glarray.c (.../trunk/lablgles) (revision 709) @@ -1,4 +1,3 @@ - #ifdef _WIN32 #include #endif @@ -9,9 +8,9 @@ #include #include #ifdef __APPLE__ -#include +#include #else -#include +#include #endif #include "ml_gl.h" #include "gl_tags.h" @@ -28,13 +27,13 @@ } } - -CAMLprim value ml_glEdgeFlagPointer(value raw) +CAMLprim value ml_glPointSizePointerOES(value raw) { - glEdgeFlagPointer(0, (GLboolean*)Addr_raw(raw)); - return Val_unit; + glPointSizePointerOES(GLenum_val(Kind_raw(raw)), 0, Void_raw(raw)); + return Val_unit; } + CAMLprim value ml_glTexCoordPointer(value size, value raw) { glTexCoordPointer (ml_glSizeOfValue(size), @@ -49,12 +48,6 @@ return Val_unit; } -CAMLprim value ml_glIndexPointer(value raw) -{ - glIndexPointer (GLenum_val(Kind_raw(raw)), 0, Void_raw(raw)); - return Val_unit; -} - CAMLprim value ml_glNormalPointer(value raw) { glNormalPointer (GLenum_val(Kind_raw(raw)), 0, Void_raw(raw)); @@ -73,10 +66,9 @@ GLenum a; switch(kl) { - case MLTAG_edge_flag: a = GL_EDGE_FLAG_ARRAY; break; + case MLTAG_point_size: a = GL_POINT_SIZE_ARRAY_OES; break; case MLTAG_texture_coord: a = GL_TEXTURE_COORD_ARRAY; break; case MLTAG_color: a = GL_COLOR_ARRAY; break; - case MLTAG_index: a = GL_INDEX_ARRAY; break; case MLTAG_normal: a = GL_NORMAL_ARRAY; break; case MLTAG_vertex: a = GL_VERTEX_ARRAY; break; default: ml_raise_gl("ml_glEnableClientState: invalid array"); @@ -90,10 +82,9 @@ GLenum a; switch(kl) { - case MLTAG_edge_flag: a = GL_EDGE_FLAG_ARRAY; break; + case MLTAG_point_size: a = GL_POINT_SIZE_ARRAY_OES; break; case MLTAG_texture_coord: a = GL_TEXTURE_COORD_ARRAY; break; case MLTAG_color: a = GL_COLOR_ARRAY; break; - case MLTAG_index: a = GL_INDEX_ARRAY; break; case MLTAG_normal: a = GL_NORMAL_ARRAY; break; case MLTAG_vertex: a = GL_VERTEX_ARRAY; break; default: ml_raise_gl("ml_glDisableClientState: invalid array"); @@ -102,7 +93,6 @@ return Val_unit; } -ML_1 (glArrayElement, Int_val); ML_3 (glDrawArrays, GLenum_val, Int_val, Int_val); CAMLprim value ml_glDrawElements(value mode, value count, value raw) Index: src/glMat.ml =================================================================== --- src/glMat.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glMat.ml (.../trunk/lablgles) (revision 709) @@ -1,70 +1,61 @@ (* $Id: glMat.ml,v 1.11 2005/10/28 02:49:09 garrigue Exp $ *) -type t = [`double] Raw.t +type t = [`float] Raw.t external frustum : x:(float * float) -> y:(float * float) -> z:(float * float) -> unit - = "ml_glFrustum" + = "ml_glFrustumf" external load_identity : unit -> unit = "ml_glLoadIdentity" -external load : t -> unit = "ml_glLoadMatrixd" +external load : t -> unit = "ml_glLoadMatrixf" let load m = - if Raw.length m <> 16 then invalid_arg "Gl.load_matrix"; + if Raw.length m <> 16 then invalid_arg "GlMat.load"; load m -external load_transpose : t -> unit = "ml_glLoadTransposeMatrixd" -let load_transpose m = - if Raw.length m <> 16 then invalid_arg "Gl.load_transpose_matrix"; - load_transpose m - -external get_matrix : [`modelview_matrix|`projection_matrix|`texture_matrix] -> t -> unit = "ml_glGetDoublev" +external get_matrix : [`modelview_matrix|`projection_matrix|`texture_matrix] -> t -> unit = "ml_glGetFloatv" let get_matrix mode = - let model = Raw.create `double ~len:16 in + let model = Raw.create `float ~len:16 in get_matrix mode model; model external mode : [`modelview|`projection|`texture] -> unit = "ml_glMatrixMode" -external mult : t -> unit = "ml_glMultMatrixd" +external mult : t -> unit = "ml_glMultMatrixf" let mult m = - if Raw.length m <> 16 then invalid_arg "Gl.mult_matrix"; + if Raw.length m <> 16 then invalid_arg "GlMat.mult"; mult m -external mult_transpose : t -> unit = "ml_glMultTransposeMatrixd" -let mult_transpose m = - if Raw.length m <> 16 then invalid_arg "Gl.mult_matrix"; - mult_transpose m external ortho : x:(float * float) -> y:(float * float) -> z:(float * float) -> unit - = "ml_glOrtho" + = "ml_glOrthof" external pop : unit -> unit = "ml_glPopMatrix" external push : unit -> unit = "ml_glPushMatrix" external rotate : angle:float -> x:float -> y:float -> z:float -> unit - = "ml_glRotated" + = "ml_glRotatef" let rotate3 ~angle (x,y,z) = rotate ~angle ~x ~y ~z let rotate ~angle ?(x=0.) ?(y=0.) ?(z=0.) () = rotate ~angle ~x ~y ~z -external scale : x:float -> y:float -> z:float -> unit = "ml_glScaled" +external scale : x:float -> y:float -> z:float -> unit = "ml_glScalef" let scale3 (x,y,z) = scale ~x ~y ~z let scale ?(x=0.) ?(y=0.) ?(z=0.) () = scale ~x ~y ~z -external translate : x:float -> y:float -> z:float -> unit = "ml_glTranslated" +external translate : x:float -> y:float -> z:float -> unit = "ml_glTranslatef" let translate3 (x,y,z) = translate ~x ~y ~z let translate ?(x=0.) ?(y=0.) ?(z=0.) () = translate ~x ~y ~z let of_raw mat = - if Raw.length mat <> 16 then invalid_arg "GlMatrix.of_array"; + if Raw.length mat <> 16 then invalid_arg "GlMat.of_raw"; mat -external to_raw : t -> [`double] Raw.t = "%identity" +external to_raw : t -> [`float] Raw.t = "%identity" let of_array m : t = - if Array.length m <> 4 then invalid_arg "GlMatrix.of_array"; - let mat = Raw.create `double ~len:16 in + if Array.length m <> 4 then invalid_arg "GlMat.of_array"; + let mat = Raw.create `float ~len:16 in for i = 0 to 3 do let arr = Array.unsafe_get m i in - if Array.length arr <> 4 then invalid_arg "GlMatrix.of_array"; + if Array.length arr <> 4 then invalid_arg "GlMat.of_array"; Raw.sets_float mat ~pos:(i*4) arr done; mat Index: src/Makefile =================================================================== --- src/Makefile (.../vendor/lablgl/1.04) (revision 709) +++ src/Makefile (.../trunk/lablgles) (revision 709) @@ -12,52 +12,53 @@ # Files LIBOBJS = raw.cmo \ - gl.cmo glLight.cmo glList.cmo glMap.cmo \ + gl.cmo glLight.cmo \ glMat.cmo glMisc.cmo glPix.cmo glClear.cmo \ - glTex.cmo glDraw.cmo glFunc.cmo gluMisc.cmo \ - gluNurbs.cmo gluQuadric.cmo gluTess.cmo gluMat.cmo \ - glArray.cmo + glTex.cmo glDraw.cmo glFunc.cmo glArray.cmo \ + glFramebuffer.cmo MLOBJS = $(LIBOBJS) togl.cmo OPTOBJS = $(LIBOBJS:.cmo=.cmx) -COBJS = ml_gl$(XO) ml_glu$(XO) ml_raw$(XO) ml_glarray$(XO) \ - ml_glutess$(XO) +COBJS = ml_gl$(XO) ml_raw$(XO) ml_glarray$(XO) ml_glframe$(XO) TOGLOBJS = ml_togl$(XO) $(TOGLDIR)/togl$(XO) -all: var2def$(XE) var2switch$(XE) lablgl.cma +all: var2def$(XE) var2switch$(XE) lablgles.cma -opt: lablgl.cmxa +opt: lablgles.cmxa var2def$(XE): var2def.ml - $(LINKER) -pp camlp4o var2def.ml -o $@ + $(LINKER) -pp $(CAMLP4O) var2def.ml -o $@ var2switch$(XE): var2switch.ml - $(LINKER) -pp camlp4o var2switch.ml -o $@ + $(LINKER) -pp $(CAMLP4O) var2switch.ml -o $@ +varcheck$(XE): varcheck.ml + $(LINKER) -pp $(CAMLP4O) varcheck.ml -o $@ + +unknown-tags: varcheck + varcheck *.var gl*.mli > unknown-tags + ifeq ($(TOOLCHAIN), msvc) -liblablgl$(XA): $(COBJS) +liblablgles$(XA): $(COBJS) $(MKLIB)$@ $(COBJS) -dlllablgl.dll: $(COBJS:$(XO)=.d$(XO)) +dlllablgles.dll: $(COBJS:$(XO)=.d$(XO)) $(MKDLL)$@ $(COBJS:$(XO)=.d$(XO)) $(GLLIBS) $(OCAMLDLL) -lablgl.cma: liblablgl$(XA) dlllablgl.dll $(LIBOBJS) $(CONFIG) +lablgles.cma: liblablgles$(XA) dlllablgles.dll $(LIBOBJS) $(CONFIG) $(LINKER) -a -o $@ $(LIBOBJS) \ - -cclib -llablgl -dllib -llablgl \ + -cclib -llablgles -dllib -llablgles \ -cclib "$(GLLIBS)" -lablgl.cmxa: liblablgl$(XA) $(OPTOBJS) $(CONFIG) - $(OPTLINK) -a -o $@ $(OPTOBJS) -cclib -llablgl \ +lablgles.cmxa: liblablgles$(XA) $(OPTOBJS) $(CONFIG) + $(OPTLINK) -a -o $@ $(OPTOBJS) -cclib -llablgles \ -cclib "$(GLLIBS)" else -liblablgl$(XA) lablgl.cma: $(COBJS) $(LIBOBJS) $(CONFIG) - $(LIBRARIAN) -o lablgl $(COBJS) $(LIBOBJS) $(GLLIBS) $(XLIBS) -lablgl.cmxa: $(COBJS) $(OPTOBJS) $(CONFIG) - $(LIBRARIAN) -o lablgl $(COBJS) $(OPTOBJS) $(GLLIBS) $(XLIBS) +liblablgles$(XA) lablgles.cma: $(COBJS) $(LIBOBJS) $(CONFIG) + $(LIBRARIAN) -o lablgles $(COBJS) $(LIBOBJS) $(GLLIBS) $(XLIBS) +lablgles.cmxa: $(COBJS) $(OPTOBJS) $(CONFIG) + $(LIBRARIAN) -o lablgles $(COBJS) $(OPTOBJS) $(GLLIBS) $(XLIBS) endif gl_tags.c: gl_tags.var $(VAR2SWITCH) -table GL_ < gl_tags.var > $@ -glu_tags.c: glu_tags.var - $(VAR2SWITCH) GLU_ < glu_tags.var > $@ - build.ml: build.ml.in ../Makefile.config sed -e "s|@LABLGL_MLS@|$(LIBOBJS:.cmo=)|" \ -e "s|@TOGL_MLS@|togl|" \ @@ -69,27 +70,26 @@ preinstall: build.ml if test -d "$(INSTALLDIR)"; then : ; else mkdir -p "$(INSTALLDIR)"; fi cp build.ml $(LIBOBJS:.cmo=.ml) $(LIBOBJS:.cmo=.mli) "$(INSTALLDIR)" - cp liblablgl$(XA) "$(INSTALLDIR)" - cd "$(INSTALLDIR)" && $(RANLIB) liblablgl$(XA) - if test -f dlllablgl$(XS); then cp dlllablgl$(XS) "$(DLLDIR)"; fi + cp liblablgles$(XA) "$(INSTALLDIR)" + cd "$(INSTALLDIR)" && $(RANLIB) liblablgles$(XA) + if test -f dlllablgles$(XS); then cp dlllablgles$(XS) "$(DLLDIR)"; fi install: preinstall - cp $(LIBOBJS:.cmo=.cmi) lablgl.cma "$(INSTALLDIR)" - @if test -f lablgl.cmxa; then $(MAKE) installopt; fi + cp $(LIBOBJS:.cmo=.cmi) lablgles.cma "$(INSTALLDIR)" + @if test -f lablgles.cmxa; then $(MAKE) installopt; fi installopt: - cp lablgl.cmxa lablgl$(XA) $(LIBOBJS:.cmo=.cmx) "$(INSTALLDIR)" - cd "$(INSTALLDIR)" && $(RANLIB) lablgl$(XA) + cp lablgles.cmxa lablgles$(XA) $(LIBOBJS:.cmo=.cmx) "$(INSTALLDIR)" + cd "$(INSTALLDIR)" && $(RANLIB) lablgles$(XA) clean: rm -f *.cm* *.a *.o *.so *.lib *.obj *.exe *.opt *_tags.c *_tags.h *~ \ - *.dll var2def$(XE) var2switch$(XE) lablgltop$(XE) lablgl$(XB) + *.dll var2def$(XE) var2switch$(XE) lablglestop$(XE) lablgles$(XB) depend: - ocamldep -pp camlp4o *.ml *.mli > .depend + ocamldep -pp $(CAMLP4O) *.ml *.mli > .depend #dependencies ml_gl$(XO): ml_gl.h gl_tags.h gl_tags.c ml_raw.h -ml_glu$(XO) ml_glutess$(XO) : ml_gl.h ml_glu.h glu_tags.h glu_tags.c ml_raw$(XO): raw_tags.h ml_raw.h include .depend Index: src/.depend =================================================================== --- src/.depend (.../vendor/lablgl/1.04) (revision 709) +++ src/.depend (.../trunk/lablgles) (revision 709) @@ -1,60 +1,33 @@ -build.cmo: -build.cmx: gl.cmo: gl.cmi gl.cmx: gl.cmi glArray.cmo: raw.cmi glDraw.cmi gl.cmi glArray.cmi glArray.cmx: raw.cmx glDraw.cmx gl.cmx glArray.cmi glClear.cmo: gl.cmi glClear.cmi glClear.cmx: gl.cmx glClear.cmi -glDraw.cmo: raw.cmi glPix.cmi gl.cmi glDraw.cmi -glDraw.cmx: raw.cmx glPix.cmx gl.cmx glDraw.cmi +glDraw.cmo: gl.cmi glDraw.cmi +glDraw.cmx: gl.cmx glDraw.cmi +glFramebuffer.cmo: glTex.cmi glFramebuffer.cmi +glFramebuffer.cmx: glTex.cmx glFramebuffer.cmi glFunc.cmo: gl.cmi glFunc.cmi glFunc.cmx: gl.cmx glFunc.cmi glLight.cmo: gl.cmi glLight.cmi glLight.cmx: gl.cmx glLight.cmi -glList.cmo: glList.cmi -glList.cmx: glList.cmi -glMap.cmo: raw.cmi glMap.cmi -glMap.cmx: raw.cmx glMap.cmi glMat.cmo: raw.cmi glMat.cmi glMat.cmx: raw.cmx glMat.cmi -glMisc.cmo: raw.cmi glMisc.cmi -glMisc.cmx: raw.cmx glMisc.cmi +glMisc.cmo: glMisc.cmi +glMisc.cmx: glMisc.cmi glPix.cmo: raw.cmi gl.cmi glPix.cmi glPix.cmx: raw.cmx gl.cmx glPix.cmi glTex.cmo: raw.cmi glPix.cmi glMisc.cmi gl.cmi glTex.cmi glTex.cmx: raw.cmx glPix.cmx glMisc.cmx gl.cmx glTex.cmi -gluMat.cmo: gl.cmi gluMat.cmi -gluMat.cmx: gl.cmx gluMat.cmi -gluMisc.cmo: raw.cmi glTex.cmi glPix.cmi gl.cmi gluMisc.cmi -gluMisc.cmx: raw.cmx glTex.cmx glPix.cmx gl.cmx gluMisc.cmi -gluNurbs.cmo: raw.cmi glMap.cmi gl.cmi gluNurbs.cmi -gluNurbs.cmx: raw.cmx glMap.cmx gl.cmx gluNurbs.cmi -gluQuadric.cmo: gluQuadric.cmi -gluQuadric.cmx: gluQuadric.cmi -gluTess.cmo: gluTess.cmi -gluTess.cmx: gluTess.cmi raw.cmo: raw.cmi raw.cmx: raw.cmi -var2def.cmo: -var2def.cmx: -var2switch.cmo: -var2switch.cmx: -gl.cmi: glArray.cmi: raw.cmi glDraw.cmi glClear.cmi: gl.cmi -glDraw.cmi: glPix.cmi gl.cmi +glDraw.cmi: gl.cmi +glFramebuffer.cmi: glTex.cmi glFunc.cmi: gl.cmi glLight.cmi: gl.cmi -glList.cmi: -glMap.cmi: raw.cmi glMat.cmi: raw.cmi gl.cmi -glMisc.cmi: raw.cmi glPix.cmi: raw.cmi gl.cmi -glTex.cmi: glPix.cmi gl.cmi -gluMat.cmi: gl.cmi -gluMisc.cmi: glTex.cmi glPix.cmi gl.cmi -gluNurbs.cmi: raw.cmi glMap.cmi gl.cmi -gluQuadric.cmi: -gluTess.cmi: -raw.cmi: +glTex.cmi: raw.cmi glPix.cmi gl.cmi Index: src/glFramebuffer.ml =================================================================== --- src/glFramebuffer.ml (.../vendor/lablgl/1.04) (revision 0) +++ src/glFramebuffer.ml (.../trunk/lablgles) (revision 709) @@ -0,0 +1,120 @@ +(* glFramebuffer.ml Framebuffer object extension of OpenGL ES + * + * http://khronos.org/registry/gles/extensions/OES/OES_framebuffer_object.txt + *) +type renderbuffer_id = int32 + +let (renderbuffer0: renderbuffer_id) = 0l + +type rendertarget = [ `renderbuffer ] + +type renderfmt = + (* For color; last 2 are optional (not available in all implementations) *) + [ `rgb565 | `rgba4 | `rgb5_a1 | `rgba8 | `rgb8 + (* For depth; last 2 are optional *) + | `depth_component16 | `depth_component24 | `depth_component32 + (* For stencil; all are optional *) + | `stencil_index1 | `stencil_index4 | `stencil_index8 + ] + +type renderparam = + [ `width | `height | `red_size | `green_size | `blue_size + | `alpha_size | `depth_size | `stencil_size + ] + +type renderparam_fmt = [ `internal_format ] + +type id = int32 (* Framebuffer id *) + +let (framebuffer0 : id) = 0l + +type target = [ `framebuffer ] + +type status = + [ `complete | `incomplete_attachment | `incomplete_missing_attachment + | `incomplete_dimensions | `incomplete_formats | `unsupported + ] + +type attachment = [ `color0 | `depth | `stencil ] + +type textarget = [ `texture_2d ] + +type attachtype = + [ `none + | `renderbuffer of renderbuffer_id + | `texture of GlTex.texture_id + ] + +type enumeration = + [ `renderbuffer ] + +external is_renderbuffer : renderbuffer_id -> bool = + "ml_glIsRenderbufferOES" + +external bind_renderbuffer : rendertarget -> renderbuffer_id -> unit = + "ml_glBindRenderbufferOES" + +external delete_renderbuffer : renderbuffer_id -> unit = + "ml_glDeleteRenderbuffer" + +let delete_renderbuffers ids = + Array.iter (fun id -> delete_renderbuffer id) ids + +external gen_renderbuffer : unit -> renderbuffer_id = + "ml_glGenRenderbuffer" + +let gen_renderbuffers n = + Array.init n (fun _ -> gen_renderbuffer ()) + +external renderbuffer_storage : + rendertarget -> renderfmt -> int -> int -> unit = + "ml_glRenderbufferStorageOES" + +external get_renderbuffer_parameter : rendertarget -> renderparam -> int = + "ml_glGetRenderbufferParameter" + +external get_renderbuffer_parameter_fmt : + rendertarget -> renderparam_fmt -> renderfmt = + "ml_glGetRenderbufferParameter_fmt" + +external is_framebuffer : id -> bool = + "ml_glIsFramebufferOES" + +external bind_framebuffer : target -> id -> unit = + "ml_glBindFramebufferOES" + +external delete_framebuffer : id -> unit = + "ml_glDeleteFramebuffer" + +let delete_framebuffers ids = + Array.iter (fun id -> delete_framebuffer id) ids + +external gen_framebuffer : unit -> id = + "ml_glGenFramebuffer" + +let gen_framebuffers n = + Array.init n (fun _ -> gen_framebuffer ()) + +external check_status : target -> status = + "ml_glCheckFramebufferStatus" + +external renderbuffer : + target -> attachment -> rendertarget -> renderbuffer_id -> unit = + "ml_glFramebufferRenderbuffer" + +external texture2d : + target -> attachment -> textarget -> GlTex.texture_id -> int -> unit = + "ml_glFramebufferTexture2D" + +(* Simplified version of glGetFramebufferAttachmentParameter + *) +external get_attachment_type : target -> attachment -> attachtype = + "ml_glGetAttachmentType" + +external generate_mipmap : textarget -> unit = + "ml_glGenerateMipmapOES" + +(* Translate an enumerated variant to its GL_XXX integer equivalent. + *) +external code : enumeration -> int = + "ml_glTranslateEnum" Index: src/glArray.mli =================================================================== --- src/glArray.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glArray.mli (.../trunk/lablgles) (revision 709) @@ -1,39 +1,35 @@ (** Vertex array manipulation functions *) (* $Id: glArray.mli,v 1.7 2008/10/25 02:22:58 garrigue Exp $ *) -(** The six different kinds for array *) +(** The different kinds for array *) type kind = - [ `color | `edge_flag | `index | `normal | `texture_coord | `vertex ] - -(** Tell openGL the address of the edgeFlag array. + [`point_size | `texture_coord | `color | `normal | `vertex] + +(** Tell openGL the address of the pointSize array Raw array must be static. *) -val edge_flag : [ `bitmap ] Raw.t -> unit +val pointsize : [ `float ] Raw.t -> unit (** Tell openGL the address of the texCoor array Raw array must be static. *) val tex_coord : - [< `one | `two | `three | `four] -> - [< `double | `float | `int | `short ] Raw.t -> unit + [< `two | `three | `four] -> + [< `ubyte | `short | `float] Raw.t -> unit (** Tell openGL the address of the color array Raw array must be static. *) val color : - [< `three | `four] -> - [< `byte | `double | `float | `int | `short | `ubyte | `uint | `ushort ] + [< `four] -> + [< `ubyte | `float] Raw.t -> unit -(** Tell openGL the address of the index array - Raw array must be static. *) -val index : [< `double | `float | `int | `short | `ubyte ] Raw.t -> unit - (** Tell openGL the address of the normal array Raw array must be static. *) -val normal : [< `byte | `double | `float | `int | `short ] Raw.t -> unit +val normal : [< `byte | `short | `float] Raw.t -> unit (** Tell openGL the address of the vertex array Raw array must be static. *) val vertex : - [< `two | `three | `four] -> [< `double | `float | `int | `short ] Raw.t + [< `two | `three | `four] -> [< `byte | `short | `float] Raw.t -> unit (** Tell openGL the address of to use the specified array @@ -41,13 +37,9 @@ external enable : kind -> unit = "ml_glEnableClientState" (** Tell openGL the address of not to use the specified array - Raw array must be static. *) + Raw array must be static. *) external disable : kind -> unit = "ml_glDisableClientState" -(* GlArray.element i - sends to openGL the element i of all enabled arrays *) -external element : int -> unit = "ml_glArrayElement" - (* GlArray.draw_arrays shape i c sends to openGL a GlDraw.begins shape and all the element from i to i+c-1 of all enabled arrays and finally do a GlDraw.ends () *) Index: src/gl.mli =================================================================== --- src/gl.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/gl.mli (.../trunk/lablgles) (revision 709) @@ -20,15 +20,9 @@ type real_kind = [`byte|`float|`int|`short|`ubyte|`uint|`ushort] type format = - [`alpha|`blue|`color_index|`depth_component|`green|`luminance - |`luminance_alpha|`red|`rgb|`rgba|`stencil_index] + [`alpha|`luminance |`luminance_alpha|`rgb|`rgba|`bgra] val format_size : [< format] -> int -type target = - [`color_4|`index|`normal|`texture_coord_1|`texture_coord_2|`texture_coord_3 - |`texture_coord_4|`trim_2|`trim_3|`vertex_3|`vertex_4] -val target_size : [< target] -> int - type cmp_func = [`always|`equal|`gequal|`greater|`lequal|`less|`never|`notequal] type face = [`back|`both|`front] @@ -39,26 +33,20 @@ val finish : unit -> unit type cap = - [`alpha_test|`auto_normal|`blend|`clip_plane0|`clip_plane1|`clip_plane2 - |`clip_plane3|`clip_plane4|`clip_plane5|`color_material|`cull_face - |`depth_test|`dither|`fog|`light0|`light1|`light2|`light3|`light4|`light5 - |`light6|`light7|`lighting|`line_smooth|`line_stipple - |`index_logic_op |`color_logic_op - |`map1_color_4|`map1_index|`map1_normal|`map1_texture_coord_1 - |`map1_texture_coord_2|`map1_texture_coord_3|`map1_texture_coord_4 - |`map1_vertex_3|`map1_vertex_4|`map2_color_4|`map2_index|`map2_normal - |`map2_texture_coord_1|`map2_texture_coord_2|`map2_texture_coord_3 - |`map2_texture_coord_4|`map2_vertex_3|`map2_vertex_4|`normalize|`point_smooth - |`polygon_offset_fill|`polygon_offset_line|`polygon_offset_point - |`polygon_smooth|`polygon_stipple|`scissor_test|`stencil_test|`texture_1d - |`texture_2d|`texture_gen_q|`texture_gen_r|`texture_gen_s|`texture_gen_t] + [`fog | `lighting | `texture_2d | `cull_face | `alpha_test | `blend + |`color_logic_op | `dither | `stencil_test | `depth_test | `light0 + |`light1 | `light2 | `light3 | `light4 | `light5 | `light6 | `light7 + |`point_smooth | `line_smooth | `scissor_test | `color_material + |`normalize | `rescale_normal | `polygon_offset_fill | `multisample + |`sample_alpha_to_coverage | `sample_alpha_to_one | `sample_coverage ] + val enable : cap -> unit val disable : cap -> unit val is_enabled : cap -> bool type error = [`no_error|`invalid_enum|`invalid_value|`invalid_operation - |`stack_overflow|`stack_underflow|`out_of_memory|`table_too_large] + |`stack_overflow|`stack_underflow|`out_of_memory] val get_error : unit -> error val raise_error : string -> unit (* raise GLerror if there is a current error, otherwise do nothing *) Index: src/glFramebuffer.mli =================================================================== --- src/glFramebuffer.mli (.../vendor/lablgl/1.04) (revision 0) +++ src/glFramebuffer.mli (.../trunk/lablgles) (revision 709) @@ -0,0 +1,78 @@ +(* glFramebuffer.mli Framebuffer object extension of OpenGL ES + * + * http://khronos.org/registry/gles/extensions/OES/OES_framebuffer_object.txt + *) +type renderbuffer_id + +(* Reserved renderbuffer id 0, representing no renderbuffer. + *) +val renderbuffer0 : renderbuffer_id + +type rendertarget = [ `renderbuffer ] + +type renderfmt = + (* For color; last 2 are optional (not available in all implementations) *) + [ `rgb565 | `rgba4 | `rgb5_a1 | `rgba8 | `rgb8 + (* For depth; last 2 are optional *) + | `depth_component16 | `depth_component24 | `depth_component32 + (* For stencil; all are optional *) + | `stencil_index1 | `stencil_index4 | `stencil_index8 + ] + +type renderparam = + [ `width | `height | `red_size | `green_size | `blue_size + | `alpha_size | `depth_size | `stencil_size + ] + +type renderparam_fmt = [ `internal_format ] + +type id (* Framebuffer id *) + +(* Reserved framebuffer id 0, representing no framebuffer object. + *) +val framebuffer0 : id + +type target = [ `framebuffer ] + +type status = + [ `complete | `incomplete_attachment | `incomplete_missing_attachment + | `incomplete_dimensions | `incomplete_formats | `unsupported + ] + +type attachment = [ `color0 | `depth | `stencil ] + +type textarget = [ `texture_2d ] + +type attachtype = + [ `none + | `renderbuffer of renderbuffer_id + | `texture of GlTex.texture_id + ] + +type enumeration = + [ `renderbuffer ] + +val is_renderbuffer : renderbuffer_id -> bool +val bind_renderbuffer : rendertarget -> renderbuffer_id -> unit +val delete_renderbuffer : renderbuffer_id -> unit +val delete_renderbuffers : renderbuffer_id array -> unit +val gen_renderbuffer : unit -> renderbuffer_id +val gen_renderbuffers : int -> renderbuffer_id array +val renderbuffer_storage : rendertarget -> renderfmt -> int -> int -> unit +val get_renderbuffer_parameter : rendertarget -> renderparam -> int +val get_renderbuffer_parameter_fmt : + rendertarget -> renderparam_fmt -> renderfmt +val is_framebuffer : id -> bool +val bind_framebuffer : target -> id -> unit +val delete_framebuffer : id -> unit +val delete_framebuffers : id array -> unit +val gen_framebuffer : unit -> id +val gen_framebuffers : int -> id array +val check_status : target -> status +val renderbuffer : + target -> attachment -> rendertarget -> renderbuffer_id -> unit +val texture2d : + target -> attachment -> textarget -> GlTex.texture_id -> int -> unit +val get_attachment_type : target -> attachment -> attachtype +val generate_mipmap : textarget -> unit +val code : enumeration -> int Index: src/glDraw.ml =================================================================== --- src/glDraw.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glDraw.ml (.../trunk/lablgles) (revision 709) @@ -4,53 +4,29 @@ external color : red:float -> green:float -> blue:float -> alpha:float -> unit - = "ml_glColor4d" + = "ml_glColor4f" let color ?(alpha=1.) (red, green, blue : rgb) = color ~red ~green ~blue ~alpha -external index : float -> unit = "ml_glIndexd" - external cull_face : face -> unit = "ml_glCullFace" -external edge_flag : bool -> unit = "ml_glEdgeFlag" external front_face : [`cw|`ccw] -> unit = "ml_glFrontFace" external line_width : float -> unit = "ml_glLineWidth" -external line_stipple : factor:int -> pattern:short -> unit - = "ml_glLineStipple" -let line_stipple ?(factor=1) pattern = - line_stipple ~factor ~pattern external point_size : float -> unit = "ml_glPointSize" external polygon_offset : factor:float -> units:float -> unit = "ml_glPolygonOffset" -external polygon_mode : face:face -> [`point|`line|`fill] -> unit - = "ml_glPolygonMode" -external polygon_stipple : [`bitmap] Raw.t -> unit = "ml_glPolygonStipple" -let polygon_stipple (img : GlPix.bitmap) = - if GlPix.height img <> 32 or GlPix.width img <> 32 - then invalid_arg "GlDraw.polygon_stipple"; - polygon_stipple (GlPix.to_raw img) external shade_model : [`flat|`smooth] -> unit = "ml_glShadeModel" type shape = - [ `points | `lines | `polygon | `triangles | `quads | `line_strip - | `line_loop | `triangle_strip | `triangle_fan | `quad_strip ] -external begins : shape -> unit = "ml_glBegin" -external ends : unit -> unit = "ml_glEnd" + [ `points | `lines | `triangles | `line_strip + | `line_loop | `triangle_strip | `triangle_fan ] external normal : x:float -> y:float -> z:float -> unit - = "ml_glNormal3d" + = "ml_glNormal3f" let normal ?(x=0.) ?(y=0.) ?(z=0.) () = normal ~x ~y ~z and normal3 (x,y,z) = normal ~x ~y ~z -external rect : point2 -> point2 -> unit = "ml_glRectd" - -external vertex : x:float -> y:float -> ?z:float -> ?w:float -> unit -> unit - = "ml_glVertex" -let vertex2 (x,y : point2) = vertex ~x ~y () -and vertex3 (x,y,z : point3) = vertex ~x ~y ~z () -and vertex4 (x,y,z,w : point4) = vertex ~x ~y ~z ~w () - external viewport : x:int -> y:int -> w:int -> h:int -> unit = "ml_glViewport" Index: src/varcheck.ml =================================================================== --- src/varcheck.ml (.../vendor/lablgl/1.04) (revision 0) +++ src/varcheck.ml (.../trunk/lablgles) (revision 709) @@ -0,0 +1,112 @@ +(* varcheck.ml Find variants that aren't defined as tags + *) +open StdLabels +open Genlex + +let lexer = make_lexer ["->"; "$$"] + +(* Naive definitions of character types for now. + *) +let isgrave_o = + function + | None -> false + | Some c -> c = '`' + +let isspace_o = + function + | None -> false + | Some c -> c = ' ' || c = '\n' || c = '\t' + +let isalnum_o = + function + | None -> false + | Some c -> + (c >= 'a' && c <= 'z') || + (c >= 'A' && c <= 'Z') || + (c >= '0' && c <= '9') || + c = '_' || c = '\'' + +let getident str = + let b = Buffer.create 32 + in let () = + begin + while isspace_o (Stream.peek str) do + Stream.junk str + done; + while isalnum_o (Stream.peek str) do + Buffer.add_char b (Stream.next str); + done; + end + in + Buffer.contents b + + +let rec gettag str = + let skippable co = + co <> None && not (isgrave_o co) + in + let () = + begin + while skippable (Stream.peek str) do + Stream.junk str + done; + if Stream.peek str = None then + raise End_of_file; + Stream.junk str; + end + in + getident str + + +let checkfile tags fn = + let str = Stream.of_channel (open_in fn) + in + try + while true do + let tag = gettag str + in + if not (Hashtbl.mem tags tag) then + Printf.printf "%s: unknown tag %s\n" fn tag + done + with End_of_file -> () + +let tags_file_name s = + let slen = String.length s + in + slen > 4 && String.sub s (slen - 4) 4 = ".var" + + +let gettags tags fn = + let s = lexer (Stream.of_channel (open_in fn)) in + try while true do match s with parser + [< ' Ident tag >] -> Hashtbl.add tags tag () + | [< ' Kwd "->"; ' Ident _ >] -> () + | [< ' Kwd "$$" >] -> () + | [< >] -> raise End_of_file + done with End_of_file -> () + + +let main () = + begin + if Array.length Sys.argv < 2 || not (tags_file_name Sys.argv.(1)) then + begin + Printf.fprintf stderr "varcheck: need at least one tags file\n"; + exit 1; + end; + let tags = Hashtbl.create 57 in + let rec get i = + if i < Array.length Sys.argv && tags_file_name Sys.argv.(i) then + begin + gettags tags Sys.argv.(i); + get (i + 1); + end + else + i + in + let start_ix = get 1 in + for i = start_ix to Array.length Sys.argv - 1 do + checkfile tags Sys.argv.(i); + done + end + +let _ = Printexc.print main () Index: src/glFunc.mli =================================================================== --- src/glFunc.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glFunc.mli (.../trunk/lablgles) (revision 709) @@ -1,7 +1,5 @@ (* $Id: glFunc.mli,v 1.4 2000/04/03 02:57:41 garrigue Exp $ *) -val accum : op:[`accum|`add|`load|`mult|`return] -> float -> unit - val alpha_func : Gl.cmp_func -> ref:Gl.clampf -> unit type sfactor = @@ -19,8 +17,6 @@ val depth_mask : bool -> unit val depth_range : near:float -> far:float -> unit -val index_mask : int -> unit - val stencil_func : Gl.cmp_func -> ref:int -> mask:int -> unit val stencil_mask : int -> unit type stencil_op = [`decr|`incr|`invert|`keep|`replace|`zero] @@ -31,13 +27,3 @@ [`And|`Or|`and_inverted|`and_reverse|`clear|`copy|`copy_inverted|`equiv |`invert|`nand|`noop|`nor|`or_inverted|`or_reverse|`set|`xor] val logic_op : logic_op -> unit - -type draw_buffer = - [`aux of int|`back|`back_left|`back_right|`front|`front_and_back|`front_left - |`front_right|`left|`none|`right] -val draw_buffer : draw_buffer -> unit - -type read_buffer = - [`aux of int|`back|`back_left|`back_right|`front|`front_left|`front_right - |`left|`right] -val read_buffer : read_buffer -> unit Index: src/glMisc.mli =================================================================== --- src/glMisc.mli (.../vendor/lablgl/1.04) (revision 709) +++ src/glMisc.mli (.../trunk/lablgles) (revision 709) @@ -10,29 +10,7 @@ (* Speed hint *) type hint_target = - [`fog|`line_smooth|`perspective_correction|`point_smooth|`polygon_smooth] + [`fog|`line_smooth|`perspective_correction|`point_smooth|`generate_mipmap] val hint : hint_target -> [`fastest|`nicest|`dont_care] -> unit -(* Names *) -val init_names : unit -> unit -val load_name : int -> unit -val push_name : int -> unit -val pop_name : unit -> unit - -type attrib = - [ `accum_buffer|`color_buffer|`current|`depth_buffer|`enable|`eval|`fog - | `hint|`lighting|`line|`list|`pixel_mode|`point|`polygon|`polygon_stipple - | `scissor|`stencil_buffer|`texture|`transform|`viewport ] -val push_attrib : attrib list -> unit -val pop_attrib : unit -> unit - -val render_mode : [`feedback|`render|`select] -> int -val pass_through : float -> unit -val select_buffer : [`uint] Raw.t -> unit - (* argument must be a static Raw.t *) -type feedback_mode = - [`_2d |`_3d |`_3d_color |`_3d_color_texture |`_4d_color_texture] -val feedback_buffer : mode:feedback_mode -> [`float] Raw.t -> unit - (* argument must be a static Raw.t *) - val scissor : x:int -> y:int -> width:int -> height:int -> unit Index: src/glLight.ml =================================================================== --- src/glLight.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/glLight.ml (.../trunk/lablgles) (revision 709) @@ -2,17 +2,11 @@ open Gl -type color_material = - [`emission|`ambient|`diffuse|`specular|`ambient_and_diffuse] -external color_material : face:face -> color_material -> unit - = "ml_glColorMaterial" - type fog_param = [ `mode of [`linear|`exp|`exp2] | `density of float | `start of float | `End of float - | `index of float | `color of rgba ] external fog : fog_param -> unit = "ml_glFog" @@ -34,9 +28,7 @@ type light_model_param = [ `ambient of rgba - | `local_viewer of bool | `two_side of bool - | `color_control of [`separate_specular_color | `single_color] ] external light_model : light_model_param -> unit = "ml_glLightModel" @@ -47,7 +39,6 @@ | `emission of rgba | `shininess of float | `ambient_and_diffuse of rgba - | `color_indexes of (float * float * float) ] external material : face:face -> material_param -> unit = "ml_glMaterial" Index: src/gl.ml =================================================================== --- src/gl.ml (.../vendor/lablgl/1.04) (revision 709) +++ src/gl.ml (.../trunk/lablgles) (revision 709) @@ -22,24 +22,15 @@ type real_kind = [`byte|`float|`int|`short|`ubyte|`uint|`ushort] type format = - [`alpha|`blue|`color_index|`depth_component|`green|`luminance - |`luminance_alpha|`red|`rgb|`rgba|`stencil_index] + [`alpha|`luminance |`luminance_alpha|`rgb|`rgba|`bgra] let format_size (#format as f) = match f with `rgba -> 4 + | `bgra -> 4 | `rgb -> 3 | `luminance_alpha -> 2 | _ -> 1 -type target = - [`color_4|`index|`normal|`texture_coord_1|`texture_coord_2|`texture_coord_3 - |`texture_coord_4|`trim_2|`trim_3|`vertex_3|`vertex_4] -let target_size = function - `index|`normal|`texture_coord_1 -> 1 - | `texture_coord_2|`trim_2 -> 2 - | `vertex_3|`texture_coord_3|`trim_3 -> 3 - | `vertex_4|`color_4|`texture_coord_4 -> 4 - type cmp_func = [`always|`equal|`gequal|`greater|`lequal|`less|`never|`notequal] type face = [`back|`both|`front] @@ -50,27 +41,20 @@ external finish : unit -> unit = "ml_glFinish" type cap = - [`alpha_test|`auto_normal|`blend|`clip_plane0|`clip_plane1|`clip_plane2 - |`clip_plane3|`clip_plane4|`clip_plane5|`color_material|`cull_face - |`depth_test|`dither|`fog|`light0|`light1|`light2|`light3|`light4|`light5 - |`light6|`light7|`lighting|`line_smooth|`line_stipple - |`index_logic_op |`color_logic_op - |`map1_color_4|`map1_index|`map1_normal|`map1_texture_coord_1 - |`map1_texture_coord_2|`map1_texture_coord_3|`map1_texture_coord_4 - |`map1_vertex_3|`map1_vertex_4|`map2_color_4|`map2_index|`map2_normal - |`map2_texture_coord_1|`map2_texture_coord_2|`map2_texture_coord_3 - |`map2_texture_coord_4|`map2_vertex_3|`map2_vertex_4|`normalize|`point_smooth - |`polygon_offset_fill|`polygon_offset_line|`polygon_offset_point - |`polygon_smooth|`polygon_stipple|`scissor_test|`stencil_test|`texture_1d - |`texture_2d|`texture_gen_q|`texture_gen_r|`texture_gen_s|`texture_gen_t] - + [`fog | `lighting | `texture_2d | `cull_face | `alpha_test | `blend + |`color_logic_op | `dither | `stencil_test | `depth_test | `light0 + |`light1 | `light2 | `light3 | `light4 | `light5 | `light6 | `light7 + |`point_smooth | `line_smooth | `scissor_test | `color_material + |`normalize | `rescale_normal | `polygon_offset_fill | `multisample + |`sample_alpha_to_coverage | `sample_alpha_to_one | `sample_coverage ] + external enable : cap -> unit = "ml_glEnable" external disable : cap -> unit = "ml_glDisable" external is_enabled : cap -> bool = "ml_glIsEnabled" type error = [`no_error|`invalid_enum|`invalid_value|`invalid_operation - |`stack_overflow|`stack_underflow|`out_of_memory|`table_too_large] + |`stack_overflow|`stack_underflow|`out_of_memory] external get_error : unit -> error = "ml_glGetError" let raise_error name = let err = get_error () in @@ -82,8 +66,7 @@ `invalid_operation, "Invalid Operation"; `stack_overflow, "Stack Overflow"; `stack_underflow, "Stack Underflow"; - `out_of_memory, "Out of Memory"; - `table_too_large, "Table Too Large" ] + `out_of_memory, "Out of Memory" ] in let s = if name = "" then s else (name ^ ": " ^ s) in raise (GLerror s) Index: src/ml_gl.c =================================================================== --- src/ml_gl.c (.../vendor/lablgl/1.04) (revision 709) +++ src/ml_gl.c (.../trunk/lablgles) (revision 709) @@ -5,12 +5,13 @@ #endif #include #ifdef __APPLE__ -#include +#include +#include #else -#include +#include #endif #ifdef HAS_GLEXT_H -#include +#include #undef GL_VERSION_1_3 #endif #include @@ -23,12 +24,7 @@ #include "gl_tags.h" #include "ml_gl.h" -#if !defined(GL_VERSION_1_4) -#define GL_GENERATE_MIPMAP 0x8191 -#endif -/* #include */ - void ml_raise_gl(const char *errmsg) { static value * gl_exn = NULL; @@ -37,12 +33,17 @@ raise_with_string(*gl_exn, (char*)errmsg); } -value copy_string_check (const char *str) +value copy_string_check (const unsigned char *str) { if (!str) ml_raise_gl("Null string"); return copy_string ((char*) str); } +value copy_string_lenient(const unsigned char *str) +{ + return copy_string (str == NULL ? "" : (char *) str); +} + struct record { value key; GLenum data; @@ -102,24 +103,18 @@ } */ -ML_2 (glAccum, GLenum_val, Float_val) ML_2 (glAlphaFunc, GLenum_val, Float_val) -ML_1 (glBegin, GLenum_val) - -ML_5 (glBitmap, Int_val, Int_val, Pair(arg3,Float_val,Float_val), - Pair(arg4,Float_val,Float_val), Void_raw) - ML_2 (glBlendFunc, GLenum_val, GLenum_val) -CAMLprim value ml_glClipPlane(value plane, value equation) /* ML */ +CAMLprim value ml_glClipPlanef(value plane, value equation) /* ML */ { - double eq[4]; + GLfloat eq[4]; int i; for (i = 0; i < 4; i++) - eq[i] = Double_val (Field(equation,i)); - glClipPlane (GL_CLIP_PLANE0 + Int_val(plane), eq); + eq[i] = Float_val (Field(equation,i)); + glClipPlanef (GL_CLIP_PLANE0 + Int_val(plane), eq); return Val_unit; } @@ -133,8 +128,6 @@ accu |= GL_COLOR_BUFFER_BIT; break; case MLTAG_depth: accu |= GL_DEPTH_BUFFER_BIT; break; - case MLTAG_accum: - accu |= GL_ACCUM_BUFFER_BIT; break; case MLTAG_stencil: accu |= GL_STENCIL_BUFFER_BIT; break; } @@ -143,58 +136,29 @@ glClear (accu); return Val_unit; } -ML_4 (glClearAccum, Float_val, Float_val, Float_val, Float_val) -ML_4 (glClearColor, Double_val, Double_val, Double_val, Double_val) -ML_1 (glClearDepth, Double_val) -ML_1 (glClearIndex, Float_val) +ML_4 (glClearColor, Float_val, Float_val, Float_val, Float_val) +ML_1 (glClearDepthf, Float_val) ML_1 (glClearStencil, Int_val) -ML_4 (glColor4d, Double_val, Double_val, Double_val, Double_val) +ML_4 (glColor4f, Float_val, Float_val, Float_val, Float_val) ML_4 (glColorMask, Int_val, Int_val, Int_val, Int_val) -ML_2 (glColorMaterial, GLenum_val, GLenum_val) -ML_5 (glCopyPixels, Int_val, Int_val, Int_val, Int_val, GLenum_val) ML_1 (glCullFace, GLenum_val) ML_1 (glDisable, GLenum_val) ML_1 (glDepthFunc, GLenum_val) ML_1 (glDepthMask, Int_val) -ML_2 (glDepthRange, Double_val, Double_val) +ML_2 (glDepthRangef, Float_val, Float_val) -CAMLprim value ml_glDrawBuffer (value buffer) -{ - if (Is_block(buffer)) { - int n = Int_val (Field(buffer,1)); - if (n >= GL_AUX_BUFFERS) - ml_raise_gl ("GlFunc.draw_buffer : no such auxiliary buffer"); - glDrawBuffer (GL_AUX0 + n); - } - else glDrawBuffer (GLenum_val(buffer)); - return Val_unit; -} - -ML_4 (glDrawPixels, Int_val, Int_val, GLenum_val, Type_void_raw) - -ML_1 (glEdgeFlag, Int_val) ML_1 (glEnable, GLenum_val) -ML_0 (glEnd) -ML_1 (glEvalCoord1d, Double_val) -ML_2 (glEvalCoord2d, Double_val, Double_val) -ML_3 (glEvalMesh1, GLenum_val, Int_val, Int_val) -ML_5 (glEvalMesh2, GLenum_val, Int_val, Int_val, Int_val, Int_val) -ML_1 (glEvalPoint1, Int_val) -ML_2 (glEvalPoint2, Int_val, Int_val) - -ML_3 (glFeedbackBuffer, Int_val, GLenum_val, (GLfloat*)Addr_raw) - CAMLprim value ml_glFog (value param) /* ML */ { - float params[4]; + GLfloat params[4]; int i; switch (Field(param,0)) { case MLTAG_mode: - glFogi(GL_FOG_MODE, GLenum_val(Field(param,1))); + glFogf(GL_FOG_MODE, (GLfloat) GLenum_val(Field(param,1))); break; case MLTAG_density: glFogf(GL_FOG_DENSITY, Float_val(Field(param,1))); @@ -205,9 +169,6 @@ case MLTAG_End: glFogf(GL_FOG_END, Float_val(Field(param,1))); break; - case MLTAG_index: - glFogf(GL_FOG_INDEX, Float_val(Field(param,1))); - break; case MLTAG_color: for (i = 0; i < 4; i++) params[i] = Float_val(Field(Field(param,1),i)); glFogfv(GL_FOG_COLOR, params); @@ -219,12 +180,21 @@ ML_0 (glFlush) ML_0 (glFinish) ML_1 (glFrontFace, GLenum_val) -ML_3 (glFrustum, Pair(arg1,Double_val,Double_val), - Pair(arg2,Double_val,Double_val), Pair(arg3,Double_val,Double_val)) +ML_3 (glFrustumf, Pair(arg1,Float_val,Float_val), + Pair(arg2,Float_val,Float_val), Pair(arg3,Float_val,Float_val)) +#ifdef CONFIG_IOSSIM +/* When using the iPhone Simulator from the command line, glGetString() + * has been known to return NULL when things are otherwise working well. + * So treat a NULL return leniently. + */ +ML_1_ (glGetString, GLenum_val, copy_string_lenient) +#else ML_1_ (glGetString, GLenum_val, copy_string_check) -ML_2 (glGetDoublev, GLenum_val, Double_raw) +#endif +ML_2 (glGetFloatv, GLenum_val, Float_raw) + CAMLprim value ml_glGetError(value unit) { switch (glGetError()) { @@ -235,9 +205,6 @@ case GL_STACK_OVERFLOW: return MLTAG_stack_overflow; case GL_STACK_UNDERFLOW: return MLTAG_stack_underflow; case GL_OUT_OF_MEMORY: return MLTAG_out_of_memory; -#if defined(GL_VERSION_1_2) || defined(GL_TABLE_TOO_LARGE) - case GL_TABLE_TOO_LARGE: return MLTAG_table_too_large; -#endif default: ml_raise_gl("glGetError: unknown error"); } } @@ -252,15 +219,12 @@ case MLTAG_perspective_correction: targ = GL_PERSPECTIVE_CORRECTION_HINT; break; case MLTAG_point_smooth: targ = GL_POINT_SMOOTH_HINT; break; - case MLTAG_polygon_smooth: targ = GL_POLYGON_SMOOTH_HINT; break; + case MLTAG_generate_mipmap: targ = GL_GENERATE_MIPMAP_HINT; break; } glHint (targ, GLenum_val(hint)); return Val_unit; } -ML_1 (glIndexMask, Int_val) -ML_1 (glIndexd, Double_val) -ML_0 (glInitNames) ML_1_ (glIsEnabled, GLenum_val, Val_int) CAMLprim value ml_glLight (value n, value param) /* ML */ @@ -291,7 +255,7 @@ CAMLprim value ml_glLightModel (value param) /* ML */ { - float params[4]; + GLfloat params[4]; int i; switch (Field(param,0)) @@ -301,119 +265,20 @@ params[i] = Float_val (Field(Field(param,1),i)); glLightModelfv (GL_LIGHT_MODEL_AMBIENT, params); break; - case MLTAG_local_viewer: - glLightModelf (GL_LIGHT_MODEL_LOCAL_VIEWER, - Int_val(Field(param,1))); - break; case MLTAG_two_side: - glLightModeli (GL_LIGHT_MODEL_TWO_SIDE, - Int_val(Field(param,1))); + glLightModelf (GL_LIGHT_MODEL_TWO_SIDE, + (GLfloat) Int_val(Field(param, 1))); break; - case MLTAG_color_control: -#ifdef GL_VERSION_1_2 - switch (Field(param,1)) - { - case MLTAG_separate_specular_color: - glLightModeli (GL_LIGHT_MODEL_COLOR_CONTROL, - GL_SEPARATE_SPECULAR_COLOR); - break; - case MLTAG_single_color: - glLightModeli (GL_LIGHT_MODEL_COLOR_CONTROL, - GL_SINGLE_COLOR); - break; - } -#else - ml_raise_gl ("Parameter: GL_LIGHT_MODEL_COLOR_CONTROL not available"); -#endif - break; } return Val_unit; } ML_1 (glLineWidth, Float_val) -ML_2 (glLineStipple, Int_val, Int_val) -ML_1 (glLoadName, Int_val) ML_0 (glLoadIdentity) -ML_1 (glLoadMatrixd, Double_raw) +ML_1 (glLoadMatrixf, Float_raw) -#ifdef GL_VERSION_1_3 -ML_1 (glLoadTransposeMatrixd, Double_raw) -#else -CAMLprim void ml_glLoadTransposeMatrixd (value raw) -{ - ml_raise_gl ("Function: glLoadTransposeMatrixd not available"); -} -#endif ML_1 (glLogicOp, GLenum_val) -CAMLprim value ml_glMap1d (value target, value *u, value order, value raw) -{ - int ustride = 0; - GLenum targ = 0U; - - switch (target) { - case MLTAG_vertex_3: - targ = GL_MAP1_VERTEX_3; ustride = 3; break; - case MLTAG_vertex_4: - targ = GL_MAP1_VERTEX_4; ustride = 4; break; - case MLTAG_index: - targ = GL_MAP1_INDEX; ustride = 1; break; - case MLTAG_color_4: - targ = GL_MAP1_COLOR_4; ustride = 4; break; - case MLTAG_normal: - targ = GL_MAP1_NORMAL; ustride = 3; break; - case MLTAG_texture_coord_1: - targ = GL_MAP1_TEXTURE_COORD_1; ustride = 1; break; - case MLTAG_texture_coord_2: - targ = GL_MAP1_TEXTURE_COORD_2; ustride = 2; break; - case MLTAG_texture_coord_3: - targ = GL_MAP1_TEXTURE_COORD_3; ustride = 3; break; - case MLTAG_texture_coord_4: - targ = GL_MAP1_TEXTURE_COORD_4; ustride = 4; break; - } - glMap1d (targ, Double_val(u[0]), Double_val(u[1]), - ustride, Int_val(order), Double_raw(raw)); - return Val_unit; -} - -CAMLprim value ml_glMap2d (value target, value u, value uorder, - value v, value vorder, value raw) -{ - int ustride = 0; - GLenum targ = 0U; - - switch (target) { - case MLTAG_vertex_3: - targ = GL_MAP2_VERTEX_3; ustride = 3; break; - case MLTAG_vertex_4: - targ = GL_MAP2_VERTEX_4; ustride = 4; break; - case MLTAG_index: - targ = GL_MAP2_INDEX; ustride = 1; break; - case MLTAG_color_4: - targ = GL_MAP2_COLOR_4; ustride = 4; break; - case MLTAG_normal: - targ = GL_MAP2_NORMAL; ustride = 3; break; - case MLTAG_texture_coord_1: - targ = GL_MAP2_TEXTURE_COORD_1; ustride = 1; break; - case MLTAG_texture_coord_2: - targ = GL_MAP2_TEXTURE_COORD_2; ustride = 2; break; - case MLTAG_texture_coord_3: - targ = GL_MAP2_TEXTURE_COORD_3; ustride = 3; break; - case MLTAG_texture_coord_4: - targ = GL_MAP2_TEXTURE_COORD_4; ustride = 4; break; - } - glMap2d (targ, Double_val(Field(u,0)), Double_val(Field(u,1)), ustride, - Int_val(uorder), Double_val(Field(v,0)), Double_val(Field(v,1)), - Int_val(uorder)*ustride, Int_val(vorder), Double_raw(raw)); - return Val_unit; -} - -ML_bc6 (ml_glMap2d) - -ML_2 (glMapGrid1d, Int_val, Pair(arg2,Double_val,Double_val)) -ML_4 (glMapGrid2d, Int_val, Pair(arg2,Double_val,Double_val), - Int_val, Pair(arg4,Double_val,Double_val)) - CAMLprim value ml_glMaterial (value face, value param) /* ML */ { float params[4]; @@ -424,10 +289,6 @@ case MLTAG_shininess: params[0] = Float_val (Field(param, 1)); break; - case MLTAG_color_indexes: - for (i = 0; i < 3; i++) - params[i] = Float_val (Field(Field(param, 1), i)); - break; default: for (i = 0; i < 4; i++) params[i] = Float_val (Field(Field(param, 1), i)); @@ -438,146 +299,39 @@ } ML_1 (glMatrixMode, GLenum_val) -ML_1 (glMultMatrixd, Double_raw) +ML_1 (glMultMatrixf, Float_raw) -#ifdef GL_VERSION_1_3 -ML_1 (glMultTransposeMatrixd, Double_raw) -#else -CAMLprim void ml_glMultTransposeMatrixd (value raw) -{ - ml_raise_gl ("Function: glMultTransposeMatrixd not available"); -} -#endif +ML_3 (glNormal3f, Float_val, Float_val, Float_val) -ML_3 (glNormal3d, Double_val, Double_val, Double_val) +ML_3 (glOrthof, Pair(arg1,Float_val,Float_val), + Pair(arg2,Float_val,Float_val), Pair(arg3,Float_val,Float_val)) -ML_1 (glPassThrough, Float_val) - -CAMLprim value ml_glPixelMapfv (value map, value raw) -{ - glPixelMapfv (GLenum_val(map), Int_val(Size_raw(raw))/sizeof(GLfloat), - Float_raw(raw)); - return Val_unit; -} - -ML_3 (glOrtho, Pair(arg1,Double_val,Double_val), - Pair(arg2,Double_val,Double_val), Pair(arg3,Double_val,Double_val)) - ML_1 (glPixelStorei, Pair(arg1,GLenum_val,Int_val)) -CAMLprim value ml_glPixelTransfer (value param) -{ - GLenum pname = GLenum_val (Field(param,0)); - - switch (pname) { - case GL_MAP_COLOR: - case GL_MAP_STENCIL: - case GL_INDEX_SHIFT: - case GL_INDEX_OFFSET: - glPixelTransferi (pname, Int_val (Field(param,1))); - break; - default: - glPixelTransferf (pname, Float_val (Field(param,1))); - } - return Val_unit; -} - -ML_2 (glPixelZoom, Float_val, Float_val) ML_1 (glPointSize, Float_val) ML_2 (glPolygonOffset, Float_val, Float_val) -ML_2 (glPolygonMode, GLenum_val, GLenum_val) -ML_1 (glPolygonStipple, (unsigned char *)Byte_raw) -ML_0 (glPopAttrib) ML_0 (glPopMatrix) -ML_0 (glPopName) -CAMLprim value ml_glPushAttrib (value list) -{ - GLbitfield mask = 0; - - while (list != Val_int(0)) { - switch (Field(list,0)) { - case MLTAG_accum_buffer:mask |= GL_ACCUM_BUFFER_BIT; break; - case MLTAG_color_buffer:mask |= GL_COLOR_BUFFER_BIT; break; - case MLTAG_current: mask |= GL_CURRENT_BIT; break; - case MLTAG_depth_buffer:mask |= GL_DEPTH_BUFFER_BIT; break; - case MLTAG_enable: mask |= GL_ENABLE_BIT; break; - case MLTAG_eval: mask |= GL_EVAL_BIT; break; - case MLTAG_fog: mask |= GL_FOG_BIT; break; - case MLTAG_hint: mask |= GL_HINT_BIT; break; - case MLTAG_lighting: mask |= GL_LIGHTING_BIT; break; - case MLTAG_line: mask |= GL_LINE_BIT; break; - case MLTAG_list: mask |= GL_LIST_BIT; break; - case MLTAG_pixel_mode: mask |= GL_PIXEL_MODE_BIT; break; - case MLTAG_point: mask |= GL_POINT_BIT; break; - case MLTAG_polygon: mask |= GL_POLYGON_BIT; break; - case MLTAG_polygon_stipple:mask |= GL_POLYGON_STIPPLE_BIT; break; - case MLTAG_scissor: mask |= GL_SCISSOR_BIT; break; - case MLTAG_stencil_buffer:mask |= GL_STENCIL_BUFFER_BIT; break; - case MLTAG_texture: mask |= GL_TEXTURE_BIT; break; - case MLTAG_transform: mask |= GL_TRANSFORM_BIT; break; - case MLTAG_viewport: mask |= GL_VIEWPORT_BIT; break; - } - list = Field(list,1); - } - glPushAttrib (mask); - return Val_unit; -} - ML_0 (glPushMatrix) -ML_1 (glPushName, Int_val) -CAMLprim value ml_glRasterPos(value x, value y, value z, value w) /* ML */ -{ - if (z == Val_int(0)) glRasterPos2d (Double_val(x), Double_val(y)); - else if (w == Val_int(0)) - glRasterPos3d (Double_val(x), Double_val(y), Double_val(Field(z, 0))); - else - glRasterPos4d (Double_val(x), Double_val(y), Double_val(Field(z, 0)), - Double_val(Field(w, 0))); - return Val_unit; -} - -CAMLprim value ml_glReadBuffer (value buffer) -{ - if (Is_block(buffer)) { - int n = Int_val (Field(buffer,1)); - if (n >= GL_AUX_BUFFERS) - ml_raise_gl ("GlFunc.read_buffer : no such auxiliary buffer"); - glReadBuffer (GL_AUX0 + n); - } - else glReadBuffer (GLenum_val(buffer)); - return Val_unit; -} - CAMLprim value ml_glReadPixels(value x, value y, value w, value h, value format , value raw) /* ML */ { - glPixelStorei(GL_PACK_SWAP_BYTES, 0); - glPixelStorei(GL_PACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); /* XXX why not put back? */ glReadPixels(Int_val(x),Int_val(y),Int_val(w),Int_val(h),GLenum_val(format), Type_void_raw(raw)); return Val_unit; } ML_bc6 (ml_glReadPixels) -ML_2 (glRectd, Pair(arg1,Double_val,Double_val), - Pair(arg2,Double_val,Double_val)) -ML_1_ (glRenderMode, GLenum_val, Val_int) -ML_4 (glRotated, Double_val, Double_val, Double_val, Double_val) -ML_3 (glScaled, Double_val, Double_val, Double_val) +ML_4 (glRotatef, Float_val, Float_val, Float_val, Float_val) +ML_3 (glScalef, Float_val, Float_val, Float_val) ML_4 (glScissor, Int_val, Int_val, Int_val, Int_val) -ML_2 (glSelectBuffer, Int_val, (GLuint*)Addr_raw) ML_1 (glShadeModel, GLenum_val) ML_3 (glStencilFunc, GLenum_val, Int_val, Int_val) ML_1 (glStencilMask, Int_val) ML_3 (glStencilOp, GLenum_val, GLenum_val, GLenum_val) -ML_1 (glTexCoord1d, Double_val) -ML_2 (glTexCoord2d, Double_val, Double_val) -ML_3 (glTexCoord3d, Double_val, Double_val, Double_val) -ML_4 (glTexCoord4d, Double_val, Double_val, Double_val, Double_val) - CAMLprim value ml_glTexEnv (value param) { value params = Field(param,1); @@ -596,73 +350,123 @@ return Val_unit; } -CAMLprim value ml_glTexGen (value coord, value param) +CAMLprim value ml_glTexImage2D (value level, value internal, + value width, value height, value border, + value format, value data) { - value params = Field(param,1); - GLdouble point[4]; - int i; + /* Note: OpenGL ES says the internal format must be the same as the + * format. However, Apple's implementation of BGRA currently + * requires GL_RGBA for the internal format and GL_BGRA for the + * format. In fact, it makes sense to allow the internal formats to + * be a subset of the external ones. + */ + /* printf("l=%d,i=%x,w=%d,h=%d,b=%d,f=%x,t=%x,d=%x\n", */ + GLenum internal_enum, format_enum; - if (Field(param,0) == MLTAG_mode) - glTexGeni (GLenum_val(coord), GL_TEXTURE_GEN_MODE, GLenum_val(params)); - else { - for (i = 0; i < 4; i++) point[i] = Double_val(Field(params,i)); - glTexGendv (GLenum_val(coord), GLenum_val(Field(param,0)), point); + switch(internal) { +#ifdef GL_BGRA + case MLTAG_bgra: + internal_enum = GL_BGRA; + break; +#endif + default: + internal_enum = GLenum_val(internal); + break; } + + switch(format) { +#ifdef GL_BGRA + case MLTAG_bgra: + format_enum = GL_BGRA; + break; +#endif + default: + format_enum = GLenum_val(format); + break; + } + + glTexImage2D (GL_TEXTURE_2D, + Int_val(level), internal_enum, Int_val(width), + Int_val(height), Int_val(border), format_enum, + Type_raw(data), Void_raw(data)); + /* fflush(stdout); */ return Val_unit; } -CAMLprim value ml_glTexImage1D (value proxy, value level, value internal, - value width, value border, value format, - value data) +ML_bc7 (ml_glTexImage2D) + +CAMLprim value ml_glTexSubImage2D (value level, value xoffset, value yoffset, + value width, value height, + value format, value data) { - glTexImage1D (proxy == Val_int(1) - ? GL_PROXY_TEXTURE_1D : GL_TEXTURE_1D, - Int_val(level), Int_val(internal), Int_val(width), - Int_val(border), GLenum_val(format), - Type_raw(data), Void_raw(data)); + GLenum format_enum; + + switch(format) { +#ifdef GL_BGRA + case MLTAG_bgra: + format_enum = GL_BGRA; + break; +#endif + default: + format_enum = GLenum_val(format); + break; + } + + glTexSubImage2D (GL_TEXTURE_2D, + Int_val(level), Int_val(xoffset), Int_val(yoffset), + Int_val(width), Int_val(height), + format_enum, Type_raw(data), Void_raw(data)); return Val_unit; } -ML_bc7 (ml_glTexImage1D) +ML_bc7 (ml_glTexSubImage2D) -CAMLprim value ml_glTexImage2D (value proxy, value level, value internal, +CAMLprim value ml_glCompressedTexImage2D (value level, value internal, value width, value height, value border, - value format, value data) + value data) { - /* printf("p=%x,l=%d,i=%d,w=%d,h=%d,b=%d,f=%x,t=%x,d=%x\n", */ - glTexImage2D (proxy == Val_int(1) - ? GL_PROXY_TEXTURE_2D : GL_TEXTURE_2D, - Int_val(level), Int_val(internal), Int_val(width), - Int_val(height), Int_val(border), GLenum_val(format), - Type_raw(data), Void_raw(data)); - /* flush(stdout); */ + GLenum internal_enum; + + switch (internal) { +#ifdef GL_IMG_texture_compression_pvrtc + case MLTAG_rgb_pvrtc_4bppv1: + internal_enum = GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; + break; + case MLTAG_rgb_pvrtc_2bppv1: + internal_enum = GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG; + break; + case MLTAG_rgba_pvrtc_4bppv1: + internal_enum = GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; + break; + case MLTAG_rgba_pvrtc_2bppv1: + internal_enum = GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; + break; +#endif + default: + internal_enum = GLenum_val(internal); + break; + } + + /* printf("l=%d,i=%x,w=%d,h=%d,b=%d,s=%d,d=%p\n", */ + glCompressedTexImage2D (GL_TEXTURE_2D, + Int_val(level), internal_enum, Int_val(width), + Int_val(height), Int_val(border), + Int_val(Size_raw(data)), Void_raw(data)); + /* fflush(stdout); */ return Val_unit; } -ML_bc8 (ml_glTexImage2D) +ML_bc6 (ml_glCompressedTexImage2D) CAMLprim value ml_glTexParameter (value target, value param) { GLenum targ = GLenum_val(target); GLenum pname = GLenum_val(Field(param,0)); value params = Field(param,1); - GLfloat color[4]; - int i; switch (pname) { - case GL_TEXTURE_BORDER_COLOR: - for (i = 0; i < 4; i++) color[i] = Float_val(Field(params,i)); - glTexParameterfv (targ, pname, color); - break; - case GL_TEXTURE_PRIORITY: - glTexParameterf (targ, pname, Float_val(params)); - break; case GL_GENERATE_MIPMAP: -#ifdef GL_VERSION_1_4 glTexParameteri (targ, pname, Int_val(params)); -#else - ml_raise_gl ("Parameter: GL_GENERATE_MIPMAP not available"); -#endif break; default: glTexParameteri (targ, pname, GLenum_val(params)); @@ -670,8 +474,7 @@ } return Val_unit; } - -ML_2 (glGenTextures, Int_val, Int_raw) +ML_2 (glGenTextures, Int_val, (GLuint *) Int_raw) ML_2 (glBindTexture, GLenum_val, Nativeint_val) CAMLprim value ml_glDeleteTexture (value texture_id) @@ -681,50 +484,6 @@ return Val_unit; } -ML_3 (glTranslated, Double_val, Double_val, Double_val) +ML_3 (glTranslatef, Float_val, Float_val, Float_val) -CAMLprim value ml_glVertex(value x, value y, value z, value w) /* ML */ -{ - if (z == Val_int(0)) glVertex2d (Double_val(x), Double_val(y)); - else if (w == Val_int(0)) - glVertex3d (Double_val(x), Double_val(y), Double_val(Field(z, 0))); - else - glVertex4d (Double_val(x), Double_val(y), Double_val(Field(z, 0)), - Double_val(Field(w, 0))); - return Val_unit; -} - ML_4 (glViewport, Int_val, Int_val, Int_val, Int_val) - - -/* List functions */ - -ML_1_ (glIsList, Int_val, Val_int) -ML_2 (glDeleteLists, Int_val, Int_val) -ML_1_ (glGenLists, Int_val, Val_int) -ML_2 (glNewList, Int_val, GLenum_val) -ML_0 (glEndList) -ML_1 (glCallList, Int_val) -ML_1 (glListBase, Int_val) - -CAMLprim value ml_glCallLists (value indexes) /* ML */ -{ - int len,i; - int * table; - - switch (Field(indexes,0)) { - case MLTAG_byte: - glCallLists (string_length(Field(indexes,1)), - GL_UNSIGNED_BYTE, - String_val(Field(indexes,1))); - break; - case MLTAG_int: - len = Wosize_val (indexes); - table = calloc (len, sizeof (GLint)); - for (i = 0; i < len; i++) table[i] = Int_val (Field(indexes,i)); - glCallLists (len, GL_INT, table); - free (table); - break; - } - return Val_unit; -} Property changes on: src ___________________________________________________________________ Added: svn:ignore + var2def var2switch varcheck gl_tags.c gl_tags.h glu_tags.c glu_tags.h raw_tags.h build.ml unknown-tags Index: Makefile.config.msvc =================================================================== --- Makefile.config.msvc (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.msvc (.../trunk/lablgles) (revision 709) @@ -15,7 +15,7 @@ OCAMLDIR = c:/Program Files/Objective Caml MSVC BINDIR = $(OCAMLDIR)/bin DLLDIR = $(OCAMLDIR)/lib/stublibs -INSTALLDIR = $(OCAMLDIR)/lib/lablGL +INSTALLDIR = $(OCAMLDIR)/lib/lablGLES # Where to find X headers XINCLUDES = -I/usr/X11R6/include @@ -59,8 +59,8 @@ # Where to put dlls (if dynamic loading available) #DLLDIR = `ocamlc -where`/stublibs -# Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: Makefile.config.osx =================================================================== --- Makefile.config.osx (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.osx (.../trunk/lablgles) (revision 709) @@ -36,8 +36,8 @@ # Where to put dlls (if dynamic loading available) #DLLDIR = `ocamlc -where`/stublibs -# Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: Makefile.config.linux.mdk =================================================================== --- Makefile.config.linux.mdk (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.linux.mdk (.../trunk/lablgles) (revision 709) @@ -50,8 +50,8 @@ # Where to put dlls (if dynamic loading available) #DLLDIR = `ocamlc -where`/stublibs -# Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: LablGLESSim.xcodeproj/project.pbxproj =================================================================== --- LablGLESSim.xcodeproj/project.pbxproj (.../vendor/lablgl/1.04) (revision 0) +++ LablGLESSim.xcodeproj/project.pbxproj (.../trunk/lablgles) (revision 709) @@ -0,0 +1,155 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXGroup section */ + 1A4FCEFD157A98A4008F8191 = { + isa = PBXGroup; + children = ( + ); + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXLegacyTarget section */ + 1A6C19EE157AB31A005CB637 /* LablGLESSim */ = { + isa = PBXLegacyTarget; + buildArgumentsString = "-f Makefile.iossim $(ACTION)"; + buildConfigurationList = 1A6C19EF157AB31A005CB637 /* Build configuration list for PBXLegacyTarget "LablGLESSim" */; + buildPhases = ( + ); + buildToolPath = /usr/bin/make; + buildWorkingDirectory = ""; + dependencies = ( + ); + name = LablGLESSim; + passBuildSettingsInEnvironment = 1; + productName = LablGLES; + }; +/* End PBXLegacyTarget section */ + +/* Begin PBXProject section */ + 1A4FCEFF157A98A4008F8191 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0430; + }; + buildConfigurationList = 1A4FCF02157A98A4008F8191 /* Build configuration list for PBXProject "LablGLESSim" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 1A4FCEFD157A98A4008F8191; + productRefGroup = 1A4FCEFD157A98A4008F8191; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1A6C19EE157AB31A005CB637 /* LablGLESSim */, + ); + }; +/* End PBXProject section */ + +/* Begin XCBuildConfiguration section */ + 1A4FCF13157A98A5008F8191 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = armv6; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1A4FCF14157A98A5008F8191 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = armv6; + COPY_PHASE_STRIP = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 3.1; + SDKROOT = iphoneos; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 1A6C19F0157AB31A005CB637 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUGGING_SYMBOLS = YES; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_GENERATE_DEBUGGING_SYMBOLS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + }; + name = Debug; + }; + 1A6C19F1157AB31A005CB637 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1A4FCF02157A98A4008F8191 /* Build configuration list for PBXProject "LablGLESSim" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A4FCF13157A98A5008F8191 /* Debug */, + 1A4FCF14157A98A5008F8191 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 1A6C19EF157AB31A005CB637 /* Build configuration list for PBXLegacyTarget "LablGLESSim" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1A6C19F0157AB31A005CB637 /* Debug */, + 1A6C19F1157AB31A005CB637 /* Release */, + ); + defaultConfigurationIsVisible = 0; + }; +/* End XCConfigurationList section */ + }; + rootObject = 1A4FCEFF157A98A4008F8191 /* Project object */; +} Property changes on: LablGLESSim.xcodeproj ___________________________________________________________________ Added: svn:ignore + xcuserdata project.xcworkspace Index: Makefile.config.freebsd =================================================================== --- Makefile.config.freebsd (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.freebsd (.../trunk/lablgles) (revision 709) @@ -50,8 +50,8 @@ # Where to put dlls (if dynamic loading available) #DLLDIR = `ocamlc -where`/stublibs -# Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: Makefile.config.ex =================================================================== --- Makefile.config.ex (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.ex (.../trunk/lablgles) (revision 709) @@ -54,7 +54,7 @@ #DLLDIR = `ocamlc -where`/stublibs # Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: Makefile.config.android =================================================================== --- Makefile.config.android (.../vendor/lablgl/1.04) (revision 0) +++ Makefile.config.android (.../trunk/lablgles) (revision 709) @@ -0,0 +1,82 @@ +# LablGL and Togl configuration file +# +# Please have a look at the config/Makefile in the Objective Caml distribution, +# or at the labltklink script to get the information needed here +# + +##### Adjust these always + +# Uncomment if you have the fast ".opt" compilers +#CAMLC = ocamlc.opt +#CAMLOPT = ocamlopt.opt + +# Cross compiling setup for Android +# +OCAMLBINDIR=/Users/psnively/usr/android-ocaml/bin +SDK=/Users/psnively/android-ndk-r5b/platforms/android-8/arch-arm +CAMLC=$(OCAMLBINDIR)/ocamlc +CAMLOPT=$(OCAMLBINDIR)/ocamlopt +OPTCOMP=$(CAMLOPT) -c -cclib -Wl,-syslibroot,$(SDK) +# LIBRARIAN=$(OCAMLBINDIR)/ocamlmklib -ldopt -Wl,-syslibroot,$(SDK) +LIBRARIAN=$(OCAMLBINDIR)/ocamlmklib -L$(SDK)/usr/lib +VAR2DEF=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2def +VAR2SWITCH=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2switch + +# Where to put the lablgl script +#BINDIR = /usr/local/bin + +# Where to find X headers +#XINCLUDES = -I/usr/X11R6/include +# X libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lX11 -lXi + +# Where to find Tcl/Tk headers +# This must the same version as for LablTk +#TKINCLUDES = -I/usr/local/include +# Tcl/Tk libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#TKLIBS = -L/usr/local/lib -ltk84 -ltcl84 + +# Where to find OpenGL/Mesa/Glut headers and libraries +GLINCLUDES = +GLLIBS = -lGLESv1_CM +#GLUTLIBS = -lglut +# The following libraries may be required (try to add them one at a time) +#GLLIBS = -lGL -lGLU -lXmu -lXext -lXi -lcipher -lpthread + +# How to index a library after installing (ranlib required on MacOSX) +#RANLIB = : +RANLIB = /Users/psnively/android-ndk-r5b/toolchains/arm-eabi-4.4.0/prebuilt/darwin-x86/arm-eabi/bin/ranlib + +##### Uncomment these for windows +#TKLIBS = tk83.lib tcl83.lib gdi32.lib user32.lib +#GLLIBS = opengl32.lib glu32.lib +#TOOLCHAIN = msvc +#XA = .lib +#XB = .bat +#XE = .exe +#XO = .obj +#XS = .dll + +##### Adjust these if non standard + +# The Objective Caml library directory +#LIBDIR = `ocamlc -where` + +# Where to put dlls (if dynamic loading available) +#DLLDIR = `ocamlc -where`/stublibs + +# Install in work tree +DLLDIR = `pwd`/release + +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES + +# Install in work tree +INSTALLDIR = `pwd`/release + +# Where is Togl (default) +#TOGLDIR = Togl + +# C Compiler options +#COPTS = -c -O +COPTS = -DHAS_GLEXT_H=1 -D__ANDROID__=1 -c -O -isysroot $(SDK) Index: Makefile.config.mingw =================================================================== --- Makefile.config.mingw (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.config.mingw (.../trunk/lablgles) (revision 709) @@ -15,7 +15,7 @@ OCAMLDIR = c:/Program Files/Objective Caml BINDIR = $(OCAMLDIR)/bin DLLDIR = $(OCAMLDIR)/lib/stublibs -INSTALLDIR = $(OCAMLDIR)/lib/lablGL +INSTALLDIR = $(OCAMLDIR)/lib/lablGLES # Where to find X headers #XINCLUDES = -I/usr/X11R6/include @@ -63,8 +63,8 @@ # Where to put dlls (if dynamic loading available) #DLLDIR = `ocamlc -where`/stublibs -# Where to put LablGL (standard) -#INSTALLDIR = $(LIBDIR)/lablGL +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES # Where is Togl (default) #TOGLDIR = Togl Index: Makefile.common =================================================================== --- Makefile.common (.../vendor/lablgl/1.04) (revision 709) +++ Makefile.common (.../trunk/lablgles) (revision 709) @@ -5,6 +5,7 @@ CAMLOPT=ocamlopt COMPILER=$(CAMLC) -c -w s OPTCOMP=$(CAMLOPT) -c +CAMLP4O = camlp4o LIBRARIAN=ocamlmklib OPTLIB=$(CAMLOPT) -a LINKER=$(CAMLC) @@ -17,7 +18,7 @@ CONFIG = $(TOPDIR)/Makefile.config LIBDIR = `$(CAMLC) -where` DLLDIR = $(LIBDIR)/stublibs -INSTALLDIR = $(LIBDIR)/lablGL +INSTALLDIR = $(LIBDIR)/lablGLES TOGLDIR = Togl COPTS = -c -O Index: Makefile.ios =================================================================== --- Makefile.ios (.../vendor/lablgl/1.04) (revision 0) +++ Makefile.ios (.../trunk/lablgles) (revision 709) @@ -0,0 +1,4 @@ +# Shortcut to make for iOS +all preinstall install real-install clean lib libopt: + cp Makefile.config.ios Makefile.config + $(MAKE) $@ Index: Makefile.config.ios =================================================================== --- Makefile.config.ios (.../vendor/lablgl/1.04) (revision 0) +++ Makefile.config.ios (.../trunk/lablgles) (revision 709) @@ -0,0 +1,83 @@ +# LablGL and Togl configuration file +# +# Please have a look at the config/Makefile in the Objective Caml distribution, +# or at the labltklink script to get the information needed here +# + +##### Adjust these always + +# Uncomment if you have the fast ".opt" compilers +#CAMLC = ocamlc.opt +#CAMLOPT = ocamlopt.opt + +# Cross compiling setup for iPhone and iPad +# +OCAMLBINDIR=/usr/local/ocamlxarm/bin +SDK=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS5.1.sdk +CAMLC=$(OCAMLBINDIR)/ocamlc +CAMLOPT=$(OCAMLBINDIR)/ocamlopt +CAMLP4O=$(OCAMLBINDIR)/camlp4o +OPTCOMP=$(CAMLOPT) -c -ccopt -isysroot -ccopt $(SDK) \ + -cclib -Wl,-syslibroot,$(SDK) +LIBRARIAN=$(OCAMLBINDIR)/ocamlmklib -ldopt -Wl,-syslibroot,$(SDK) +VAR2DEF=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2def +VAR2SWITCH=$(OCAMLBINDIR)/ocamlrun $(SRCDIR)/var2switch + +# Where to put the lablgl script +#BINDIR = /usr/local/bin + +# Where to find X headers +#XINCLUDES = -I/usr/X11R6/include +# X libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#XLIBS = -L/usr/X11R6/lib -lXext -lXmu -lX11 -lXi + +# Where to find Tcl/Tk headers +# This must the same version as for LablTk +#TKINCLUDES = -I/usr/local/include +# Tcl/Tk libs (for broken RTLD_GLOBAL: e.g. FreeBSD 4.0) +#TKLIBS = -L/usr/local/lib -ltk84 -ltcl84 + +# Where to find OpenGL/Mesa/Glut headers and libraries +GLINCLUDES = +GLLIBS = -framework OpenGLES +#GLUTLIBS = -lglut +# The following libraries may be required (try to add them one at a time) +#GLLIBS = -lGL -lGLU -lXmu -lXext -lXi -lcipher -lpthread + +# How to index a library after installing (ranlib required on MacOSX) +#RANLIB = : +RANLIB = ranlib + +##### Uncomment these for windows +#TKLIBS = tk83.lib tcl83.lib gdi32.lib user32.lib +#GLLIBS = opengl32.lib glu32.lib +#TOOLCHAIN = msvc +#XA = .lib +#XB = .bat +#XE = .exe +#XO = .obj +#XS = .dll + +##### Adjust these if non standard + +# The Objective Caml library directory +#LIBDIR = `ocamlc -where` + +# Where to put dlls (if dynamic loading available) +#DLLDIR = `ocamlc -where`/stublibs + +# Install in work tree +DLLDIR = `pwd`/release + +# Where to put LablGLES (standard) +#INSTALLDIR = $(LIBDIR)/lablGLES + +# Install in work tree +INSTALLDIR = `pwd`/release + +# Where is Togl (default) +#TOGLDIR = Togl + +# C Compiler options +#COPTS = -c -O +COPTS = -DCONFIG_IOS -c -O -isysroot $(SDK) Index: Makefile =================================================================== --- Makefile (.../vendor/lablgl/1.04) (revision 709) +++ Makefile (.../trunk/lablgles) (revision 709) @@ -2,14 +2,15 @@ # default LIBDIR = `ocamlc -where` -INSTALLDIR = $(LIBDIR)/lablGL +INSTALLDIR = $(LIBDIR)/lablGLES DLLDIR = $(LIBDIR)/stublibs CONFIG = Makefile.config include $(CONFIG) -all: lib togl glut +all: lib libopt install +#all: lib -opt: libopt toglopt glutopt +opt: libopt lib: cd src && $(MAKE) all LIBDIR="$(LIBDIR)" @@ -17,32 +18,33 @@ libopt: cd src && $(MAKE) opt -togl: lib - cd Togl/src && $(MAKE) all +# Not for OpenGL ES +#togl: lib +# cd Togl/src && $(MAKE) all +# +#toglopt: libopt +# cd Togl/src && $(MAKE) opt +# +#glut: lib +# cd LablGlut/src && $(MAKE) +# +#glutopt: libopt +# cd LablGlut/src && $(MAKE) opt -toglopt: libopt - cd Togl/src && $(MAKE) opt - -glut: lib - cd LablGlut/src && $(MAKE) - -glutopt: libopt - cd LablGlut/src && $(MAKE) opt - preinstall: cd src && $(MAKE) preinstall INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" - cd Togl/src && $(MAKE) preinstall INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" - cd LablGlut/src && $(MAKE) preinstall INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" +# cd Togl/src && $(MAKE) preinstall INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" +# cd LablGlut/src && $(MAKE) preinstall INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" install: @$(MAKE) real-install INSTALLDIR="$(INSTALLDIR)" DLLDIR="$(DLLDIR)" real-install: cd src && $(MAKE) install - cd Togl/src && $(MAKE) install - cd LablGlut/src && $(MAKE) install +# cd Togl/src && $(MAKE) install +# cd LablGlut/src && $(MAKE) install clean: cd src && $(MAKE) clean - cd Togl/src && $(MAKE) clean - cd LablGlut/src && $(MAKE) clean +# cd Togl/src && $(MAKE) clean +# cd LablGlut/src && $(MAKE) clean Property changes on: . ___________________________________________________________________ Added: svn:ignore + build release Makefile.config