figl/config.scm \
figl/parse.scm \
figl/runtime.scm \
+ \
figl/gl/types.scm \
+ figl/gl/runtime.scm \
figl/gl/low-level.scm \
figl/gl.scm \
+ \
figl/glu/types.scm \
+ figl/glu/runtime.scm \
figl/glu/low-level.scm \
+ \
figl/glx/types.scm \
+ figl/glx/runtime.scm \
figl/glx/low-level.scm \
- figl/glx.scm
+ figl/glx.scm \
+ \
+ figl/glut/runtime.scm \
+ figl/glut/low-level.scm \
+ figl/glut.scm
update: figl/parse.go
$(top_builddir)/env $(GUILE) $(top_srcdir)/maint/update-low-level-bindings
(define-module
(figl gl low-level)
#:use-module
- (figl runtime)
+ (figl gl runtime)
#:use-module
(figl gl types)
#:export
glWindowPos3i
glWindowPos3f))
-(define-foreign-procedures
+(define-gl-procedures
((glAccum (op GLenum) (value GLfloat) -> void))
"Operate on the accumulation buffer.
`GL_INVALID_OPERATION' is generated if `glAccum' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glActiveTexture (texture GLenum) -> void))
"Select active texture unit.
where i ranges from 0 to the larger of (`GL_MAX_TEXTURE_COORDS' - 1) and
(`GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS' - 1).")
-(define-foreign-procedures
+(define-gl-procedures
((glAlphaFunc
(func GLenum)
(ref GLclampf)
`GL_INVALID_OPERATION' is generated if `glAlphaFunc' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glAreTexturesResident
(n GLsizei)
(textures const-GLuint-*)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glArrayElement (i GLint) -> void))
"Render a vertex using the specified vertex array element.
bound to an enabled array and the buffer object's data store is
currently mapped.")
-(define-foreign-procedures
+(define-gl-procedures
((glAttachShader
(program GLuint)
(shader GLuint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBeginQuery
(target GLenum)
(id GLuint)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBegin (mode GLenum) -> void) (glEnd -> void))
"Delimit the vertices of a primitive or a group of like primitives.
`glBegin' and before the corresponding call to `glEnd', but an error may
or may not be generated.")
-(define-foreign-procedures
+(define-gl-procedures
((glBindAttribLocation
(program GLuint)
(index GLuint)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBindBuffer
(target GLenum)
(buffer GLuint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBindTexture
(target GLenum)
(texture GLuint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBitmap
(width GLsizei)
(height GLsizei)
`GL_INVALID_OPERATION' is generated if `glBitmap' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBlendColor
(red GLclampf)
(green GLclampf)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBlendEquationSeparate
(modeRGB GLenum)
(modeAlpha GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBlendEquation (mode GLenum) -> void))
"Specify the equation used for both the RGB blend equation and the Alpha
blend equation.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBlendFuncSeparate
(srcRGB GLenum)
(dstRGB GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBlendFunc
(sfactor GLenum)
(dfactor GLenum)
`GL_INVALID_OPERATION' is generated if `glBlendFunc' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBufferData
(target GLenum)
(size GLsizeiptr)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glBufferSubData
(target GLenum)
(offset GLintptr)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCallLists
(n GLsizei)
(type GLenum)
`GL_UNSIGNED_BYTE', `GL_SHORT', `GL_UNSIGNED_SHORT', `GL_INT',
`GL_UNSIGNED_INT', `GL_FLOAT', `GL_2_BYTES', `GL_3_BYTES', `GL_4_BYTES'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCallList (list GLuint) -> void))
"Execute a display list.
`glPopAttrib', `glPushMatrix', and `glPopMatrix' to preserve GL state
across `glCallList' calls.")
-(define-foreign-procedures
+(define-gl-procedures
((glClearAccum
(red GLfloat)
(green GLfloat)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClearColor
(red GLclampf)
(green GLclampf)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClearDepth (depth GLclampd) -> void))
"Specify the clear value for the depth buffer.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClearIndex (c GLfloat) -> void))
"Specify the clear value for the color index buffers.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClearStencil (s GLint) -> void))
"Specify the clear value for the stencil buffer.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClear (mask GLbitfield) -> void))
"Clear buffers to preset values.
`GL_INVALID_OPERATION' is generated if `glClear' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glClientActiveTexture (texture GLenum) -> void))
"Select active texture unit.
`GL_INVALID_ENUM' is generated if TEXTURE is not one of `GL_TEXTURE'I ,
where i ranges from 0 to the value of `GL_MAX_TEXTURE_COORDS' - 1.")
-(define-foreign-procedures
+(define-gl-procedures
((glClipPlane
(plane GLenum)
(equation const-GLdouble-*)
`GL_INVALID_OPERATION' is generated if `glClipPlane' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glColorMask
(red GLboolean)
(green GLboolean)
`GL_INVALID_OPERATION' is generated if `glColorMask' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glColorMaterial
(face GLenum)
(mode GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glColorPointer
(size GLint)
(type GLenum)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glColorSubTable
(target GLenum)
(start GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glColorTable
(target GLenum)
(internalformat GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glColor3i
(red GLint)
(green GLint)
components are clamped to this range before they are interpolated or
written into a color buffer.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompileShader (shader GLuint) -> void))
"Compiles a shader object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexImage1D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexImage2D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexImage3D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexSubImage1D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexSubImage2D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glCompressedTexSubImage3D
(target GLenum)
(level GLint)
if DATA is not encoded in a manner consistent with the extension
specification defining the internal compression format.")
-(define-foreign-procedures
+(define-gl-procedures
((glConvolutionFilter1D
(target GLenum)
(internalformat GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glConvolutionFilter2D
(target GLenum)
(internalformat GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glConvolutionParameterf
(target GLenum)
(pname GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyColorSubTable
(target GLenum)
(start GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyColorTable
(target GLenum)
(internalformat GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyConvolutionFilter1D
(target GLenum)
(internalformat GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyConvolutionFilter2D
(target GLenum)
(internalformat GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyPixels
(x GLint)
(y GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyTexImage1D
(target GLenum)
(level GLint)
`GL_DEPTH_COMPONENT', `GL_DEPTH_COMPONENT16', `GL_DEPTH_COMPONENT24', or
`GL_DEPTH_COMPONENT32' and there is no depth buffer.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyTexImage2D
(target GLenum)
(level GLint)
`GL_DEPTH_COMPONENT', `GL_DEPTH_COMPONENT16', `GL_DEPTH_COMPONENT24', or
`GL_DEPTH_COMPONENT32' and there is no depth buffer.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyTexSubImage1D
(target GLenum)
(level GLint)
`GL_TEXTURE_BORDER' of the texture image being modified. Note that W
includes twice the border width.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyTexSubImage2D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCopyTexSubImage3D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCreateProgram -> GLuint))
"Creates a program object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCreateShader (shaderType GLenum) -> GLuint))
"Creates a shader object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glCullFace (mode GLenum) -> void))
"Specify whether front- or back-facing facets can be culled.
`GL_INVALID_OPERATION' is generated if `glCullFace' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteBuffers
(n GLsizei)
(buffers const-GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteLists
(list GLuint)
(range GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteProgram (program GLuint) -> void))
"Deletes a program object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteQueries
(n GLsizei)
(ids const-GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteShader (shader GLuint) -> void))
"Deletes a shader object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDeleteTextures
(n GLsizei)
(textures const-GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDepthFunc (func GLenum) -> void))
"Specify the value used for depth buffer comparisons.
`GL_INVALID_OPERATION' is generated if `glDepthFunc' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDepthMask (flag GLboolean) -> void))
"Enable or disable writing into the depth buffer.
`GL_INVALID_OPERATION' is generated if `glDepthMask' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDepthRange
(nearVal GLclampd)
(farVal GLclampd)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDetachShader
(program GLuint)
(shader GLuint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawArrays
(mode GLenum)
(first GLint)
`GL_INVALID_OPERATION' is generated if `glDrawArrays' is executed
between the execution of `glBegin' and the corresponding `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawBuffers
(n GLsizei)
(bufs const-GLenum-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawBuffer (mode GLenum) -> void))
"Specify which color buffers are to be drawn into.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawElements
(mode GLenum)
(count GLsizei)
`GL_INVALID_OPERATION' is generated if `glDrawElements' is executed
between the execution of `glBegin' and the corresponding `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawPixels
(width GLsizei)
(height GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glDrawRangeElements
(mode GLenum)
(start GLuint)
`GL_INVALID_OPERATION' is generated if `glDrawRangeElements' is executed
between the execution of `glBegin' and the corresponding `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glEdgeFlagPointer
(stride GLsizei)
(pointer const-GLvoid-*)
`GL_INVALID_ENUM' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glEdgeFlag (flag GLboolean) -> void))
"Flag edges as either boundary or nonboundary.
`GL_POLYGON_MODE' is set to `GL_POINT' or `GL_LINE'. See
`glPolygonMode'.")
-(define-foreign-procedures
+(define-gl-procedures
((glEnableClientState (cap GLenum) -> void)
(glDisableClientState (cap GLenum) -> void))
"Enable or disable client-side capability.
and the corresponding `glEnd', but an error may or may not be generated.
If no error is generated, the behavior is undefined.")
-(define-foreign-procedures
+(define-gl-procedures
((glEnableVertexAttribArray
(index GLuint)
->
' or `glDisableVertexAttribArray ' is executed between the execution of
`glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glEnable (cap GLenum) -> void)
(glDisable (cap GLenum) -> void))
"Enable or disable server-side GL capabilities.
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glEvalCoord1f (u GLfloat) -> void)
(glEvalCoord2f (u GLfloat) (v GLfloat) -> void))
"Evaluate enabled one- and two-dimensional maps.
automatic normal generation nor a normal map is enabled, no normal is
generated for `glEvalCoord2' commands.")
-(define-foreign-procedures
+(define-gl-procedures
((glEvalMesh1
(mode GLenum)
(i1 GLint)
`GL_INVALID_OPERATION' is generated if `glEvalMesh' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glEvalPoint1 (i GLint) -> void)
(glEvalPoint2 (i GLint) (j GLint) -> void))
"Generate and evaluate a single point in a mesh.
);")
-(define-foreign-procedures
+(define-gl-procedures
((glFeedbackBuffer
(size GLsizei)
(type GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glFinish -> void))
"Block until all GL execution is complete.
`GL_INVALID_OPERATION' is generated if `glFinish' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glFlush -> void))
"Force execution of GL commands in finite time.
`GL_INVALID_OPERATION' is generated if `glFlush' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glFogCoordPointer
(type GLenum)
(stride GLsizei)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glFogCoordf (coord GLfloat) -> void))
"Set the current fog coordinates.
vertex and the current raster position. The value specified is
interpolated and used in computing the fog color (see `glFog').")
-(define-foreign-procedures
+(define-gl-procedures
((glFogf (pname GLenum) (param GLfloat) -> void)
(glFogi (pname GLenum) (param GLint) -> void))
"Specify fog parameters.
`GL_INVALID_OPERATION' is generated if `glFog' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glFrontFace (mode GLenum) -> void))
"Define front- and back-facing polygons.
`GL_INVALID_OPERATION' is generated if `glFrontFace' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glFrustum
(left GLdouble)
(right GLdouble)
`GL_INVALID_OPERATION' is generated if `glFrustum' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGenBuffers
(n GLsizei)
(buffers GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGenLists (range GLsizei) -> GLuint))
"Generate a contiguous set of empty display lists.
`GL_INVALID_OPERATION' is generated if `glGenLists' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGenQueries (n GLsizei) (ids GLuint-*) -> void))
"Generate query object names.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGenTextures
(n GLsizei)
(textures GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetActiveAttrib
(program GLuint)
(index GLuint)
`GL_INVALID_VALUE' is generated if BUFSIZE is less than 0.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetActiveUniform
(program GLuint)
(index GLuint)
`GL_INVALID_VALUE' is generated if BUFSIZE is less than 0.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetAttachedShaders
(program GLuint)
(maxCount GLsizei)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetAttribLocation
(program GLuint)
(name const-GLchar-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetBufferSubData
(target GLenum)
(offset GLintptr)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetClipPlane
(plane GLenum)
(equation GLdouble-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetColorTable
(target GLenum)
(format GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetCompressedTexImage
(target GLenum)
(lod GLint)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetConvolutionFilter
(target GLenum)
(format GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetError -> GLenum))
"Return error information.
the execution of `glBegin' and the corresponding execution of `glEnd'.
In this case, `glGetError' returns 0.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetHistogram
(target GLenum)
(reset GLboolean)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetMinmax
(target GLenum)
(reset GLboolean)
`GL_INVALID_OPERATION' is generated if `glGetMinmax' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetPolygonStipple (pattern GLubyte-*) -> void))
"Return the polygon stipple pattern.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetProgramInfoLog
(program GLuint)
(maxLength GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetSeparableFilter
(target GLenum)
(format GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetShaderInfoLog
(shader GLuint)
(maxLength GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetShaderSource
(shader GLuint)
(bufSize GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetString (name GLenum) -> const-GLubyte*))
"Return a string describing the current GL connection.
`GL_INVALID_OPERATION' is generated if `glGetString' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetTexImage
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glGetUniformLocation
(program GLuint)
(name const-GLchar-*)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glHint (target GLenum) (mode GLenum) -> void))
"Specify implementation-specific hints.
`GL_INVALID_OPERATION' is generated if `glHint' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glHistogram
(target GLenum)
(width GLsizei)
`GL_INVALID_OPERATION' is generated if `glHistogram' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIndexMask (mask GLuint) -> void))
"Control the writing of individual bits in the color index buffers.
`GL_INVALID_OPERATION' is generated if `glIndexMask' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIndexPointer
(type GLenum)
(stride GLsizei)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glIndexi (c GLint) -> void)
(glIndexf (c GLfloat) -> void)
(glIndexub (c GLubyte) -> void))
bits in the integer portion of the resulting fixed-point value that do
not correspond to bits in the frame buffer are masked out.")
-(define-foreign-procedures
+(define-gl-procedures
((glInitNames -> void))
"Initialize the name stack.
`GL_INVALID_OPERATION' is generated if `glInitNames' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glInterleavedArrays
(format GLenum)
(stride GLsizei)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsBuffer (buffer GLuint) -> GLboolean))
"Determine if a name corresponds to a buffer object.
`GL_INVALID_OPERATION' is generated if `glIsBuffer' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsEnabled (cap GLenum) -> GLboolean))
"Test whether a capability is enabled.
`GL_INVALID_OPERATION' is generated if `glIsEnabled' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsList (list GLuint) -> GLboolean))
"Determine if a name corresponds to a display list.
`GL_INVALID_OPERATION' is generated if `glIsList' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsProgram (program GLuint) -> GLboolean))
"Determines if a name corresponds to a program object.
`GL_INVALID_OPERATION' is generated if `glIsProgram' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsQuery (id GLuint) -> GLboolean))
"Determine if a name corresponds to a query object.
`GL_INVALID_OPERATION' is generated if `glIsQuery' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsShader (shader GLuint) -> GLboolean))
"Determines if a name corresponds to a shader object.
`GL_INVALID_OPERATION' is generated if `glIsShader' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glIsTexture (texture GLuint) -> GLboolean))
"Determine if a name corresponds to a texture.
`GL_INVALID_OPERATION' is generated if `glIsTexture' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLightModelf
(pname GLenum)
(param GLfloat)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLightf
(light GLenum)
(pname GLenum)
`GL_INVALID_OPERATION' is generated if `glLight' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLineStipple
(factor GLint)
(pattern GLushort)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLineWidth (width GLfloat) -> void))
"Specify the width of rasterized lines.
`GL_INVALID_OPERATION' is generated if `glLineWidth' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLinkProgram (program GLuint) -> void))
"Links a program object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glListBase (base GLuint) -> void))
"Set the display-list base for .
`GL_INVALID_OPERATION' is generated if `glListBase' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLoadIdentity -> void))
"Replace the current matrix with the identity matrix.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLoadMatrixf (m const-GLfloat-*) -> void))
"Replace the current matrix with the specified matrix.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLoadName (name GLuint) -> void))
"Load a name onto the name stack.
`GL_INVALID_OPERATION' is generated if `glLoadName' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLoadTransposeMatrixf
(m const-GLfloat-*)
->
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glLogicOp (opcode GLenum) -> void))
"Specify a logical pixel operation for color index rendering.
`GL_INVALID_OPERATION' is generated if `glLogicOp' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMap1f
(target GLenum)
(u1 GLfloat)
`GL_INVALID_OPERATION' is generated if `glMap1' is called and the value
of `GL_ACTIVE_TEXTURE' is not `GL_TEXTURE0'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMap2f
(target GLenum)
(u1 GLfloat)
`GL_INVALID_OPERATION' is generated if `glMap2' is called and the value
of `GL_ACTIVE_TEXTURE' is not `GL_TEXTURE0'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMapBuffer
(target GLenum)
(access GLenum)
is executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMapGrid1f
(un GLint)
(u1 GLfloat)
`GL_INVALID_OPERATION' is generated if `glMapGrid' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMaterialf
(face GLenum)
(pname GLenum)
`GL_INVALID_VALUE' is generated if a specular exponent outside the range
[0,128] is specified.")
-(define-foreign-procedures
+(define-gl-procedures
((glMatrixMode (mode GLenum) -> void))
"Specify which matrix is the current matrix.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMinmax
(target GLenum)
(internalformat GLenum)
`GL_INVALID_OPERATION' is generated if `glMinmax' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMultiDrawArrays
(mode GLenum)
(first GLint-*)
`GL_INVALID_OPERATION' is generated if `glMultiDrawArrays' is executed
between the execution of `glBegin' and the corresponding `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMultiDrawElements
(mode GLenum)
(count const-GLsizei-*)
`GL_INVALID_OPERATION' is generated if `glMultiDrawElements' is executed
between the execution of `glBegin' and the corresponding `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMultiTexCoord1i
(target GLenum)
(s GLint)
with each vertex and with the current raster position. Initially, the
values for (S,TRQ) are (0,001) .")
-(define-foreign-procedures
+(define-gl-procedures
((glMultMatrixf (m const-GLfloat-*) -> void))
"Multiply the current matrix with the specified matrix.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glMultTransposeMatrixf
(m const-GLfloat-*)
->
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glNewList (list GLuint) (mode GLenum) -> void)
(glEndList -> void))
"Create or replace a display list.
other change is made to the GL state. (It is as if no attempt had been
made to create the new display list.)")
-(define-foreign-procedures
+(define-gl-procedures
((glNormalPointer
(type GLenum)
(stride GLsizei)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glNormal3f
(nx GLfloat)
(ny GLfloat)
`GL_NORMALIZE' or `GL_RESCALE_NORMAL'. Normalization is initially
disabled.")
-(define-foreign-procedures
+(define-gl-procedures
((glOrtho
(left GLdouble)
(right GLdouble)
`GL_INVALID_OPERATION' is generated if `glOrtho' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPassThrough (token GLfloat) -> void))
"Place a marker in the feedback buffer.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPixelStoref
(pname GLenum)
(param GLfloat)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPixelTransferf
(pname GLenum)
(param GLfloat)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPixelZoom
(xfactor GLfloat)
(yfactor GLfloat)
`GL_INVALID_OPERATION' is generated if `glPixelZoom' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPointParameterf
(pname GLenum)
(param GLfloat)
`GL_POINT_SIZE_MAX', the point size after clamping is undefined, but no
error is generated.")
-(define-foreign-procedures
+(define-gl-procedures
((glPointSize (size GLfloat) -> void))
"Specify the diameter of rasterized points.
`GL_INVALID_OPERATION' is generated if `glPointSize' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPolygonMode
(face GLenum)
(mode GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPolygonOffset
(factor GLfloat)
(units GLfloat)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPolygonStipple
(pattern const-GLubyte-*)
->
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPrioritizeTextures
(n GLsizei)
(textures const-GLuint-*)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPushAttrib (mask GLbitfield) -> void)
(glPopAttrib -> void))
"Push and pop the server attribute stack.
is executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPushClientAttrib (mask GLbitfield) -> void)
(glPopClientAttrib -> void))
"Push and pop the client attribute stack.
`GL_STACK_UNDERFLOW' is generated if `glPopClientAttrib' is called while
the attribute stack is empty.")
-(define-foreign-procedures
+(define-gl-procedures
((glPushMatrix -> void) (glPopMatrix -> void))
"Push and pop the current matrix stack.
is executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glPushName (name GLuint) -> void)
(glPopName -> void))
"Push and pop the name stack.
executed between a call to `glBegin' and the corresponding call to
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glRasterPos2i (x GLint) (y GLint) -> void)
(glRasterPos2f (x GLfloat) (y GLfloat) -> void)
(glRasterPos3i
`GL_INVALID_OPERATION' is generated if `glRasterPos' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glReadBuffer (mode GLenum) -> void))
"Select a color buffer source for pixels.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glReadPixels
(x GLint)
(y GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glRectf
(x1 GLfloat)
(y1 GLfloat)
`GL_INVALID_OPERATION' is generated if `glRect' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glRenderMode (mode GLenum) -> GLint))
"Set rasterization mode.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glResetHistogram (target GLenum) -> void))
"Reset histogram table entries to zero.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glResetMinmax (target GLenum) -> void))
"Reset minmax table entries to initial values.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glRotatef
(angle GLfloat)
(x GLfloat)
`GL_INVALID_OPERATION' is generated if `glRotate' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glSampleCoverage
(value GLclampf)
(invert GLboolean)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glScalef
(x GLfloat)
(y GLfloat)
`GL_INVALID_OPERATION' is generated if `glScale' is executed between the
execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glScissor
(x GLint)
(y GLint)
`GL_INVALID_OPERATION' is generated if `glScissor' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glSecondaryColorPointer
(size GLint)
(type GLenum)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glSecondaryColor3i
(red GLint)
(green GLint)
components are clamped to this range before they are interpolated or
written into a color buffer.")
-(define-foreign-procedures
+(define-gl-procedures
((glSelectBuffer
(size GLsizei)
(buffer GLuint-*)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glSeparableFilter2D
(target GLenum)
(internalformat GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glShadeModel (mode GLenum) -> void))
"Select flat or smooth shading.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glShaderSource
(shader GLuint)
(count GLsizei)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilFuncSeparate
(face GLenum)
(func GLenum)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilFunc
(func GLenum)
(ref GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilMaskSeparate
(face GLenum)
(mask GLuint)
executed between the execution of `glBegin' and the corresponding
execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilMask (mask GLuint) -> void))
"Control the front and back writing of individual bits in the stencil
planes.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilOpSeparate
(face GLenum)
(sfail GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glStencilOp
(sfail GLenum)
(dpfail GLenum)
`GL_INVALID_OPERATION' is generated if `glStencilOp' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexCoordPointer
(size GLint)
(type GLenum)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexCoord1i (s GLint) -> void)
(glTexCoord1f (s GLfloat) -> void)
(glTexCoord2i (s GLint) (t GLint) -> void)
with each vertex and with the current raster position. Initially, the
values for S, T, R, and Q are (0, 0, 0, 1).")
-(define-foreign-procedures
+(define-gl-procedures
((glTexEnvf
(target GLenum)
(pname GLenum)
`GL_INVALID_OPERATION' is generated if `glTexEnv' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexGeni
(coord GLenum)
(pname GLenum)
`GL_INVALID_OPERATION' is generated if `glTexGen' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexImage1D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexImage2D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexImage3D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexParameterf
(target GLenum)
(pname GLenum)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexSubImage1D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexSubImage2D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTexSubImage3D
(target GLenum)
(level GLint)
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glTranslatef
(x GLfloat)
(y GLfloat)
`GL_INVALID_OPERATION' is generated if `glTranslate' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glUniform1f
(location GLint)
(v0 GLfloat)
`GL_INVALID_OPERATION' is generated if `glUniform' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glUseProgram (program GLuint) -> void))
"Installs a program object as part of current rendering state.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glValidateProgram (program GLuint) -> void))
"Validates a program object.
between the execution of `glBegin' and the corresponding execution of
`glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glVertexAttribPointer
(index GLuint)
(size GLint)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glVertexAttrib1f
(index GLuint)
(v0 GLfloat)
`GL_INVALID_VALUE' is generated if INDEX is greater than or equal to
`GL_MAX_VERTEX_ATTRIBS'.")
-(define-foreign-procedures
+(define-gl-procedures
((glVertexPointer
(size GLint)
(type GLenum)
`GL_INVALID_VALUE' is generated if STRIDE is negative.")
-(define-foreign-procedures
+(define-gl-procedures
((glVertex2i (x GLint) (y GLint) -> void)
(glVertex2f (x GLfloat) (y GLfloat) -> void)
(glVertex3i
When only X and Y are specified, Z defaults to 0 and W defaults to 1.
When X , Y , and Z are specified, W defaults to 1.")
-(define-foreign-procedures
+(define-gl-procedures
((glViewport
(x GLint)
(y GLint)
`GL_INVALID_OPERATION' is generated if `glViewport' is executed between
the execution of `glBegin' and the corresponding execution of `glEnd'.")
-(define-foreign-procedures
+(define-gl-procedures
((glWindowPos2i (x GLint) (y GLint) -> void)
(glWindowPos2f (x GLfloat) (y GLfloat) -> void)
(glWindowPos3i
--- /dev/null
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;;
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+;;; Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; figl is the Foreign Interface to GL.
+;;
+;;; Code:
+
+(define-module (figl gl runtime)
+ #:use-module (system foreign)
+ #:use-module (figl runtime)
+ #:export (current-gl-resolver
+ current-gl-get-dynamic-object
+ define-gl-procedure
+ define-gl-procedures))
+
+(module-use! (module-public-interface (current-module))
+ (resolve-interface '(figl runtime)))
+
+;;
+;; OpenGL and loading. What a mess. So, in the beginning, when
+;; Microsoft added support for OpenGL to Windows, they did so via a
+;; trampoline DLL. This DLL had a fixed number of entry points, and it
+;; was independent of the driver that the graphics card provided. It
+;; also provided an extension interface, wglGetProcAddress, which could
+;; return additional GL procedures by name. Microsoft was unwilling to
+;; extend their trampoline DLL for whatever reason, and so on Windows
+;; you always needed to wglGetProcAddress for almost any OpenGL
+;; function.
+;;
+;; Time passed and GLX and other GL implementations started to want
+;; extensions too. This let application vendors ship applications that
+;; could take advantage of the capabilities of users's graphics cards
+;; without requiring that they be present.
+;;
+;; There are a couple of differences between WGL and GLX, however.
+;; Chiefly, wglGetProcAddress can only be called once you have a
+;; context, and the resulting function can only be used in that context.
+;; In practice it seems that it can be used also in other contexts that
+;; end up referring to that same driver and GPU. GLX on the other hand
+;; is context-independent, but presence of a function does not mean that
+;; the corresponding functionality is actually available. In theory
+;; users have to check for the presence of the GL extension or check the
+;; core GL version, depending on whether the interface is an extension
+;; or in GL core.
+;;
+;; Because of this difference between the GLX and WGL semantics, there
+;; is no core "glGetProcAddress" function. It's terrible: each
+;; windowing system is responsible for providing their own
+;; function-loader interface.
+;;
+;; Finally, Guile needs to load up at least some interfaces using
+;; dynamic-link / dynamic-pointer in order to be able to talk to the
+;; library at all (and to open a context in the case of Windows), and it
+;; happens that these interfaces also work fine for getting some of the
+;; GL functionality!
+;;
+;; All of this mess really has very little place in the world of free
+;; software, where dynamic linking is entirely sufficient to deal with
+;; this issue, but it is how things have evolved.
+;;
+;; In light of all of this, we need to make some simplifications.
+;;
+;; One is that each low-level function will have just one foreign
+;; function wrapper. This means that a minority of Windows
+;; configurations won't work. Oh well.
+;;
+;; Another is that if dynamic-link returns a result, that it is assumed
+;; that glXGetProcAddress (or the equivalent) would return the same
+;; value. So we can try dynamic-link first, and only dispatch to e.g
+;; glXGetProcAddress if that fails.
+;;
+;; Finally, we assume that all GL symbols may be resolved by
+;; dynamic-pointer by looking in one library, regardless of whether they
+;; come from the lower GL level or from the window-system-specific
+;; level.
+;;
+
+;; Parameterize this with glXGetProcAddress, eglGetProcAddress, etc.
+(define current-gl-resolver
+ (make-parameter (lambda (name) %null-pointer)))
+
+;; Parameterize this with a procedure that returns a dynamic object we
+;; can use to get libGL bindings.
+(define current-gl-get-dynamic-object
+ (make-parameter (lambda () (dynamic-link))))
+
+(define (resolve name)
+ (let ((ptr ((current-gl-resolver) (symbol->string name))))
+ (if (null-pointer? ptr)
+ (dynamic-pointer (symbol->string name)
+ ((current-gl-get-dynamic-object)))
+ ptr)))
+
+(define-syntax define-gl-procedure
+ (syntax-rules (->)
+ ((define-gl-procedure (name (pname ptype) ... -> type)
+ docstring)
+ (define-foreign-procedure (name (pname ptype) ... -> type)
+ (resolve 'name)
+ docstring))))
+
+(define-syntax define-gl-procedures
+ (syntax-rules ()
+ ((define-gl-procedures ((name prototype ...) ...)
+ docstring)
+ (begin
+ (define-gl-procedure (name prototype ...)
+ docstring)
+ ...))))
(define-module
(figl glu low-level)
#:use-module
- (figl runtime)
+ (figl glu runtime)
#:use-module
(figl glu types)
#:export
gluUnProject4
gluUnProject))
-(define-foreign-procedures
+(define-glu-procedures
((gluBeginCurve (nurb GLUnurbs*) -> void)
(gluEndCurve (nurb GLUnurbs*) -> void))
"Delimit a NURBS curve definition.
`glPushAttrib' reference page for details on exactly what state these
calls preserve.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBeginPolygon (tess GLUtesselator*) -> void)
(gluEndPolygon (tess GLUtesselator*) -> void))
"Delimit a polygon description.
resulting triangles are described through callbacks. See
`gluTessCallback' for descriptions of the callback functions.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBeginSurface (nurb GLUnurbs*) -> void)
(gluEndSurface (nurb GLUnurbs*) -> void))
"Delimit a NURBS surface definition.
`glPushAttrib'(`GLU_EVAL_BIT') and `glPopAttrib'. See the `glPushAttrib'
reference page for details on exactly what state these calls preserve.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBeginTrim (nurb GLUnurbs*) -> void)
(gluEndTrim (nurb GLUnurbs*) -> void))
"Delimit a NURBS trimming loop definition.
If no trimming information is given for a NURBS surface, the entire
surface is drawn.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild1DMipmapLevels
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild1DMipmaps
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild2DMipmapLevels
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild2DMipmaps
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild3DMipmapLevels
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluBuild3DMipmaps
(target GLenum)
(internalFormat GLint)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluCheckExtension
(extName const-GLubyte-*)
(extString const-GLubyte-*)
`gluGetString', `glXGetClientString', `glXQueryExtensionsString', or
`glXQueryServerString', respectively, as EXTSTRING.")
-(define-foreign-procedures
+(define-glu-procedures
((gluCylinder
(quad GLUquadric*)
(base GLdouble)
+X axis, to 0.5 at the -Y axis, to 0.75 at the \\-X axis, and back to 1.0
at the +Y axis.")
-(define-foreign-procedures
+(define-glu-procedures
((gluDeleteNurbsRenderer (nurb GLUnurbs*) -> void))
"Destroy a NURBS object.
with `gluNewNurbsRenderer') and frees any memory it uses. Once
`gluDeleteNurbsRenderer' has been called, NURB cannot be used again.")
-(define-foreign-procedures
+(define-glu-procedures
((gluDeleteQuadric (quad GLUquadric*) -> void))
"Destroy a quadrics object.
`gluNewQuadric') and frees any memory it uses. Once `gluDeleteQuadric'
has been called, QUAD cannot be used again.")
-(define-foreign-procedures
+(define-glu-procedures
((gluDeleteTess (tess GLUtesselator*) -> void))
"Destroy a tessellation object.
`gluDeleteTess' destroys the indicated tessellation object (which was
created with `gluNewTess') and frees any memory that it used.")
-(define-foreign-procedures
+(define-glu-procedures
((gluDisk
(quad GLUquadric*)
(inner GLdouble)
at (R, 0, 0) is (1, 0.5), at (0, R, 0) it is (0.5, 1), at (\\-R, 0, 0) it
is (0, 0.5), and at (0, \\-R, 0) it is (0.5, 0).")
-(define-foreign-procedures
+(define-glu-procedures
((gluErrorString
(error GLenum)
->
`NULL' is returned if ERROR is not a valid GL or GLU error code.")
-(define-foreign-procedures
+(define-glu-procedures
((gluGetNurbsProperty
(nurb GLUnurbs*)
(property GLenum)
rendered. See the `gluNurbsProperty' reference page for information
about what the properties are and what they do.")
-(define-foreign-procedures
+(define-glu-procedures
((gluGetString (name GLenum) -> const-GLubyte-*))
"Return a string describing the GLU version or GLU extensions .
NULL is returned if NAME is not `GLU_VERSION' or `GLU_EXTENSIONS'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluGetTessProperty
(tess GLUtesselator*)
(which GLenum)
interpreted and rendered. See the `gluTessProperty' reference page for
information about the properties and what they do.")
-(define-foreign-procedures
+(define-glu-procedures
((gluLoadSamplingMatrices
(nurb GLUnurbs*)
(model const-GLfloat-*)
round trip to the GL server is needed to fetch the current values of the
modelview matrix, projection matrix, and viewport.)")
-(define-foreign-procedures
+(define-glu-procedures
((gluLookAt
(eyeX GLdouble)
(eyeY GLdouble)
glMultMatrixf(M);
glTranslated(-eyex, -eyey, -eyez);")
-(define-foreign-procedures
+(define-glu-procedures
((gluNewNurbsRenderer -> GLUnurbs*))
"Create a NURBS object.
control functions. A return value of 0 means that there is not enough
memory to allocate the object.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNewQuadric -> GLUquadric*))
"Create a quadrics object.
control functions. A return value of 0 means that there is not enough
memory to allocate the object.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNewTess -> GLUtesselator*))
"Create a tessellation object.
return value of 0 means that there is not enough memory to allocate the
object.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNextContour
(tess GLUtesselator*)
(type GLenum)
only. Calls to `gluNextContour' are mapped to `gluTessEndContour'
followed by `gluTessBeginContour'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsCallbackDataEXT
(nurb GLUnurbs*)
(userData GLvoid*)
data to NURBS tessellator. A copy of this pointer will be passed by the
tessellator in the NURBS callback functions (set by `gluNurbsCallback').")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsCallbackData
(nurb GLUnurbs*)
(userData GLvoid*)
data to NURBS tessellator. A copy of this pointer will be passed by the
tessellator in the NURBS callback functions (set by `gluNurbsCallback').")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsCallback
(nurb GLUnurbs*)
(which GLenum)
void endData( void *userData );")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsCurve
(nurb GLUnurbs*)
(knotCount GLint)
the `gluBeginTrim' reference page for more discussion about trimming
curves.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsProperty
(nurb GLUnurbs*)
(property GLenum)
from `GLU_TRUE' to `GLU_FALSE' does not affect the sampling and
culling matrices until `gluLoadSamplingMatrices' is called.")
-(define-foreign-procedures
+(define-glu-procedures
((gluNurbsSurface
(nurb GLUnurbs*)
(sKnotCount GLint)
must have (SKNOTCOUNT - SORDER) TIMES (TKNOTCOUNT - TORDER) control
points.")
-(define-foreign-procedures
+(define-glu-procedures
((gluOrtho2D
(left GLdouble)
(right GLdouble)
`gluOrtho2D' sets up a two-dimensional orthographic viewing region. This
is equivalent to calling `glOrtho' with NEAR=-1 and FAR=1 .")
-(define-foreign-procedures
+(define-glu-procedures
((gluPartialDisk
(quad GLUquadric*)
(inner GLdouble)
at (R, 0, 0) is (1.0, 0.5), at (0, R, 0) it is (0.5, 1.0), at (\\-R, 0,
0) it is (0.0, 0.5), and at (0, \\-R, 0) it is (0.5, 0.0).")
-(define-foreign-procedures
+(define-glu-procedures
((gluPerspective
(fovy GLdouble)
(aspect GLdouble)
((F/ASPECT 0 0 0), (0 F 0 0), (0 0 ZFAR+ZNEAR,/ZNEAR-ZFAR,
2×ZFAR×ZNEAR,/ZNEAR-ZFAR,), (0 0 -1 0),)")
-(define-foreign-procedures
+(define-glu-procedures
((gluPickMatrix
(x GLdouble)
(y GLdouble)
with the pick matrix than the way it was subdivided without the pick
matrix.")
-(define-foreign-procedures
+(define-glu-procedures
((gluProject
(objX GLdouble)
(objY GLdouble)
WINX=VIEW\u2061(0,)+VIEW\u2061(2,)×(V^″\u2061(0,)+1,)/2
WINY=VIEW\u2061(1,)+VIEW\u2061(3,)×(V^″\u2061(1,)+1,)/2 WINZ=(V^″\u2061(2,)+1,)/2")
-(define-foreign-procedures
+(define-glu-procedures
((gluPwlCurve
(nurb GLUnurbs*)
(count GLint)
parameter space. See the `gluBeginTrim' reference page for more
information about trimming curves.")
-(define-foreign-procedures
+(define-glu-procedures
((gluQuadricCallback
(quad GLUquadric*)
(which GLenum)
that occurred. Character strings describing these errors can be
retrieved with the `gluErrorString' call.")
-(define-foreign-procedures
+(define-glu-procedures
((gluQuadricDrawStyle
(quad GLUquadric*)
(draw GLenum)
`GLU_POINT'
Quadrics are rendered as a set of points.")
-(define-foreign-procedures
+(define-glu-procedures
((gluQuadricNormals
(quad GLUquadric*)
(normal GLenum)
One normal is generated for every vertex of a quadric. This is the
initial value.")
-(define-foreign-procedures
+(define-glu-procedures
((gluQuadricOrientation
(quad GLUquadric*)
(orientation GLenum)
Note that the interpretation of OUTWARD and INWARD depends on the
quadric being drawn.")
-(define-foreign-procedures
+(define-glu-procedures
((gluQuadricTexture
(quad GLUquadric*)
(texture GLboolean)
The manner in which texture coordinates are generated depends upon the
specific quadric rendered.")
-(define-foreign-procedures
+(define-glu-procedures
((gluScaleImage
(format GLenum)
(wIn GLsizei)
`GLU_UNSIGNED_INT_10_10_10_2' or `GLU_UNSIGNED_INT_2_10_10_10_REV' and
FORMAT is neither `GLU_RGBA' nor `GLU_BGRA'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluSphere
(quad GLUquadric*)
(radius GLdouble)
ranges from 0.0 at the +Y axis, to 0.25 at the +X axis, to 0.5 at the
\\-Y axis, to 0.75 at the \\-X axis, and back to 1.0 at the +Y axis.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessBeginContour
(tess GLUtesselator*)
->
page for more details. `gluTessBeginContour' can only be called between
`gluTessBeginPolygon' and `gluTessEndPolygon'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessBeginPolygon
(tess GLUtesselator*)
(data GLvoid*)
resulting triangles are described through callbacks. See
`gluTessCallback' for descriptions of the callback functions.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessCallback
(tess GLUtesselator*)
(which GLenum)
void errorData( GLenum errno, void *polygon_data );")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessEndPolygon (tess GLUtesselator*) -> void))
"Delimit a polygon description.
resulting triangles are described through callbacks. See
`gluTessCallback' for descriptions of the callback functions.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessNormal
(tess GLUtesselator*)
(valueX GLdouble)
The supplied normal persists until it is changed by another call to
`gluTessNormal'.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessProperty
(tess GLUtesselator*)
(which GLenum)
distinguish which side of the edge the vertex lies on. Two edges
are merged only when both endpoints are identical.")
-(define-foreign-procedures
+(define-glu-procedures
((gluTessVertex
(tess GLUtesselator*)
(location GLdouble-*)
`GLU_TESS_VERTEX_DATA' callback after tessellation (see the
`gluTessCallback' reference page).")
-(define-foreign-procedures
+(define-glu-procedures
((gluUnProject4
(winX GLdouble)
(winY GLdouble)
`gluUnProject4' is equivalent to `gluUnProject' when CLIPW is 1, NEARVAL
is 0, and FARVAL is 1.")
-(define-foreign-procedures
+(define-glu-procedures
((gluUnProject
(winX GLdouble)
(winY GLdouble)
--- /dev/null
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;;
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+;;; Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; figl is the Foreign Interface to GL.
+;;
+;;; Code:
+
+(define-module (figl glu runtime)
+ #:use-module (system foreign)
+ #:use-module (figl runtime)
+ #:export (define-glu-procedure define-glu-procedures))
+
+(define libGLU
+ (delay (dynamic-link "libGLU")))
+
+(define (resolve name)
+ (dynamic-pointer (symbol->string name) (force libGLU)))
+
+(define-syntax define-glu-procedure
+ (syntax-rules (->)
+ ((define-glu-procedure (name (pname ptype) ... -> type)
+ docstring)
+ (define-foreign-procedure (name (pname ptype) ... -> type)
+ (resolve 'name)
+ docstring))))
+
+(define-syntax define-glu-procedures
+ (syntax-rules ()
+ ((define-glu-procedures ((name prototype ...) ...)
+ docstring)
+ (begin
+ (define-glu-procedure (name prototype ...)
+ docstring)
+ ...))))
(define-module (figl glut low-level)
#:use-module (figl runtime)
+ #:use-module (figl glut runtime)
#:use-module (figl gl types)
#:use-module ((system foreign) #:renamer (symbol-prefix-proc 'ffi:))
#:use-module (srfi srfi-26) ; cut
glutWireTeapot
))
-(define libglut (dynamic-link "libglut"))
-
-(define (glut-resolver name)
- (dynamic-pointer name libglut))
-
-(current-resolver glut-resolver)
-
(define-simple-foreign-type int ffi:int)
(define-simple-foreign-type unsigned-int ffi:unsigned-int)
;;; 2 Initialization
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutInit (argcp int-*) (argv char-**) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutInitWindowPosition (x int) (y int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutInitWindowSize (width int) (height int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutInitDisplayMode (mode unsigned-int) -> void)
#f)
;;; 3 Begin Event Processing
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutMainLoop -> void)
#f)
;;; 4 Window Management
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutCreateWindow (name char-*) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutCreateSubWindow (win int)
(x int)
(y int)
int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSetWindow (win int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutGetWindow -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutDestroyWindow (win int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPostRedisplay -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSwapBuffers -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPositionWindow (x int) (y int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutReshapeWindow (width int) (height int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutFullScreen -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPopWindow -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPushWindow -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutShowWindow -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutHideWindow -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutIconifyWindow -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSetWindowTitle (name char-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSetIconTitle (name char-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSetCursor (cursor int) -> void)
#f)
;;; 5 Overlay Management
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutEstablishOverlay -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutUseLayer (layer GLenum) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutRemoveOverlay -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPostOverlayRedisplay -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutShowOverlay -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutHideOverlay -> void)
#f)
;;; 6 Menu Management
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutCreateMenu (func void-*) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSetMenu (menu int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutGetMenu -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutDestroyMenu (menu int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutAddMenuEntry (name char-*) (value int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutAddSubMenu (name char-*) (menu int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutChangeToMenuEntry (entry int)
(name char-*)
(value int)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutChangeToSubMenu (entry int)
(name char-*)
(menu int)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutRemoveMenuItem (entry int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutAttachMenu (button int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutDetachMenu (button int) -> void)
#f)
;;; 7 Callback Registration
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutDisplayFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutOverlayDisplayFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutReshapeFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutKeyboardFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutMouseFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutMotionFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutPassiveMotionFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutVisibilityFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutEntryFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSpecialFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSpaceballMotionFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSpaceballRotateFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSpaceballButtonFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutButtonBoxFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutDialsFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutTabletMotionFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutTabletButtonFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutMenuStatusFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutMenuStateFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutIdleFunc (func void-*) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutTimerFunc (msecs unsigned-int)
(func void-*)
(value int)
;;; 8 Color Index Colormap Management
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutSetColor (cell int)
(red GLfloat)
(green GLfloat)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutGetColor (cell int) (component int) -> GLfloat)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutCopyColormap (win int) -> void)
#f)
;;; 9 State Retrieval
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutGet (state GLenum) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutLayerGet (info GLenum) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutDeviceGet (info GLenum) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutGetModifiers -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutExtensionSupported (extension char-*) -> int)
#f)
;;; 10 Font Rendering
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutBitmapCharacter (font void-*) (character int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutBitmapWidth (font void-*) (character int) -> int)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutStrokeCharacter (font void-*) (character int) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutStrokeWidth (font void-*) (character int) -> void)
#f)
;;; 11 Geometric Object Rendering
;;;
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidSphere (radius GLdouble)
(slices GLint)
(stacks GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireSphere (radius GLdouble)
(slices GLint)
(stacks GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidCube (size GLdouble) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireCube (size GLdouble) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidCone (base GLdouble)
(height GLdouble)
(slices GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireCone (base GLdouble)
(height GLdouble)
(slices GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidTorus (inner-radius GLdouble)
(outer-radius GLdouble)
(sides GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireTorus (inner-radius GLdouble)
(outer-radius GLdouble)
(sides GLint)
void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidDodecahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireDodecahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidOctahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireOctahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidTetrahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireTetrahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidIcosahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireIcosahedron -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutSolidTeapot (size GLdouble) -> void)
#f)
-(define-foreign-procedure
+(define-glut-procedure
(glutWireTeapot (size GLdouble) -> void)
#f)
--- /dev/null
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;;
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+;;; Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; figl is the Foreign Interface to GL.
+;;
+;;; Code:
+
+(define-module (figl glut runtime)
+ #:use-module (system foreign)
+ #:use-module (figl runtime)
+ #:use-module (figl gl runtime)
+ #:export (define-glut-procedure define-glut-procedures))
+
+(define libglut
+ (delay (dynamic-link "libglut")))
+
+(define (get-libglut)
+ (force libglut))
+
+(current-gl-get-dynamic-object get-libglut)
+
+(define (resolve name)
+ (dynamic-pointer (symbol->string name) (get-libglut)))
+
+(define-syntax define-glut-procedure
+ (syntax-rules (->)
+ ((define-glut-procedure (name (pname ptype) ... -> type)
+ docstring)
+ (define-foreign-procedure (name (pname ptype) ... -> type)
+ (resolve 'name)
+ docstring))))
+
+(define-syntax define-glut-procedures
+ (syntax-rules ()
+ ((define-glut-procedures ((name prototype ...) ...)
+ docstring)
+ (begin
+ (define-glut-procedure (name prototype ...)
+ docstring)
+ ...))))
#:use-module (figl runtime)
#:use-module (figl glx low-level))
-(define libGL
- (delay (dynamic-link "libGL")))
-
-(define glXGetProcAddress
- (delay (pointer->procedure
- '*
- (dynamic-pointer "glXGetProcAddress" (force libGL))
- '(*))))
-
-(define (glx-resolver name)
- ((force glXGetProcAddress) (string->pointer name)))
-
-(current-resolver glx-resolver)
(define-module
(figl glx low-level)
#:use-module
- (figl runtime)
+ (figl glx runtime)
#:use-module
(figl glx types)
#:export
glXWaitGL
glXWaitX))
-(define-foreign-procedures
+(define-glx-procedures
((glXChooseFBConfig
(dpy Display-*)
(screen int)
ATTRIB_LIST, if SCREEN is invalid, or if DPY does not support the GLX
extension.")
-(define-foreign-procedures
+(define-glx-procedures
((glXChooseVisual
(dpy Display-*)
(screen int)
`NULL' is returned if an undefined GLX attribute is encountered in
ATTRIBLIST.")
-(define-foreign-procedures
+(define-glx-procedures
((glXCopyContext
(dpy Display-*)
(src GLXContext)
`GLXBadContext' is generated if either SRC or DST is not a valid GLX
context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreateContext
(dpy Display-*)
(vis XVisualInfo-*)
`BadAlloc' is generated if the server does not have enough resources to
allocate the new context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreateGLXPixmap
(dpy Display-*)
(vis XVisualInfo-*)
`BadAlloc' is generated if the server cannot allocate the GLX pixmap.")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreateNewContext
(dpy Display-*)
(config GLXFBConfig)
`BadValue' is generated if CONFIG is not a valid visual (for example, if
a particular GLX implementation does not support it).")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreatePbuffer
(dpy Display-*)
(config GLXFBConfig)
`BadMatch' is generated if CONFIG does not support rendering to pixel
buffers (e.g., `GLX_DRAWABLE_TYPE' does not contain `GLX_PBUFFER_BIT').")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreatePixmap
(dpy Display-*)
(config GLXFBConfig)
`GLXBadFBConfig' is generated if CONFIG is not a valid GLXFBConfig.")
-(define-foreign-procedures
+(define-glx-procedures
((glXCreateWindow
(dpy Display-*)
(config GLXFBConfig)
`GLXBadFBConfig' is generated if CONFIG is not a valid GLXFBConfig.")
-(define-foreign-procedures
+(define-glx-procedures
((glXDestroyContext
(dpy Display-*)
(ctx GLXContext)
`GLXBadContext' is generated if CTX is not a valid GLX context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXDestroyGLXPixmap
(dpy Display-*)
(pix GLXPixmap)
`GLXBadPixmap' is generated if PIX is not a valid GLX pixmap.")
-(define-foreign-procedures
+(define-glx-procedures
((glXDestroyPbuffer
(dpy Display-*)
(pbuf GLXPbuffer)
`GLXBadPbuffer' is generated if PBUF is not a valid GLXPbuffer.")
-(define-foreign-procedures
+(define-glx-procedures
((glXDestroyPixmap
(dpy Display-*)
(pixmap GLXPixmap)
`GLXBadPixmap' is generated if PIXMAP is not a valid GLXPixmap.")
-(define-foreign-procedures
+(define-glx-procedures
((glXDestroyWindow
(dpy Display-*)
(win GLXWindow)
`GLXBadWindow' is generated if WIN is not a valid GLXPixmap.")
-(define-foreign-procedures
+(define-glx-procedures
((glXFreeContextEXT
(dpy Display-*)
(ctx GLXContext)
`GLXBadContext' is generated if CTX does not refer to a valid context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetClientString
(dpy Display-*)
(name int)
length. The vendor-specific information is optional. However, if it is
present, the format and contents are implementation specific.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetConfig
(dpy Display-*)
(vis XVisualInfo-*)
`GLX_BAD_VISUAL' is returned if VIS doesn't support GLX and an attribute
other than `GLX_USE_GL' is requested.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetContextIDEXT
(ctx const-GLXContext)
->
`GLXBadContext' is generated if CTX does not refer to a valid context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetCurrentContext -> GLXContext))
"Return the current context.
`glXGetCurrentContext' returns client-side information. It does not make
a round trip to the server.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetCurrentDisplay -> Display-*))
"Get display for current context.
a round-trip to the server, and therefore does not flush any pending
events.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetCurrentDrawable -> GLXDrawable))
"Return the current drawable.
`glXGetCurrentDrawable' returns client-side information. It does not
make a round trip to the server.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetCurrentReadDrawable -> GLXDrawable))
"Return the current drawable.
`glXGetCurrentReadDrawable' returns client-side information. It does not
make a round-trip to the server.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetFBConfigAttrib
(dpy Display-*)
(config GLXFBConfig)
extension. `GLX_BAD_ATTRIBUTE' is returned if ATTRIBUTE is not a valid
GLX attribute.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetFBConfigs
(dpy Display-*)
(screen int)
screen specified by SCREEN. Use `glXGetFBConfigAttrib' to obtain
attribute values from a specific GLXFBConfig.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetProcAddress
(procName const-GLubyte-*)
->
PROCNAME. This is necessary in environments where the OpenGL link
library exports a different set of functions than the runtime library.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetSelectedEvent
(dpy Display-*)
(draw GLXDrawable)
`GLXBadDrawable' is generated if DRAW is not a valid window or a valid
GLX pixel buffer.")
-(define-foreign-procedures
+(define-glx-procedures
((glXGetVisualFromFBConfig
(dpy Display-*)
(config GLXFBConfig)
Returns `NULL' if CONFIG is not a valid GLXFBConfig.")
-(define-foreign-procedures
+(define-glx-procedures
((glXImportContextEXT
(dpy Display-*)
(contextID GLXContextID)
`GLXBadContext' is generated if CONTEXTID does not refer to a valid
context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXIsDirect
(dpy Display-*)
(ctx GLXContext)
`GLXBadContext' is generated if CTX is not a valid GLX context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXMakeContextCurrent
(display Display-*)
(draw GLXDrawable)
DRAW or READ is a GLXWindow or GLXPbuffer and CTX was previously bound
to a GLXPixmap.")
-(define-foreign-procedures
+(define-glx-procedures
((glXMakeCurrent
(dpy Display-*)
(drawable GLXDrawable)
ancillary buffers until `glXMakeCurrent' is called, only to find that it
has insufficient resources to complete the allocation.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryContextInfoEXT
(dpy Display-*)
(ctx GLXContext)
fred `GLX_BAD_CONTEXT' is returned if ATTRIBUTE is not a valid context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryContext
(dpy Display-*)
(ctx GLXContext)
`GLXBadContext' is generated if CTX does not refer to a valid context.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryDrawable
(dpy Display-*)
(draw GLXDrawable)
A `GLXBadDrawable' is generated if DRAW is not a valid GLXDrawable.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryExtensionsString
(dpy Display-*)
(screen int)
(The extension names themselves never contain spaces.) If there are no
extensions to GLX, then the empty string is returned.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryExtension
(dpy Display-*)
(errorBase int-*)
ERRORBASE and EVENTBASE do not return values if they are specified as
`NULL'.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryServerString
(dpy Display-*)
(screen int)
for `glXGetClientString'. If NAME is not set to a recognized value,
`NULL' is returned.")
-(define-foreign-procedures
+(define-glx-procedures
((glXQueryVersion
(dpy Display-*)
(major int-*)
MAJOR and MINOR are not updated when `False' is returned.")
-(define-foreign-procedures
+(define-glx-procedures
((glXSelectEvent
(dpy Display-*)
(draw GLXDrawable)
`GLXBadDrawable' is generated if DRAW is not a valid window or a valid
GLX pixel buffer.")
-(define-foreign-procedures
+(define-glx-procedures
((glXSwapBuffers
(dpy Display-*)
(drawable GLXDrawable)
calling thread, and DRAWABLE identifies a window that is no longer
valid.")
-(define-foreign-procedures
+(define-glx-procedures
((glXUseXFont
(font Font)
(first int)
current context of the calling thread is a window, and that window is no
longer valid.")
-(define-foreign-procedures
+(define-glx-procedures
((glXWaitGL -> void))
"Complete GL execution prior to subsequent X calls.
current context of the calling thread is a window, and that window is no
longer valid.")
-(define-foreign-procedures
+(define-glx-procedures
((glXWaitX -> void))
"Complete X execution prior to subsequent GL calls.
--- /dev/null
+;;; figl
+;;; Copyright (C) 2013 Andy Wingo <wingo@pobox.com>
+;;;
+;;; Figl is free software: you can redistribute it and/or modify it
+;;; under the terms of the GNU Lesser General Public License as
+;;; published by the Free Software Foundation, either version 3 of the
+;;; License, or (at your option) any later version.
+;;;
+;;; Figl is distributed in the hope that it will be useful, but WITHOUT
+;;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+;;; or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
+;;; Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with this program. If not, see
+;;; <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+;; figl is the Foreign Interface to GL.
+;;
+;;; Code:
+
+(define-module (figl glx runtime)
+ #:use-module (system foreign)
+ #:use-module (figl gl types)
+ #:use-module (figl gl runtime)
+ #:use-module (figl runtime)
+ #:export (define-glx-procedure define-glx-procedures))
+
+(define libGL
+ (delay (dynamic-link "libGL")))
+
+(define (get-libGL)
+ (force libGL))
+
+(define (dladdr-resolve name)
+ (dynamic-pointer (symbol->string name) (get-libGL)))
+
+(define-foreign-procedure (glx-resolve (name const-GLchar-*) -> void-*)
+ (dladdr-resolve 'glXGetProcAddress)
+ "The GLX resolver.")
+
+(current-gl-resolver glx-resolve)
+(current-gl-get-dynamic-object get-libGL)
+
+(define (resolve name)
+ (let ((ptr (glx-resolve (symbol->string name))))
+ (if (null-pointer? ptr)
+ (dladdr-resolve name)
+ ptr)))
+
+(define-syntax define-glx-procedure
+ (syntax-rules (->)
+ ((define-glx-procedure (name (pname ptype) ... -> type)
+ docstring)
+ (define-foreign-procedure (name (pname ptype) ... -> type)
+ (resolve 'name)
+ docstring))))
+
+(define-syntax define-glx-procedures
+ (syntax-rules ()
+ ((define-glx-procedures ((name prototype ...) ...)
+ docstring)
+ (begin
+ (define-glx-procedure (name prototype ...)
+ docstring)
+ ...))))
(define-module (figl runtime)
#:use-module (system foreign)
- #:export (current-resolver
- define-foreign-procedure
+ #:export (define-foreign-procedure
define-foreign-procedures
define-foreign-type
define-simple-foreign-type))
-;;
-;; OpenGL and loading. What a mess. So, in the beginning, when
-;; Microsoft added support for OpenGL to Windows, they did so via a
-;; trampoline DLL. This DLL had a fixed number of entry points, and it
-;; was independent of the driver that the graphics card provided. It
-;; also provided an extension interface, wglGetProcAddress, which could
-;; return additional GL procedures by name. Microsoft was unwilling to
-;; extend their trampoline DLL for whatever reason, and so on Windows
-;; you always needed to wglGetProcAddress for almost any OpenGL
-;; function.
-;;
-;; Time passed and GLX and other GL implementations started to want
-;; extensions too. This let application vendors ship applications that
-;; could take advantage of the capabilities of users's graphics cards
-;; without requiring that they be present.
-;;
-;; There are a couple of differences between WGL and GLX, however.
-;; Chiefly, wglGetProcAddress can only be called once you have a
-;; context, and the resulting function can only be used in that context.
-;; In practice it seems that it can be used also in other contexts that
-;; end up referring to that same driver and GPU. GLX on the other hand
-;; is context-independent, but presence of a function does not mean that
-;; the corresponding functionality is actually available. In theory
-;; users have to check for the presence of the GL extension or check the
-;; core GL version, depending on whether the interface is an extension
-;; or in GL core.
-;;
-;; Because of this difference between the GLX and WGL semantics, there
-;; is no core "glGetProcAddress" function. It's terrible: each
-;; windowing system is responsible for providing their own
-;; function-loader interface.
-;;
-;; Finally, Guile needs to load up at least some interfaces using
-;; dynamic-link / dynamic-pointer in order to be able to talk to the
-;; library at all (and to open a context in the case of Windows), and it
-;; happens that these interfaces also work fine for getting some of the
-;; GL functionality!
-;;
-;; All of this mess really has very little place in the world of free
-;; software, where dynamic linking is entirely sufficient to deal with
-;; this issue, but it is how things have evolved.
-;;
-;; In light of all of this, we need to make some simplifications.
-;;
-;; One is that each low-level function will have just one foreign
-;; function wrapper. This means that a minority of Windows
-;; configurations won't work. Oh well.
-;;
-;; Another is that if dynamic-link returns a result, that it is assumed
-;; that glXGetProcAddress (or the equivalent) would return the same
-;; value. So we can try dynamic-link first, and only dispatch to e.g
-;; glXGetProcAddress if that fails.
-;;
-;; Finally, we assume that all GL symbols may be resolved by
-;; dynamic-pointer by looking in one library, regardless of whether they
-;; come from the lower GL level or from the window-system-specific
-;; level.
-;;
-
-;; FIXME: adapt implementation to match!
-(define (default-resolver name)
- (dynamic-pointer name (dynamic-link)))
-
-(define current-resolver
- (make-parameter default-resolver))
-
-(define (resolve name)
- ((current-resolver) name))
-
(define-syntax foreign-trampoline
- (lambda (stx)
- (syntax-case stx (->)
- ((_ trampoline
- name (pname ptype) ... -> type)
- (with-syntax ((sname (symbol->string (syntax->datum #'name))))
- #'(lambda (pname ...)
- (let ((ptr (resolve sname)))
- (set! trampoline
- (pointer->procedure (type)
- ptr
- (list (ptype) ...)))
- (trampoline pname ...))))))))
+ (syntax-rules (->)
+ ((_ trampoline resolve-name (pname ptype) ... -> type)
+ (lambda (pname ...)
+ (set! trampoline
+ (pointer->procedure (type)
+ resolve-name
+ (list (ptype) ...)))
+ (trampoline pname ...)))))
(define-syntax define-foreign-procedure
(syntax-rules (->)
((define-foreign-procedure (name (pname ptype) ... -> type)
+ resolve-name
docstring)
(define name
(letrec ((trampoline
- (foreign-trampoline trampoline
- name (pname ptype) ... -> type))
+ (foreign-trampoline trampoline resolve-name
+ (pname ptype) ... -> type))
(name (lambda (pname ...)
docstring
(let ((pname (ptype #:unwrap pname))
(define-syntax define-foreign-procedures
(syntax-rules ()
((define-foreign-procedures ((name prototype ...) ...)
+ resolve-name
docstring)
(begin
(define-foreign-procedure (name prototype ...)
+ resolve-name
docstring)
...))))
(newline port)
(pretty-print
`(define-module (figl ,mod-name low-level)
- #:use-module (figl runtime)
+ #:use-module (figl ,mod-name runtime)
#:use-module (figl ,mod-name types)
#:export ,(append-map (lambda (def)
(map car (gl-definition-prototypes def)))
(for-each
(lambda (def)
(pretty-print
- `(define-foreign-procedures ,(gl-definition-prototypes def)
- ,(string-trim-both
- (stexi->plain-text
- (gl-definition-documentation def))))
+ `(,(symbol-append 'define- mod-name '-procedures)
+ ,(gl-definition-prototypes def)
+ ,(string-trim-both
+ (stexi->plain-text
+ (gl-definition-documentation def))))
port)
(newline port))
defs))