[racket] OpenGL sgl GL_TEXTURE_3D glTexImage3D

From: Noel Welsh (noelwelsh at gmail.com)
Date: Sat Nov 27 17:10:32 EST 2010

I didn't write SGL but the code is quite easy to understand. At the
top a bunch of shared libraries are loaded (gl-lib and glu-lib). You'd
want to add glut-lib there.

  ;; Windows only for now
  (define glut-lib (ffi-lib "glut32"))

Then glTexImage3D is defined with the following code:

  (define-foreign glTexImage3D _gl-enum _gl-int _gl-int _gl-sizei _gl-sizei
                               _gl-sizei _gl-int _gl-enum _gl-enum _gl-voidv ->)

define-foreign is a simple macro defined at the top of the file. You
need to define a new version that uses glut-lib

  (define-syntax define-foreign-glut
    (syntax-rules ()
      [(_ args ...) (define-foreign-lib glut-lib args ...)]))

Then change the definition of glTexImage3D to use define-foreign-glut
instead of define-foreign.

The above is totally untested but should work.

On Sat, Nov 27, 2010 at 7:08 PM, mosi <amosat+lisp at gmail.com> wrote:
> Does anybody know about the implementation of sgl/gl.rkt in detail ?
> The problem is, i think, in the following:
> The following C++ GLUT code works fine on my machine and needs an external
> DLL glut32.dll and a dynamic load of the function "glTexImage3D" on the run.
> However,  Racket\collects\sgl\gl.rkt only creates FFI functions for
> C:\Windows\system32\glu32.dll
> where the OpenGL extensions are not available in glu32.dll .

Posted on the users mailing list.