[racket] Bugfix for opengl package: load-shader erroneously strips newlines
(sorry about the possible duplicate; I sent this from the wrong email
address...)
Hey there! I found a bug in the `opengl` package. (Not the sgl bindings!
The opengl you get by doing raco pkg install opengl)
Since http://pkg.racket-lang.org is down, and because there's no
authorship information in the README or info.rkt, I can't find the
maintainer of the `opengl` package. (Jay perhaps?) Since it's likely
that they're reading the mailing list, I'll just send it to everyone via
the "shotgun responsibility" approach :)
Problem: (load-shader-source shader port) strips newlines from each line
in the port. This has consequences: any shaders that start with a
#version proeprocessor definition fail with "preprocessor error: syntax
error, unexpected IDENTIFIER, expecting NEWLINE", and shaders that
contain comments also fail similarly.
Fix: Replace the load-shader-source function with the following:
(define (load-shader-source shader port)
(let* ((lines (for/vector ((line (in-lines port))) (string-append line "\n")))
(sizes (for/list ((line (in-vector lines))) (string-length line)))
(sizes (list->s32vector sizes)))
(glShaderSource shader (vector-length lines) lines sizes)))
Note the (string-append line "\n").
Hope that helps!