Advice for display lists and multiple views

Greetings,

I heard you have to create a display list within a glbegin and glend block. Is there a way that I can “save” this list and use it again later. Reason being is that if I create a display list, render it to the screen, and then click and drag it. I want to use the same display list to update the rotating “object”, but once the first frame renders I am outside a glend. Hope this makes sense?

I want to implement multiple views (top, left, front, camera) in an application. Any tips on this? Also can I use a display list between the 4 views (but just set the view to orthogonal or perspective as required)?

Thanks.

You heard wrong. Display lists can be created outside begin/end pairs.

Typical code sketch:

drawObjectWithTransform( Matrix transform, Object o )
{
glLoadMatrix( &transform );
if( !o.displayList ) {
// create list without rendering it
o.displayList = make_new_display_list();
o.renderInIdentityTransform();
end_making_new_display_list();
}
glCallList( o.displayList );
}

Dunno if I’d call this an “advanced” topic, though… perhaps there aren’t enough people on the other board to give an answer.

So can I create a display list in code completely outside any GL rendering stuff? If possible I would like to create the displaylist when I calculate the mesh heights and then use it within the opengl display bits.

Are there any limits on when you can create a display list?

Sorry if this isn’t the most appropriate forum for this message.

All the rules for creating display lists are documented in the specification. The specification, version 1.4, is downloadable as a PDF file at the front page of this web site. I highly recommend it.

In my example, o.renderInIdentityTransform() would go ahead and just render the vertices of whatever “o” is, using GL calls. I’m assuming there already is a valid GL context. The code illustrates how to easily use the display list as a cache for geometry, which can then be re-displayed elsewhere by drawing the same object in a different transform, as the transform part happens before the display list compilation.