Previous: , Up: GL   [Index]


3.7 GL Extensions

The future is already here – it’s just not very evenly distributed.

– William Gibson

Before interfaces end up in the core OpenGL API, the are usually present as vendor-specific or candidate extensions. Indeed, the making of an OpenGL standard these days seems to be a matter of simply collecting a set of mature extensions and making them coherent.

Guile doesn’t currently provide specific interfaces for GL extensions. Perhaps it should, but that’s a lot of work that we haven’t had time to do. Contributions are welcome.

In the meantime, if you know enough about GL to know that you need an extension, you can define one yourself – after all, this library is all a bunch of Scheme code anyway.

For example, let’s say you decide that you need to render to a framebuffer object. You go to http://www.opengl.org/registry/ and pick out an extension, say http://www.opengl.org/registry/specs/ARB/framebuffer_object.txt.

This extension defines a procedure, GLboolean glIsRenderBuffer(GLuint). So you define it:

(use-modules (gl runtime) (gl types))
(define-gl-procedure (glIsRenderBuffer (buf GLuint) -> GLboolean)
  "Render buffer predicate.  Other docs here.")

And that’s that. It’s a low-level binding, but what did you expect?

Note that you’ll still need to check for the availability of this extension at runtime with (glGetString GL_EXTENSIONS).