summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--chickadee/graphics/gl.scm386
-rw-r--r--chickadee/graphics/gpu.scm278
3 files changed, 276 insertions, 389 deletions
diff --git a/Makefile.am b/Makefile.am
index 09eff46..b6d4ab2 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -66,7 +66,6 @@ SOURCES = \
chickadee/image.scm \
chickadee/image/jpeg.scm \
chickadee/image/png.scm \
- chickadee/graphics/gl.scm \
chickadee/graphics/gpu.scm \
chickadee/graphics/engine.scm \
chickadee/graphics/color.scm \
diff --git a/chickadee/graphics/gl.scm b/chickadee/graphics/gl.scm
deleted file mode 100644
index 27872dd..0000000
--- a/chickadee/graphics/gl.scm
+++ /dev/null
@@ -1,386 +0,0 @@
-;;; Chickadee Game Toolkit
-;;; Copyright © 2016, 2021 David Thompson <dthompson2@worcester.edu>
-;;;
-;;; Licensed under the Apache License, Version 2.0 (the "License");
-;;; you may not use this file except in compliance with the License.
-;;; You may obtain a copy of the License at
-;;;
-;;; http://www.apache.org/licenses/LICENSE-2.0
-;;;
-;;; Unless required by applicable law or agreed to in writing, software
-;;; distributed under the License is distributed on an "AS IS" BASIS,
-;;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-;;; See the License for the specific language governing permissions and
-;;; limitations under the License.
-
-;;; Commentary:
-;;
-;; Custom wrappers over low level OpenGL commands that aren't part of
-;; guile-opengl.
-;;
-;;; Code:
-
-(define-module (chickadee graphics gl)
- #:use-module (srfi srfi-4)
- #:use-module ((system foreign) #:select (bytevector->pointer))
- #:use-module (gl)
- #:use-module (gl runtime)
- #:use-module ((gl low-level) #:renamer (symbol-prefix-proc '%))
- #:use-module (gl enums)
- #:use-module (gl runtime)
- #:use-module (gl types))
-
-(re-export (%glClearColor . gl-clear-color)
- (%glScissor . gl-scissor)
- (%glBlendFunc . gl-blend-func)
- (%glBlendEquation . gl-blend-equation))
-
-;;;
-;;; 3.8.1 Texture Image Specification
-;;;
-
-(re-export (%glTexImage3D . gl-texture-image-3d)
- (%glTexImage2D . gl-texture-image-2d)
- (%glTexImage1D . gl-texture-image-1d))
-
-;; For some reason, guile-opengl does not bind glGenerateMipmap, so we
-;; have to do it ourselves.
-(define-gl-procedure (glGenerateMipmap (target GLenum) -> void)
- "Generate mipmaps for the texture attached to target of the active
-texture unit.")
-
-(export (glGenerateMipmap . gl-generate-mipmap))
-
-;;;
-;;; 3.8.2 Alternate Texture Image Specification Commands
-;;;
-
-(re-export (%glCopyTexImage2D . gl-copy-texture-image-2d)
- (%glCopyTexImage1D . gl-copy-texture-image-1d)
- (%glCopyTexSubImage3D . gl-copy-texture-sub-image-3d)
- (%glCopyTexSubImage2D . gl-copy-texture-sub-image-2d)
- (%glCopyTexSubImage1D . gl-copy-texture-sub-image-1d)
- (%glTexSubImage3D . gl-texture-sub-image-3d)
- (%glTexSubImage2D . gl-texture-sub-image-2d)
- (%glTexSubImage1D . gl-texture-sub-image-1d))
-
-;;;
-;;; 3.8.3 Compressed Texture Images
-;;;
-
-(re-export (%glCompressedTexImage1D . gl-compressed-texture-image-1d)
- (%glCompressedTexImage2D . gl-compressed-texture-image-2d)
- (%glCompressedTexImage3D . gl-compressed-texture-image-3d)
- (%glCompressedTexSubImage1D . gl-compressed-texture-sub-image-1d)
- (%glCompressedTexSubImage2D . gl-compressed-texture-sub-image-2d)
- (%glCompressedTexSubImage3D . gl-compressed-texture-sub-image-3d))
-
-;;;
-;;; 3.8.4 Texture Parameters
-;;;
-
-(re-export (%glTexParameteri . gl-texture-parameter)
- (%glBindTexture . gl-bind-texture))
-
-;;;
-;;; 6.1.4 Texture Queries
-;;;
-
-(re-export (%glGetTexImage . gl-get-tex-image))
-
-;;;
-;;; Instancing extension
-;;;
-
-(define-gl-procedure (glDrawArraysInstanced (mode GLenum)
- (first GLint)
- (count GLsizei)
- (primcount GLsizei)
- -> void)
- "Draw multiple instances of a set of arrays.")
-
-(define-gl-procedure (glDrawElementsInstanced (mode GLenum)
- (count GLsizei)
- (type GLenum)
- (indices void-*)
- (primcount GLsizei)
- -> void)
- "Draw multiple instances of a set of elements.")
-
-(define-gl-procedure (glVertexAttribDivisor (index GLuint)
- (divisor GLuint)
- -> void)
- "Modify the rate at which generic vertex attributes advance during
-instanced rendering.")
-
-(export (glDrawArraysInstanced . gl-draw-arrays-instanced)
- (glDrawElementsInstanced . gl-draw-elements-instanced)
- (glVertexAttribDivisor . gl-vertex-attrib-divisor))
-
-;;;
-;;; VBOs
-;;;
-
-(re-export (%glBufferData . gl-buffer-data)
- (%glBufferSubData . gl-buffer-sub-data)
- (%glMapBuffer . gl-map-buffer)
- (%glUnmapBuffer . gl-unmap-buffer))
-
-;;;
-;;; VAOs
-;;;
-
-(define-gl-procedure (glGenVertexArrays (n GLsizei)
- (arrays GLuint-*)
- -> void)
- "Generate N vertex arrays.")
-
-(define-gl-procedure (glDeleteVertexArrays (n GLsizei)
- (arrays GLuint-*)
- -> void)
- "Delete vertex array objects.")
-
-(define (gl-generate-vertex-array)
- (let ((bv (u32vector 0)))
- (glGenVertexArrays 1 bv)
- (u32vector-ref bv 0)))
-
-(define (gl-delete-vertex-array n)
- (let ((bv (u32vector n)))
- (glDeleteVertexArrays 1 bv)))
-
-(define-gl-procedure (glBindVertexArray (array GLuint)
- -> void)
- "Bind vertex array object ARRAY.")
-
-(define-gl-procedure (glEnableVertexAttribArray (index GLuint)
- -> void)
- "Enable or disable a generic vertex attribute array.")
-
-(define-gl-procedure (glVertexAttribPointer (index GLuint)
- (size GLint)
- (type GLenum)
- (normalized GLboolean)
- (stride GLsizei)
- (pointer GLvoid-*)
- -> void)
- "Define an array of generic vertex attribute data.")
-
-(define-gl-procedure (glDrawElements (mode GLenum)
- (count GLsizei)
- (type GLenum)
- (indices GLvoid-*)
- -> void)
- "Render primitives from array data.")
-
-(export gl-generate-vertex-array
- gl-delete-vertex-array
- (glBindVertexArray . gl-bind-vertex-array)
- (glEnableVertexAttribArray . gl-enable-vertex-attrib-array)
- (glVertexAttribPointer . gl-vertex-attrib-pointer)
- (glDrawElements . gl-draw-elements))
-
-(define-syntax-rule (with-gl-client-state state body ...)
- (begin
- (gl-enable-client-state state)
- body ...
- (gl-disable-client-state state)))
-
-(export with-gl-client-state)
-
-;;;
-;;; Framebuffers
-;;;
-
-(define-gl-procedure (glGenFramebuffers (n GLsizei)
- (ids GLuint-*)
- -> void)
- "Generate framebuffer object names.")
-
-(define-gl-procedure (glDeleteFramebuffers (n GLsizei)
- (framebuffers GLuint-*)
- -> void)
- "Delete framebuffer objects.")
-
-(define (gl-generate-framebuffer)
- (let ((bv (u32vector 0)))
- (glGenFramebuffers 1 bv)
- (u32vector-ref bv 0)))
-
-(define (gl-delete-framebuffer n)
- (let ((bv (u32vector n)))
- (glDeleteFramebuffers 1 bv)))
-
-(define-gl-procedure (glBindFramebuffer (target GLenum)
- (framebuffer GLuint)
- -> void)
- "Bind a framebuffer to a framebuffer target.")
-
-(define-gl-procedure (glFramebufferTexture2D (target GLenum)
- (attachment GLenum)
- (textarget GLenum)
- (texture GLuint)
- (level GLint)
- -> void)
- "Attach a level of a texture object as a logical buffer to the
-currently bound framebuffer object.")
-
-(define-gl-procedure (glCheckFramebufferStatus (target GLenum)
- -> GLenum)
- "Return the framebuffer completeness status of a framebuffer
-object.")
-
-(define-gl-procedure (glGenRenderbuffers (n GLsizei)
- (ids GLuint-*)
- -> void)
- "Generate renderbuffer object names.")
-
-(define-gl-procedure (glDeleteRenderbuffers (n GLsizei)
- (renderbuffers GLuint-*)
- -> void)
- "Delete renderbuffer objects.")
-
-(define (gl-generate-renderbuffer)
- (let ((bv (u32vector 0)))
- (glGenRenderbuffers 1 bv)
- (u32vector-ref bv 0)))
-
-(define (gl-delete-renderbuffer n)
- (let ((bv (u32vector n)))
- (glDeleteRenderbuffers 1 bv)))
-
-(define-gl-procedure (glBindRenderbuffer (target GLenum)
- (renderbuffer GLuint)
- -> void)
- "Bind a named renderbuffer object.")
-
-(define-gl-procedure (glRenderbufferStorage (target GLenum)
- (internalformat GLenum)
- (width GLsizei)
- (height GLsizei)
- -> void)
- "Create and initialize a renderbuffer object's data store.")
-
-(define-gl-procedure (glFramebufferRenderbuffer (target GLenum)
- (attachment GLenum)
- (renderbuffertarget GLenum)
- (renderbuffer GLuint)
- -> void)
- "Attach a renderbuffer object to a framebuffer object.")
-
-(export gl-generate-framebuffer
- gl-delete-framebuffer
- (glBindFramebuffer . gl-bind-framebuffer)
- (glFramebufferTexture2D . gl-framebuffer-texture-2d)
- (glCheckFramebufferStatus . gl-check-framebuffer-status)
- gl-generate-renderbuffer
- gl-delete-renderbuffer
- (glBindRenderbuffer . gl-bind-renderbuffer)
- (glRenderbufferStorage . gl-renderbuffer-storage)
- (glFramebufferRenderbuffer . gl-framebuffer-renderbuffer))
-
-(re-export (%glDrawBuffers . gl-draw-buffers))
-
-
-;;;
-;;; Shaders
-;;;
-
-(define-gl-procedure (glUniform1ui (location GLint)
- (v0 GLuint)
- -> void)
- "Specify the value of a uniform variable for the current program object")
-
-(define-gl-procedure (glUniform1uiv (location GLint)
- (count GLint)
- (ptr GLvoid-*)
- -> void)
- "Specify the value of a uniform variable for the current program object")
-
-(export (glUniform1ui . gl-uniform1ui)
- (glUniform1uiv . gl-uniform1uiv))
-
-(re-export (%glUseProgram . gl-use-program)
- (%glDeleteProgram . gl-delete-program)
- (%glDetachShader . gl-detach-shader)
- (%glLinkProgram . gl-link-program)
- (%glBindAttribLocation . gl-bind-attrib-location)
- (%glAttachShader . gl-attach-shader)
- (%glGetAttribLocation . gl-get-attrib-location)
- (%glGetUniformLocation . gl-get-uniform-location)
- (%glCreateProgram . gl-create-program)
- (%glGetProgramInfoLog . gl-get-program-info-log)
- (%glGetProgramiv . gl-get-programiv)
- (%glDeleteProgram . gl-delete-program)
- (%glDeleteShader . gl-delete-shader)
- (%glGetShaderiv . gl-get-shaderiv)
- (%glGetShaderInfoLog . gl-get-shader-info-log)
- (%glCompileShader . gl-compile-shader)
- (%glShaderSource . gl-shader-source)
- (%glCreateShader . gl-create-shader)
- (%glGetActiveUniform . gl-get-active-uniform)
- (%glGetActiveAttrib . gl-get-active-attrib)
- (%glUniform1i . gl-uniform1i)
- (%glUniform1iv . gl-uniform1iv)
- (%glUniform2i . gl-uniform2i)
- (%glUniform3i . gl-uniform3i)
- (%glUniform4i . gl-uniform4i)
- (%glUniform1f . gl-uniform1f)
- (%glUniform1fv . gl-uniform1fv)
- (%glUniform2f . gl-uniform2f)
- (%glUniform2fv . gl-uniform2fv)
- (%glUniform3f . gl-uniform3f)
- (%glUniform3fv . gl-uniform3fv)
- (%glUniform4f . gl-uniform4f)
- (%glUniform4fv . gl-uniform4fv)
- (%glUniformMatrix3fv . gl-uniform-matrix3fv)
- (%glUniformMatrix4fv . gl-uniform-matrix4fv)
- (%glUniform4f . gl-uniform4f))
-
-(re-export (%glPointSize . gl-point-size))
-
-
-;;;
-;;; Context Queries
-;;;
-
-(re-export (%glGetString . gl-get-string)
- (%glGetIntegerv . gl-get-integer-v))
-
-
-;;;
-;;; Depth Buffer
-;;;
-
-(re-export (%glDepthFunc . gl-depth-func)
- (%glDepthMask . gl-depth-mask)
- (%glDepthRange . gl-depth-range))
-
-
-;;;
-;;; Stencil Buffer
-;;;
-
-(re-export (%glStencilMask . gl-stencil-mask)
- (%glStencilMaskSeparate . gl-stencil-mask-separate)
- (%glStencilFunc . gl-stencil-func)
- (%glStencilFuncSeparate . gl-stencil-func-separate)
- (%glStencilOp . gl-stencil-op)
- (%glStencilOpSeparate . gl-stencil-op-separate))
-
-
-;;;
-;;; Other State Functions
-;;;
-
-(re-export (%glPolygonMode . gl-polygon-mode)
- (%glCullFace . gl-cull-face)
- (%glFrontFace . gl-front-face)
- (%glColorMask . gl-color-mask))
-
-
-;;;
-;;; Errors
-;;;
-
-(re-export (%glGetError . gl-get-error))
diff --git a/chickadee/graphics/gpu.scm b/chickadee/graphics/gpu.scm
index 66d2c31..70cf5d8 100644
--- a/chickadee/graphics/gpu.scm
+++ b/chickadee/graphics/gpu.scm
@@ -21,14 +21,22 @@
(define-module (chickadee graphics gpu)
#:use-module (chickadee graphics color)
- #:use-module (chickadee graphics gl)
#:use-module (chickadee math rect)
#:use-module (gl)
+ #:use-module ((gl low-level) #:renamer (symbol-prefix-proc '%))
+ #:use-module (gl runtime)
+ #:use-module (gl types)
#:use-module (ice-9 match)
#:use-module (rnrs bytevectors)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
- #:use-module (system foreign)
+ #:use-module ((system foreign)
+ #:select (bytevector->pointer
+ pointer->bytevector
+ pointer->string
+ pointer-address
+ make-pointer
+ %null-pointer))
#:export (blend-mode?
blend-mode-equation
blend-mode-source-function
@@ -246,6 +254,272 @@
;;;
+;;; Additional OpenGL wrappers
+;;;
+
+(define gl-clear-color %glClearColor)
+(define gl-scissor %glScissor)
+(define gl-blend-func %glBlendFunc)
+(define gl-blend-equation %glBlendEquation)
+(define gl-texture-image-3d %glTexImage3D)
+(define gl-texture-image-2d %glTexImage2D)
+(define gl-texture-image-1d %glTexImage1D)
+(define gl-copy-texture-image-2d %glCopyTexImage2D)
+(define gl-copy-texture-image-1d %glCopyTexImage1D)
+(define gl-copy-texture-sub-image-3d %glCopyTexSubImage3D)
+(define gl-copy-texture-sub-image-2d %glCopyTexSubImage2D)
+(define gl-copy-texture-sub-image-1d %glCopyTexSubImage1D)
+(define gl-texture-sub-image-3d %glTexSubImage3D)
+(define gl-texture-sub-image-2d %glTexSubImage2D)
+(define gl-texture-sub-image-1d %glTexSubImage1D)
+(define gl-compressed-texture-image-1d %glCompressedTexImage1D)
+(define gl-compressed-texture-image-2d %glCompressedTexImage2D)
+(define gl-compressed-texture-image-3d %glCompressedTexImage3D)
+(define gl-compressed-texture-sub-image-1d %glCompressedTexSubImage1D)
+(define gl-compressed-texture-sub-image-2d %glCompressedTexSubImage2D)
+(define gl-compressed-texture-sub-image-3d %glCompressedTexSubImage3D)
+(define gl-texture-parameter %glTexParameteri)
+(define gl-bind-texture %glBindTexture)
+(define gl-get-tex-image %glGetTexImage)
+(define gl-buffer-data %glBufferData)
+(define gl-buffer-sub-data %glBufferSubData)
+(define gl-map-buffer %glMapBuffer)
+(define gl-unmap-buffer %glUnmapBuffer)
+(define gl-draw-buffers %glDrawBuffers)
+(define gl-use-program %glUseProgram)
+(define gl-delete-program %glDeleteProgram)
+(define gl-detach-shader %glDetachShader)
+(define gl-link-program %glLinkProgram)
+(define gl-bind-attrib-location %glBindAttribLocation)
+(define gl-attach-shader %glAttachShader)
+(define gl-get-attrib-location %glGetAttribLocation)
+(define gl-get-uniform-location %glGetUniformLocation)
+(define gl-create-program %glCreateProgram)
+(define gl-get-program-info-log %glGetProgramInfoLog)
+(define gl-get-programiv %glGetProgramiv)
+(define gl-delete-program %glDeleteProgram)
+(define gl-delete-shader %glDeleteShader)
+(define gl-get-shaderiv %glGetShaderiv)
+(define gl-get-shader-info-log %glGetShaderInfoLog)
+(define gl-compile-shader %glCompileShader)
+(define gl-shader-source %glShaderSource)
+(define gl-create-shader %glCreateShader)
+(define gl-get-active-uniform %glGetActiveUniform)
+(define gl-get-active-attrib %glGetActiveAttrib)
+(define gl-uniform1i %glUniform1i)
+(define gl-uniform1iv %glUniform1iv)
+(define gl-uniform2i %glUniform2i)
+(define gl-uniform3i %glUniform3i)
+(define gl-uniform4i %glUniform4i)
+(define gl-uniform1f %glUniform1f)
+(define gl-uniform1fv %glUniform1fv)
+(define gl-uniform2f %glUniform2f)
+(define gl-uniform2fv %glUniform2fv)
+(define gl-uniform3f %glUniform3f)
+(define gl-uniform3fv %glUniform3fv)
+(define gl-uniform4f %glUniform4f)
+(define gl-uniform4fv %glUniform4fv)
+(define gl-uniform-matrix3fv %glUniformMatrix3fv)
+(define gl-uniform-matrix4fv %glUniformMatrix4fv)
+(define gl-uniform4f %glUniform4f)
+(define gl-point-size %glPointSize)
+(define gl-get-string %glGetString)
+(define gl-get-integer-v %glGetIntegerv)
+(define gl-depth-func %glDepthFunc)
+(define gl-depth-mask %glDepthMask)
+(define gl-depth-range %glDepthRange)
+(define gl-stencil-mask %glStencilMask)
+(define gl-stencil-mask-separate %glStencilMaskSeparate)
+(define gl-stencil-func %glStencilFunc)
+(define gl-stencil-func-separate %glStencilFuncSeparate)
+(define gl-stencil-op %glStencilOp)
+(define gl-stencil-op-separate %glStencilOpSeparate)
+(define gl-polygon-mode %glPolygonMode)
+(define gl-cull-face %glCullFace)
+(define gl-front-face %glFrontFace)
+(define gl-color-mask %glColorMask)
+(define gl-get-error %glGetError)
+
+(define-gl-procedure (glGenerateMipmap (target GLenum) -> void)
+ "Generate mipmaps for the texture attached to target of the active
+texture unit.")
+
+(define-gl-procedure (glDrawArraysInstanced (mode GLenum)
+ (first GLint)
+ (count GLsizei)
+ (primcount GLsizei)
+ -> void)
+ "Draw multiple instances of a set of arrays.")
+
+(define-gl-procedure (glDrawElementsInstanced (mode GLenum)
+ (count GLsizei)
+ (type GLenum)
+ (indices void-*)
+ (primcount GLsizei)
+ -> void)
+ "Draw multiple instances of a set of elements.")
+
+(define-gl-procedure (glVertexAttribDivisor (index GLuint)
+ (divisor GLuint)
+ -> void)
+ "Modify the rate at which generic vertex attributes advance during
+instanced rendering.")
+
+(define-gl-procedure (glGenVertexArrays (n GLsizei)
+ (arrays GLuint-*)
+ -> void)
+ "Generate N vertex arrays.")
+
+(define-gl-procedure (glDeleteVertexArrays (n GLsizei)
+ (arrays GLuint-*)
+ -> void)
+ "Delete vertex array objects.")
+
+(define-gl-procedure (glBindVertexArray (array GLuint)
+ -> void)
+ "Bind vertex array object ARRAY.")
+
+(define-gl-procedure (glEnableVertexAttribArray (index GLuint)
+ -> void)
+ "Enable or disable a generic vertex attribute array.")
+
+(define-gl-procedure (glVertexAttribPointer (index GLuint)
+ (size GLint)
+ (type GLenum)
+ (normalized GLboolean)
+ (stride GLsizei)
+ (pointer GLvoid-*)
+ -> void)
+ "Define an array of generic vertex attribute data.")
+
+(define-gl-procedure (glDrawElements (mode GLenum)
+ (count GLsizei)
+ (type GLenum)
+ (indices GLvoid-*)
+ -> void)
+ "Render primitives from array data.")
+
+(define-gl-procedure (glGenFramebuffers (n GLsizei)
+ (ids GLuint-*)
+ -> void)
+ "Generate framebuffer object names.")
+
+(define-gl-procedure (glDeleteFramebuffers (n GLsizei)
+ (framebuffers GLuint-*)
+ -> void)
+ "Delete framebuffer objects.")
+
+(define-gl-procedure (glBindFramebuffer (target GLenum)
+ (framebuffer GLuint)
+ -> void)
+ "Bind a framebuffer to a framebuffer target.")
+
+(define-gl-procedure (glFramebufferTexture2D (target GLenum)
+ (attachment GLenum)
+ (textarget GLenum)
+ (texture GLuint)
+ (level GLint)
+ -> void)
+ "Attach a level of a texture object as a logical buffer to the
+currently bound framebuffer object.")
+
+(define-gl-procedure (glCheckFramebufferStatus (target GLenum)
+ -> GLenum)
+ "Return the framebuffer completeness status of a framebuffer
+object.")
+
+(define-gl-procedure (glGenRenderbuffers (n GLsizei)
+ (ids GLuint-*)
+ -> void)
+ "Generate renderbuffer object names.")
+
+(define-gl-procedure (glDeleteRenderbuffers (n GLsizei)
+ (renderbuffers GLuint-*)
+ -> void)
+ "Delete renderbuffer objects.")
+
+(define-gl-procedure (glBindRenderbuffer (target GLenum)
+ (renderbuffer GLuint)
+ -> void)
+ "Bind a named renderbuffer object.")
+
+(define-gl-procedure (glRenderbufferStorage (target GLenum)
+ (internalformat GLenum)
+ (width GLsizei)
+ (height GLsizei)
+ -> void)
+ "Create and initialize a renderbuffer object's data store.")
+
+(define-gl-procedure (glFramebufferRenderbuffer (target GLenum)
+ (attachment GLenum)
+ (renderbuffertarget GLenum)
+ (renderbuffer GLuint)
+ -> void)
+ "Attach a renderbuffer object to a framebuffer object.")
+
+(define-gl-procedure (glUniform1ui (location GLint)
+ (v0 GLuint)
+ -> void)
+ "Specify the value of a uniform variable for the current program object")
+
+(define-gl-procedure (glUniform1uiv (location GLint)
+ (count GLint)
+ (ptr GLvoid-*)
+ -> void)
+ "Specify the value of a uniform variable for the current program object")
+
+(define gl-generate-mipmap glGenerateMipmap)
+(define gl-draw-arrays-instanced glDrawArraysInstanced)
+(define gl-draw-elements-instanced glDrawElementsInstanced)
+(define gl-vertex-attrib-divisor glVertexAttribDivisor)
+(define gl-gen-vertex-arrays glGenVertexArrays)
+(define gl-delete-vertex-arrays glDeleteVertexArrays)
+(define gl-bind-vertex-array glBindVertexArray)
+(define gl-enable-vertex-attrib-array glEnableVertexAttribArray)
+(define gl-vertex-attrib-pointer glVertexAttribPointer)
+(define gl-draw-elements glDrawElements)
+(define gl-gen-framebuffers glGenFramebuffers)
+(define gl-delete-framebuffer glDeleteFramebuffers)
+(define gl-bind-framebuffer glBindFramebuffer)
+(define gl-framebuffer-texture-2d glFramebufferTexture2D)
+(define gl-check-framebuffer-status glCheckFramebufferStatus)
+(define gl-gen-renderbuffers glGenRenderbuffers)
+(define gl-delete-renderbuffers glDeleteRenderbuffers)
+(define gl-bind-renderbuffer glBindRenderbuffer)
+(define gl-renderbuffer-storage glRenderbufferStorage)
+(define gl-framebuffer-renderbuffer glFramebufferRenderbuffer)
+(define gl-uniform1ui glUniform1ui)
+(define gl-uniform1uiv glUniform1uiv)
+
+(define (gl-generate-vertex-array)
+ (let ((bv (u32vector 0)))
+ (glGenVertexArrays 1 bv)
+ (u32vector-ref bv 0)))
+
+(define (gl-delete-vertex-array n)
+ (let ((bv (u32vector n)))
+ (glDeleteVertexArrays 1 bv)))
+
+(define (gl-generate-framebuffer)
+ (let ((bv (u32vector 0)))
+ (glGenFramebuffers 1 bv)
+ (u32vector-ref bv 0)))
+
+(define (gl-delete-framebuffer n)
+ (let ((bv (u32vector n)))
+ (glDeleteFramebuffers 1 bv)))
+
+(define (gl-generate-renderbuffer)
+ (let ((bv (u32vector 0)))
+ (glGenRenderbuffers 1 bv)
+ (u32vector-ref bv 0)))
+
+(define (gl-delete-renderbuffer n)
+ (let ((bv (u32vector n)))
+ (glDeleteRenderbuffers 1 bv)))
+
+
+;;;
;;; GPU settings
;;;