need triangle strip data

Started by pitt, May 30, 2006, 12:22:02 PM

Previous topic - Next topic

pitt

I would like the triangle strip data.
Enable it for me please... Thank you. :D

EgonOlsen

I don't quite understand...when using triangle strips, jPCT looks for strips on demand, i.e. when rendering. You may "stripify" an object to improve the results of this but there is no such thing like "triangle strip data" hidden inside.

pitt

I want to manually draw an object using triangle strips.
I think Object3D.createTriangleStrips() might prepare some data for rendering with triangle strips,isn't it?

Well.  Let's see the code for rendering with triangle strips.

GL11.glBegin(GL11.GL_TRIANGLE_STRIP);
GL11.void glVertex3f(x[0],y[0],z[0]);
GL11.void glVertex3f(x[1],y[1],z[1]);
for (int i=2;i<x.length;i++)
  GL11.void glVertex3f(x,y,z);
GL11.glEnd();

How can I get array x,y and z for rendering?

EgonOlsen

Quote from: "pitt"How can I get array x,y and z for rendering?
Not from me... :wink: createTriangleStrips() optimizes (at least it tries to) the mesh for triangle strips, but that's all it does. When using triangle strips, jPCT creates them on the fly from the data in the VisList, which is a nasty piece of code that does a lot of checks to ensure that everything in the strip really belongs to it. If you really want to use them, you have to mimic this behaviour yourself in your own code or consider one of these options:

a) Don't do it. Triangle strips are not that much faster than immediate mode on current hardware
b) Use vertex arrays instead. They should be much faster and are easy to fill