Is list compilation slow?

I’m implementing multipass multitexture in Indirect 3D. I have to call such thing each frame:
glNewList( LIST,GL_COMPILE);
drawobjects;
glEndList;
for each material do {
setmaterial;
glCalllist(LIST);
hidematerial;
}

As an alternative I can call:

for each material do {
setmaterial;
drawobjects;
hidematerial;
}

Is list compilation slow? Will first way be significantly slower than second?

Randy

Compilation is slow. How slow? It’s hard to say. I’d argue that you shouldn’t create a list that you only plan to use, say, 2 or 3 times. 5 times, maybe. 10 times or more, probably. It also depends on the alternative. If it’s immediate mode vs. display list, the gain of display lists is much larger than some fast vertex array code, where the gain of display lists can be reduced to small or negligible.

  • Matt

If you’re using Indirect 3D, then how come you have GL_COMPILE in there? :stuck_out_tongue: It’d make it a bit easier to understand if you said Direct3D or OpenGL

Ands, you should use your alternative, as the list compilation isn’t being used appropriately for the situation. you’re using it to store something now and call it later, whereas you could call it only when you need it. That way, you save a few lines of code, and it should perform much faster, and also enable you to do some non-OpenGL tricks in drawobjects; too. Go for the alternative one you typed. Definitely.

Indirect 3D is a class-library. Now I’m working on OpenGL implementation.
To have proper material I have to use first way, because I cant reach drawobjects.
BTW drawobjects are typically glCallList, so I dont loose much from compilation.
However, swithching from 1 texture to 2 textures caused 90 to 60 framerate drop.
But it’s easy to use now!(I can just set objects material to my multitexturer)

I tested list compilation speed and found such results(for Riva 128):
W/O lists 96 fps
with lists 86 fps
list that has glCalllist recompilation 86 fps
full recompilation 41.3 fps.

That was gluSphere(2,50,50);

Randy

Originally posted by RandyU:
[b]Indirect 3D is a class-library. Now I’m working on OpenGL implementation.
To have proper material I have to use first way, because I cant reach drawobjects.
BTW drawobjects are typically glCallList, so I dont loose much from compilation.
However, swithching from 1 texture to 2 textures caused 90 to 60 framerate drop.
But it’s easy to use now!(I can just set objects material to my multitexturer)

I tested list compilation speed and found such results(for Riva 128):
W/O lists 96 fps
with lists 86 fps
list that has glCalllist recompilation 86 fps
full recompilation 41.3 fps.

That was gluSphere(2,50,50);

Randy[/b]

I used glCallList before and is a problem(as I understand). When glCallList is too big, then you can lose some functions there. I.e. I suppose when buffer is full.

What list size is optimal?

Lose functions from a list?
Are you sure you’re not trying to put functions in that can’t be compiled (like glGet(), there’s a list of all the others in the GL specification)?

Note that the trade-off between lists and
vertex arrays (and other rendering mechanisms)
is probably different for each vendor’s
driver (and even different for different
cards fromt the same vendor). Testing what
works best on your card only is probably not
the way to make a well-grounded design
decision.

That being said, the gain of a glCallList()
over a glDrawElements() is probably small
(on the order of one memcpy() of each array)
to negligible (on the order of saving the
glDrawElements() function call overhead).