How do I toggle rendering of a mesh on/off?

Hi all,

thought this to be an easy task, but I seem to be lost somewhere. How can I toggle the rendering of a whole mesh on and off? I tried to do it by setcullhint, but it only disappears, never to appear again.
Is there a way to accomplish this besides removing the geom from the scenegraph?

Regards
ghoust

There are multiple ways depending on a few things:

  • If the material is not shared… culling to both will work
  • Removing the index buffer will do it
  • Setting all verts to position 0,0,0 :stuck_out_tongue:

I would use the index buffer approach… I think

1 Like
@ghoust said: Hi all,

thought this to be an easy task, but I seem to be lost somewhere. How can I toggle the rendering of a whole mesh on and off? I tried to do it by setcullhint, but it only disappears, never to appear again.
Is there a way to accomplish this besides removing the geom from the scenegraph?

Regards
ghoust

Culling hint should work to toggle visibility on/off. You have to set it to inherit or never to get it visible again… I use this approach all the time so if that didn’t work then something else must have been wrong.

1 Like

thanx for the hints, so I am assured that I am going in the right direction and it must be something silly on my side.

It was indeed a problem between controlUpdate and controlRender, instead of a cull hint problem.
thanx guys!
and thanx for sharing the other posibilities :slight_smile:

I remember to have played games where developers simply moved the models far away or underground… haha, and then, using cheats, you find them :smiley: