from stdapi import *
-GLboolean = Alias("GLboolean", Bool)
+GLboolean = Enum("GLboolean", [
+ "GL_TRUE",
+ "GL_FALSE",
+])
+
GLvoid = Alias("GLvoid", Void)
GLbyte = Alias("GLbyte", SChar)
GLshort = Alias("GLshort", Short)
GLfenceNV = Handle("fenceNV", GLuint)
GLprogram = Handle("program", GLuint)
GLshader = Handle("shader", GLuint)
-GLlocation = Handle("location", GLint, key=('program', GLuint))
-GLlocationARB = Handle("locationARB", GLint, key=('programObj', GLhandleARB))
+
+# Share the same mapping table for uniform locations of both core and
+# GL_ARB_shader_objects programs. For a combination of reasons:
+#
+# - all OpenGL implementations appear to alias the names for both kind of
+# programs;
+#
+# - most applications will use only one kind of shader programs;
+#
+# - some applications actually mix glUniformXxx calls with
+# GL_ARB_shader_objects programs and glUniformXxxARB calls with core
+# programs, and therefore, rely on a joint implementation.
+#
+# We use GLhandleARB as program key, since it is wider (void *) on MacOSX.
+#
+GLlocation = Handle("location", GLint, key=('program', GLhandleARB))
+GLlocationARB = Handle("location", GLint, key=('programObj', GLhandleARB))
+
GLprogramARB = Handle("programARB", GLuint)
GLframebuffer = Handle("framebuffer", GLuint)
GLrenderbuffer = Handle("renderbuffer", GLuint)
GLfragmentShaderATI = Handle("fragmentShaderATI", GLuint)
GLarray = Handle("array", GLuint)
GLregion = Handle("region", GLuint)
-GLmap = GLpointer
GLpipeline = Handle("pipeline", GLuint)
GLsampler = Handle("sampler", GLuint)
GLfeedback = Handle("feedback", GLuint)
-GLsync_ = Opaque("GLsync")
-GLsync = Handle("sync", GLsync_)
+# GL mappings are pointers to linear memory regions.
+#
+# The map length is not always available in the function prototype, and must be
+# reconstructed from other state.
+GLmap = LinearPointer(GLvoid, "length")
+
+GLsync = Handle("sync", IntPointer("GLsync"))
GLenum = Enum("GLenum", [
# Parameters are added later from glparams.py's parameter table
])
# Some functions take GLenum disguised as GLint, and need special treatment so
-# that symbolic names are traced correctly. Apple noticed and fixed it in the
-# gl.h header, which further complicates things. C++ typechecking rules force
-# the wrappers to match the prototype precisely, so the precise type is defined
-# in glimports.hpp
-GLenum_int = Alias("GLenum_int", GLenum)
+# that symbolic names are traced correctly.
+GLenum_int = Alias("GLint", GLenum)
GLenum_mode = FakeEnum(GLenum, [
"GL_POINTS", # 0x0000