[racket] OpenGL libraries, old vs. new

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Mon Jul 29 10:14:31 EDT 2013

On Mon, Jul 29, 2013 at 8:03 AM, Jon Kleiser <jon.kleiser at usit.uio.no> wrote:
> Hi,
>
> On this page <http://docs.racket-lang.org/sgl/main.html> I see syntax like
> this:
>
> (require sgl sgl/gl-vectors)
> (gl-begin 'triangles)
> (gl-vertex 1 2 3)
> ...
>
> However, in the file collects/sgl/examples/alpha.rkt the syntax is more like
> this:
>
> (glBegin GL_QUADS)
> (glNormal3d 0 0 1)
> (glTexCoord2i 0 0)
> (glVertex3i -1 -1 1)
>
> Which syntax style should I use? Is the first one the newest?

The 'sgl' collection has a "Rackety" interface and a C
"transliteration". The first is the Rackety one and the second is the
C one. Neither is "newer" from the perspective of Racket, as they were
made at about the same time. However, the Rackety one is not as
complete and prevents you from easily porting code you find in
StackOverflow answers on OpenGL :)

Both interfaces in the 'sgl' collection are also incomplete relative
to the OpenGL standard. However, the OpenGL package
[https://pkg.racket-lang.org/info/opengl] is fully complete and
automatically generated from the Khronos spec. The OpenGL package only
has a C transliteration.

> Is there some glut library available? I'd like to do things like
> (glutSolidCube 1.0) and (glutWireCube 1.0).

Neither of these packages have glut interfaces. Most of the stuff that
glut does is taken care of by racket/gui. The other stuff, like the
short hands you mention, might be useful, but they're not supported.
My preference is to not use them and use the underlying features
directly.

Jay

>
> /Jon
> ____________________
>  Racket Users list:
>  http://lists.racket-lang.org/users



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93

Posted on the users mailing list.