Google O3D API: How To Change The Polygon Rendering Mode

Google O3D demo - Wireframe rendering
Wireframe rendering

In my first test of Google O3D, I had a problem: how to display a wireframe object or better said how to change the polygon rendering mode: POINT, WIREFRAME or SOLID. The answer is rather simple: just play with the FillMode attribute of the material’s state. But before playing with the material’s state, you have to create a state and attach it to the material:

var state = g_pack.createObject('State');
g_Material.state = state;

Once done, you’re ready to tweak the FillMode attribute:

state.getStateParam('FillMode').value = g_o3d.State.WIREFRAME;


state.getStateParam('FillMode').value = g_o3d.State.POINT;

Google O3D demo - Point rendering
Point rendering


state.getStateParam('FillMode').value = g_o3d.State.SOLID;

Google O3D demo - Solid rendering
Solid rendering

You can play with the demo HERE.

Thanks to gman for the tip ;)

Related Posts:

↑ Grab this Headline Animator