render in wireframe...

hey, ive been playing around with the gears demo a bit. i was wondering how i can render in wireframe… i tried adding:

gl.glPolygonMode(GL.GL_LINES, GL.GL_FRONT_AND_BACK);

to the end of the GearRenderer.init() method, but it doesnt change anything. I appreciate any comments, thanks.

find where it says

  gl.glBegin(GL.GL_QUAD_STRIP);

and

  gl.glBegin(GL.GL_QUADS);

And change them to line primitives (say, GL_LINE_STRIP and GL_LINES)

Only problem is that they won’t draw quite right because the ording of the verticies are slightly different. Still, it might work well enough.

You have the parameters for glPolygonMode in the wrong order.

gl.glPolygonMode( GL.GL_FRONT_AND_BACK, GL.GL_LINE );

does the trick.

yep, that fixed it… thanks for your help

Is changing the polygon mode the fastest way to do wireframe or is drawing lines the fastest?

I suspect that would depend on the card you have and how they decided to build their driver.

Kev

[quote]Is changing the polygon mode the fastest way to do wireframe or is drawing lines the fastest?
[/quote]
Regardless which is faster, changing the polygon mode is a better idea since the order of the vertex indexing changes with my suggestion (GL_QUAD_STRIP -> GL_LINE_STRIP etc) So that’s defintely a better way to go