Rough guide to the OpenGL extempore libraries?

74 views
Skip to first unread message

Toby Gifford

unread,
May 2, 2017, 11:26:38 PM5/2/17
to extemp...@googlegroups.com
Can anyone suggest a 'rough guide' to diving into OpenGL in extempore?  There's quite a few libs and examples, but it's a bit hard to know where to start, and which are legacy vs current.

For example, how would I draw a sphere in 3D?  I seem to remember there being some GLut bindings at one point, but they don't seem to be there anymore.

Ben Swift

unread,
May 3, 2017, 8:44:50 PM5/3/17
to extemp...@googlegroups.com
Hi Toby

Andy has done some cool things in this area in the last little while, so
I'll let him weigh in as well. But the short answer is that all the old
(compat profile, version < 3.2) stuff is now gone, including all the
GLUT stuff. Shaders ftw.

There are some shaders built-in, but that stuff could certainly be
better documented.

There's also a (growing in completeness/maturity) shader-based rendering
pipeline if you want to do full, models+camera+lighting stuff.

So I guess it depends on what your overall goal is?

Cheers,
Ben

Toby Gifford

unread,
May 3, 2017, 8:56:55 PM5/3/17
to extemp...@googlegroups.com
Thanks Ben. Fair enough my question is too vague to answer really. Perhaps more simply, is there a subset of the myriad libs and examples that are more current, and all belong to a coherent set?  It seems like libs/external/gl and examples/external/shader-tutorials go together and are the most recent. What about libs/external/graphics-pipeline.xtm and examples/external/xtmrender*.xtm?  Are these still in the game? The graphics pipeline example doesn't seem to be compatible with the gl shader libs at the moment.

--
You received this message because you are subscribed to the Google Groups "Extempore" group.
To unsubscribe from this group and stop receiving emails from it, send an email to extemporelang+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andrew Sorensen

unread,
May 3, 2017, 9:01:19 PM5/3/17
to extemp...@googlegroups.com
The graphics-pipeline and the xtmrender examples *are* the main game.  The libs/external/gl stuff is unrelated to the graphics pipeline (with the exception of gl-objects2, which we should and will move and probably rename).

Toby Gifford

unread,
May 3, 2017, 9:06:27 PM5/3/17
to extemp...@googlegroups.com
Aha!  OK that's really helpful.

Andrew Sorensen

unread,
May 3, 2017, 9:33:11 PM5/3/17
to extemp...@googlegroups.com
Let me give you a slightly more expanded answer.  

As you can probably tell ;) the only *documentation* available for the graphics pipeline is the library code and the examples examples/external/xtmrender*.xtm.  This, I admit, is a shame as there is a lot of functionality in there that no one knowns about :(  I'm using this graphics pipeline for all my commercial work (i.e. setup a new "graphics wall" installation just yesterday!), so it is both functional and stable, but I just don't have any time to document it at the moment.

The partially good news is that the examples/external/xtmrender*.xtm are at least all up to date (i.e. HEAD) - perhaps not pretty (they are a bit hacked together at the moment), and also not commented, but they do present a reasonably complete picture of the graphics pipelines functionality, which is now quite substantial.  It is designed to be flexible and so will take you some time to get your head around what is possible.  Also I've been working mostly with desktop gfx cards recently so the examples in their current state might run slow (or even really slow!) if you're working from a laptop - I'll try to update them to work better on lower end hardware - perhaps this could be a little project for you while you're getting your head around it all.

here is a super brief overview of what to look for in the xtmrender examples:

xtmrender1.xtm is the hello world of the extempore graphics pipeline, and does pretty much what you asked - simply loads and draws an object. The easiest way to draw static objects in extempore these days is to simply import a model - even for primitives like spheres.  If you don't know blender, I would encourage you to check it out.  You only need to learn the basics, which you'll pick up from any 30minute online tutorial, and it will definitely be worth your time.  I would suggest I good first project for you would be to export a sphere from blender and load it up as a second object in xtmrender1.xtm.  xtmrender1 introduces the 'render' callback - which is the graphics pipeline callback that is primarily responsible for rendering 3d vertices (i.e. drawing your models). 

xtmrender2.xtm adds a single light (and shadows) into the scene (xtmrender1 has no lights).  xtmrender2 also adds the prerender callback, that is primarily responsible for setting up lights, camera positions etc., before the 'render' callback renders your objects into the scene.

xtmrender3.xtm adds depth-of-field (i.e. camera focus), and multiple light sources.

xtmrender4.xtm shows how you *can* generate and draw procedural objects (the pyramid) and also demonstrates how you would go about building a basic sprite/particle system.  render4 introduces the 'transparent' callback - this is in principle exactly the same callback as render (i.e. used for the same purpose), but does not introduce shadows (note no shadows produced by particles).   You'll probably want to cut back on the number of particles in this example if you run this on a laptop.

xtmrender5.xtm introduces the "postrender" callback (the fourth and final callback type) with the example of creating a picture-in-picture experience.  You can of course use the same principle to draw any old texture.  The 'postrender' callback is primarily for 2d `fragment' shading at the end of the pipeline.  You'll generally use this for either drawing 2d images "over" the scene `gui style', OR for applying global fragment effects - things like HDR, blooming etc.

xtmrender6.xtm shows how you can introduce skyboxes and environment maps.

I would suggest that you have a really good ``play'' with each xtmrender example in turn before moving onto the next. I also really do suggest you take a look at blender.  It's just really useful to be able to easily create, or often more importantly to transform, 3d models yourself.

Please feel free to pester the list with questions.  I'm sure others will be interested in the answers and lots of small question are easier for me to manage.

Andrew Sorensen

unread,
May 3, 2017, 9:42:04 PM5/3/17
to extemp...@googlegroups.com
p.s. while the xtmrender examples provide a reasonable overview, they are certainly not *complete*, there is additionally functionality not exposed in these examples, so again please ask questions when you have more specific requirements.
 

Toby Gifford

unread,
May 3, 2017, 10:25:15 PM5/3/17
to extemp...@googlegroups.com
Thanks Andrew, this is *super* helpful :)
Reply all
Reply to author
Forward
0 new messages