[racket] Bugfix for opengl package: load-shader erroneously strips newlines

From: Stephan Houben (stephanh42 at gmail.com)
Date: Sun Sep 22 14:40:54 EDT 2013

Hi Michael,

Thanks.
I pulled the fix and pushed it to Github.

I also added my contact info to the README…
That was a silly oversight.
Sorry.

Stephan

Op 22 sep. 2013, om 03:08 heeft Michael Wilber <mwilber at eng.ucsd.edu> het volgende geschreven:

> 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,
>  - Mike
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



Posted on the users mailing list.