Author Topic: need triangle strip data  (Read 2656 times)

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
need triangle strip data
« on: May 30, 2006, 12:22:02 pm »
I would like the triangle strip data.
Enable it for me please... Thank you. :D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12064
    • View Profile
    • http://www.jpct.net
need triangle strip data
« Reply #1 on: May 30, 2006, 04:35:03 pm »
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.

Offline pitt

  • byte
  • *
  • Posts: 13
    • View Profile
need triangle strip data
« Reply #2 on: May 30, 2006, 05:40:24 pm »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12064
    • View Profile
    • http://www.jpct.net
need triangle strip data
« Reply #3 on: May 30, 2006, 05:48:52 pm »
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