Hi guys!

I’m creating a CAD Application with opengl. I would like to have the possibility to display every objects or only some of them. Some kind of layers I guess.

So I would like to have an idea to start with…

Thanks for helping


I don’t think your problem is purely about OpenGL.
It’s only the way you made your code that will allow you to perform several layers.
ie: use pointer list on Object (header list references the layer) and render only the list you have selected.
For CAD design it’s obvious that object aren’t cast by Z axes but by layers.
So look for a way to sort your object in your code and render only selected lists(or layers).
May be I’m wrong , or I could have not correctly understood your question.
Sorry for my poor English


if (ptrObj->bVisible)

Here’s how I would try doing it (first go; don’t know if I’d have to re-factor it later)

template< class T > class LayerDraw {
LayerDraw( LayerWhich const & lw ) : lw_( lw ) { }
void operator()( T::iterator ptr ) {
if( lw_.layerVisible( *ptr ) ) {
for_each( (*ptr).items_.begin(), (*ptr).items_.end(), ItemDraw() );
LayerWhich const & lw_;

for_each( layers.begin(); layers.end(); LayerDraw( which ) );

Trivia quiz: how much OpenGL is in this code snippet?

Trivia quiz: how much OpenGL is in this code snippet?

There’s three answers to your trivia quiz…

  1. If you take ope out of “operator”, then n and g out of “begin” and finally l out of “layervisible” then you’ve got opengl…

  2. If your engine is based on opengl then it must be entirely opengl based so it’s valid…

  3. A BIG fat None (Aka as per usual)

Perhaps it’s actually an advanced question so it doesn’t need to have opengl in it.

Ps. Oooh STL…

[EDIT] Stoopid quotes…

[This message has been edited by rgpc (edited 03-12-2003).]