Slow DisplayLists in LWJGL?

Started by Qudus, March 25, 2007, 00:02:20

Previous topic - Next topic

Qudus

Hi

This a repost from JGO, where nobody answered. So I'm trying here.

I'm trying to optimize DisplayList usage in Xith3D. Unfortunately I'm not very successful. I managed to improve VBO speed by far in both JOGL and LWJGL. But the DisplayLists puzzle me a bit. It seems to depend highly on... something. In one case (a small OBJ model) DisplayList rendering is very fast (only a bit slower than VBO), but in another case it is drastically slow. And especially for LWJGL. In JOGL mode it is not fast but at least not slower than in pure VertexArray mode. I'm quite sure, that the mistake is in my coding. But maybe you can help me out.

So here is the description of my test case. It contains 25x25 spheres with 12 stacks and 12 slices arranged on a "plane". The spheres use all the same Geometry instance (only one set of VBOs or one DL). The camera rotates slowly so the whole field of spheres appears to rotate.

Using VBOs, the scene is rendered at 110 FPS. Using regular VertexArrays the FPS is at 30. But with DisplayLists it is at only crappy 16.

I would naively have expected, that a static geometry is rendered fastest with a DL. Isn't this correct?

The DL is built by creating a VertexArray and rendering it.

I've already doublechecked, if the DL is accidently recreated each frame. But it isn't.

Does anyone have an idea, what this could be?

Marvin

Matzon

is it possible to get a copy of your test ?

Qudus

Quote from: Matzon on March 25, 2007, 07:06:05
is it possible to get a copy of your test ?

Well, I don't know, of how much help it is, since it is using Xith3D, but here it is.

Here is a link to the source of the class, where the DisplayLists are handled: ShapeAtomPeer.java

Thanks.

Marvin

Fool Running

Without the rest of the code, here is what I saw:
callOrCreateGeomDataDisplayList() always returns 1. This causes it to draw the display list and then draw the triangles again (creating a significant slowdown). This also has the bad effect of calling GL11.glEndList() even though none was started.
This is all assuming I'm reading the code right. ;)

Hope it helps ;D

EDIT: In my experience, display lists are slightly faster than VBOs for static data. So if display lists are slower, then something is probably wrong :)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Qudus

Quote from: Fool Running on March 26, 2007, 17:34:36
callOrCreateGeomDataDisplayList() always returns 1. This causes it to draw the display list and then draw the triangles again (creating a significant slowdown). This also has the bad effect of calling GL11.glEndList() even though none was started.
This is all assuming I'm reading the code right. ;)

Thank you very much for having a look into the code. I believe, I tested this and it should not behave this way. But I will definitely doublecheck.

But there's another idea, that came to my mind: I never found any example for DisplayLists in conjuntion with VertexArrays. As you may have seen, I use VertexArrays to send the data to the graphics card. Is this intended to work? And do I have to first create the VertexArrays, then create the DL, then draw the VertexArrays and end the DL? At the moment, I create the DL, create VAs, draw VAs, end DL. Maybe the DL remembers the VA creation and recretes it internally each time the DL is called.

Quote from: Fool Running on March 26, 2007, 17:34:36
EDIT: In my experience, display lists are slightly faster than VBOs for static data. So if display lists are slower, then something is probably wrong :)

This is what I wuold have expected from DLs.

Marvin

Qudus

Quote from: Fool Running on March 26, 2007, 17:34:36
callOrCreateGeomDataDisplayList() always returns 1.

This was indeed true. Thanks for the hint again. But it is not the problem here. Since this method is not used in this example.

Marvin

Fool Running

QuoteBut there's another idea, that came to my mind: I never found any example for DisplayLists in conjuntion with VertexArrays. As you may have seen, I use VertexArrays to send the data to the graphics card. Is this intended to work? And do I have to first create the VertexArrays, then create the DL, then draw the VertexArrays and end the DL? At the moment, I create the DL, create VAs, draw VAs, end DL. Maybe the DL remembers the VA creation and recretes it internally each time the DL is called.
Yes, it is best to create the vertex arrays outside of the display list. I'm not sure if it tries to recreate the vertex array each time, but I know that most tutorials/books say to not put the creations of stuff (VBOs, FBOs, DLs, VAs, etc.) inside of the creation of a display list.
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Qudus

Quote from: Fool Running on March 26, 2007, 20:18:07
Yes, it is best to create the vertex arrays outside of the display list. I'm not sure if it tries to recreate the vertex array each time, but I know that most tutorials/books say to not put the creations of stuff (VBOs, FBOs, DLs, VAs, etc.) inside of the creation of a display list.

I tried it without any effect. Could you maybe point me to some links to tutorials, where DisplayLists are used together with VertexArrays?

Marvin

princec

It would be wise to remove completely the code path pertaining to display lists from Xith; they are effectively becoming obsolete and some vendors don't support them very well. There are also some odd idiosyncrasies when mixing display list generated rendering with normal rendering due to the internal storage format of vertex data in the display lists.

In short, my advice is to ditch them.

Cas :)

Fool Running

QuoteIt would be wise to remove completely the code path pertaining to display lists from Xith; they are effectively becoming obsolete and some vendors don't support them very well.
Wow, I had no idea. My engine currently uses display lists. Is it suggested to use VBOs, then? I tried VBOs a while back and they were slower than the display lists, so I stuck with them for my static data. Maybe I should try again with my newer computer. :P
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Qudus

Quote from: princec on March 27, 2007, 13:13:16
It would be wise to remove completely the code path pertaining to display lists from Xith; they are effectively becoming obsolete and some vendors don't support them very well. There are also some odd idiosyncrasies when mixing display list generated rendering with normal rendering due to the internal storage format of vertex data in the display lists.

In short, my advice is to ditch them.

This is a valuable hint. Thanks. But I compared DLs, VBOs and VAs for some cases and I could not see, that DLs were faster or VBOs were faster for any static geometry. It seemed to depend on something, that I could not see. So I want to provide the users the possibility to choose.

But maybe it's just my system. Are there any known uissues around VBOs or DLs for the (proprietary) Linux ATI driver?

Marvin

Qudus

What about examples for DL+VA? Are there any?

Marvin

darkprophet

Display Lists in Long Peeks + future versions are going to be layered ontop of VBOs. Hence why static VBOs are now the way to go if you want the same performance as display lists.

For VBOs to be up there with display lists, you need to interleave your data and have indices as elemental VBOs. Ontop of that, you need to minimise state changes....and your there.

Regarding the VA/DL issue. You can bake a VA into a DL and simply call glCallList(id); but you can't have the vertex arrays in DL and the normals in VA for example, you get compatibility issues.

DP