Category "Object graphics"

Jason Ferrara, of Jacquette Engineering for Research, the creators of [Slither], on [getting an OpenGL context of an IDL object graphics window][getting-opendl-context]:

> IDL doesn’t provide any way to access or manage OpenGL contexts. IDL Object Graphics does use OpenGL to do its drawing though, so there must be valid OpenGL contexts floating around in there somewhere. It’s a reasonable assumption (and testing shows it to be true) that when the Draw method of an IDLgrModel object is called, the current OpenGL context is set to the window into which the model should be drawn.

This is from one of [a series of articles][PyMOL-example] about using this trick along with Slither to have PyMOL draw into an IDL object graphics window.

I’ve been trying to get a way to get an OpenGL context for awhile. I definitely will be keeping an eye out for [future articles from Jacquette][jacquette-blog].

[PyMOL-example]: “Using Slither to Embed PyMOL in IDL Applications”

[jacquette-blog]: “Jacquette blog articles”

[getting-opendl-context]: “Getting an OpenGL Context from IDL”

[Slither]: “Slither”

I’m not sure if I have mentioned this before, but I have a method of exporting simple object graphics scenes to a web page using [x3dom]. Check out this example of sending a graphics hierarchy containing a polygon (the cow data set from the IDL distribution) to an [interactive display][x3dom-example] on a web page.

This is currently a proof of concept and works for views, models, and polygons with simple properties only, but expanding to more classes and properties should be straightforward. I have done similar things for various other new destination classes for outputs such as [POV-Ray][povray] and [anaglyphs].

[x3dom]: “x3dom – Home”
[x3dom-example]: “x3dom example”

[povray]: “POV-Ray destination 0.2”
[anaglyphs]: “Anaglyphs: MGgr3DConverter and MGgrWindow3D”

Ronn Kling has [published his Christmas card for this year](

> 2010 is an example of collision detection with IDL. In this card we have a user settable number of Christmas ornaments that bounce around the view. They not only bounce off the walls, they detect when a collision has occurred and bounce off each other. The technique is very similar to the 2008 Snownado where a single IDLgrPolygon is used with mutliple vertices. You can change the radii and restitution coefficient of the ornaments in real time. If your physics 101 class knowlege is a little fuzzy the restitution coefficient controls how energy is exchanged in collisions. For values less than 1.0 each collision loses energy and the balls slow down. A value of 1.0 is a perfect collision and the energy stays the same in the collision. Finally a value over 1.0 adds energy to each collision and everything speeds up.

> You will also notice that we have two version this year, the Pre IDL 8.0 and IDL 8.0 and later. IDL has some great new syntax for objects and new things like lists. In the IDL 8.0 version the code uses the new list object , new object syntax and array indexing. The Pre IDL 8.0 is commented out in this version but is right next to the new code so that you can see what the changes are. If you don’t have IDL 8.0 then the Pre IDL 8.0 version will work fine for you.

Download for [IDL 8.0]( and [pre-IDL 8.0](

ITT VIS is hosting a [webinar about the IDL 8.0 function graphics system]( next Wednesday September 8, 2010 at various times (11 am Singapore time, 2 pm London time, or 2 pm New York time). I plan on attending to learn more about this system. Not sure if this will really replace direct graphics for me, but I plan to use it for quick stuff.

IDL 8.0 introduces an entirely new graphics interface. Currently, there is no name for this system except Graphics (am I supposed to say it capitalized when talking?), so I will refer to them as function graphics because all the routines are functions instead of procedures as in most direct graphics and iTools graphics routines. This new system is easy to use, interactive, programmatically accessible, and fairly complete even in this first release.

Continue reading “IDL 8.0: a new graphics interface.”

Recently, I’ve been wanting to create some timelines for various projects of mine. I needed something fairly flexible and I wanted the timeline to be generated from an input file, not from source code or a GUI. I settled on `MG_TIMELINE` which accepts an XML input file and generates a PostScript output file (which I can then convert to PNG or PDF, depending on what I need). While `MG_TIMELINE` is not a finished solution yet, it does handle my needs fairly well now.

Continue reading “Timeline creation.”

In object graphics, it is very easy to rotate graphics atoms around the origin using the `IDLgrModel::rotate` method. But this rotation is always rotating around the origin. What if you want to rotate about a non-origin point? The technique is simple: translate the point of rotation to the origin, rotate, and translate back.

[`VISgrModel`]( ([docs]( is a replacement for `IDLgrModel` that makes this a bit less of a hassle. It is created in the same way as `IDLgrModel` and used like this:

model->rotate, [0, 1, 0], 1, about=[-0.5, 0., 0.]

The default value for `ABOUT` is `[0., 0., 0.]`, so it falls back to the standard `IDLgrModel` behavior.

I added texture maps for polygons and a `VISgrPOVRayWindow` class to the POVRay destination class for object graphics that [I’ve]( [mentioned]( [before]( The image to the left uses texture maps on an `IDLgrPolgyon`. It has a single direct light source to the right, so POVRay has cast a shadow on the right side of the left planet, making it entirely in shadow (I added a weak ambient light so that it could be seen at all).

The `VISgrPOVRayWindow` class acts just like `IDLgrWindow` except that it uses POV-Ray instead of OpenGL to render the graphics (i.e. it runs POV-Ray and loads the image back into IDL for you).

[Download]( includes API documentation on how to use.

Ronn Kling just published his [2008 IDL Christmas Card]( This year’s card is a “snownado”, a tornado of snowflakes which interact with 3-dimensional objects. The code demonstrates how to efficiently move around many polygons in object graphics. From Ronn’s description of the card:

> If you are looking for a way to visualize rapidly moving 3D objects then
> this card may be a good starting place.

Check out previous year’s Christmas Cards also, they are all very interesting. [Direct download](

A `.sav` file and API documentation for the POV-Ray object graphics destination that I’ve [mentioned]( [before]( are available [here](

older posts »