tip: easy wireframe debug option

I thought I’d share a very simple method of implementing a wireframe on/off toggle debug option.

You have a boolean instance variable named “wireframe” set to false initially, and an instance of the Xith3D CanvasPeer class named “cp”.

in your event handling for whatever activates this debug option - add the code:


wireframe = !wireframe;
this.cp.getRenderOptions().setOption(Option.ENABLE_WIREFRAME_MODE, wireframe);


And you’re done ;D

This is nicer than using the command argument -DXITH3D_ENABLE_WIREFRAME_MODE=TRUE as it can be toggled, and much cleaner (not to mention faster) than using PolygonAttributes which a few other demos use.

Cheers,

Will.