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;

or

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

Google O3D demo - Point rendering
Point rendering

or

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:



One thought on “Google O3D API: How To Change The Polygon Rendering Mode”

  1. Eduardo

    Hi!

    I saw your posts about o3d and they are very helpful.

    I have a question that you might be able to answer. I am trying to plot a 3d surface (a mesh). I would like to have a mixture of fill and wireframe rendering, by showing a thin black line along the mesh edges.

    Do you have any idea how to approach this?

    Thanks!

Comments are closed.