# Indices list in shapes

Can i create shapes without an indices list?

Can the LWJGLRenderer draw this?

"aschwalb" wrote:
Can i create shapes without an indices list?
Can the LWJGLRenderer draw this?
Yes you can. Look at the trimesh class.

Indices are required for all Trimeshes and all shapes extend trimeshes. So, no, you cannot create shapes without index lists.

How would OpenGL know what to draw without indices?

"renanse" wrote:
How would OpenGL know what to draw without indices?

Geometry has no indices, it draws the triangles in order(I think).

You can’t draw Geometry directly.

"renanse" wrote:
You can't draw Geometry directly.
:// That is what hapens in directx then.

I’m not sure, but i think that is also possible.

In xith3d i can choose e.g a TriangleGeometryArray or

an IndexedTriangleGeometryArray.

I think the vertices in its buffer must only lie in the right order

how the triangles must be drawn.

In the lwjgl library documentation i have searched for a right method

to do this job, but all methods and parameters are undocumented, so i have no chance to find a right.

Why they have created a javadoc at all?

Sorry, should’ve been more clear. The way we render in jME, you currently need indices. And by Geometry, I meant our Geometry class.

At last, i have found it!!

I have tested it and at runs without indices.

I only set a dummy indices array new int[1] and change in LWJGLRenderer in method draw(TriMesh t) the following call

’ GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, t.getVertQuantity(), indices); ’ to

‘GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, t.getVertQuantity());’

That does the job.

We have chosen certain methods for a reason, generally related to speed. Why not just generate a simple indices list? It’s extremely easy to do.

Objects without indices are faster created, i think.

Also, extensive objects can have an indices list that is not

so simple how a cube list is. Take 10 objects, each of them has 5000 indices, that takes a lot of extra memory.

Using only wireframe- or colored objects, the code can be much simpler

as for textured objects. This objects needs extra attention between

vertices and indices or the object shows a bit odd.

<<Related to speed>>

Going straight forward through an array is faster, i think, as first

load an offset from another array an than takes the value from

the other array.