Hello Guest

Display Lists

  • 4 Replies
  • 9720 Views
Display Lists
« on: August 31, 2003, 03:12:49 »
[Once again I've crawled out from under my rock. Perhaps this "posting" thing has some merit after all. :roll:]

Alright, so I finally decided to temporarily abandon Java2D and sit down with lwjgl this weekend. First impressions? Using Chman's tutorials, I found it exceedingly simple to create a working program. And one that's fast; I can't argue with 600 fps! The simplicity of transitioning between windowed and fullscreen mode is also nice.

Having spent several hours puzzling through tutorials, I have now progressed to the "textured rotating cube" stage, and have a feel for how much there is to learn. Something to keep me occupied during the school year, I suppose :P. So, back on topic, here's my question: I have several textured quads I'm using to display some text as an introduction to my not-quite-a-game. Is it worth creating a display list to store the 6 or so quads, keeping in mind they're only used for several seconds right at the start of the game? More generally: should I create a display list if I'm going to display the same object two or more times during a frame (for an extended duration)?

- Eric

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Display Lists
« Reply #1 on: August 31, 2003, 06:07:51 »
My advice would be to drop display lists for now and use vertex arrays. They're much more flexible and almost as fast as display lists. Display lists also have a call overhead and I'm not sure 6 quads will be enough to offset that.

Using vertex arrays, you can someday use ARB_vertex_buffer_object which is a slight variation to ordinary vertex arrays allowing for performance equal to or even better than display lists.

 - elias

*

Offline Chman

  • ***
  • 100
    • http://www.shakebox.org
Display Lists
« Reply #2 on: August 31, 2003, 18:59:43 »
ARB_vertex_buffer_object is MUCH faster than DisplayList... But ARB_vertex_buffer_object is only available on newest cards so... You should use compiled vertex array (good performances).

++
Chman

Display Lists
« Reply #3 on: August 31, 2003, 19:11:40 »
Thanks for the replies. I played around with the vertex and texture coordinate arrays this afternoon and managed to display one of my textured quads with them. Yay! At the moment, performance is not a concern. If the screen is showing something other than black, that's good enough for me :P. I still have some questions, though:

When populating a vertex array, is there a better method than:
Code: [Select]

private float[][] v = { { 1.0f, -1.0f, 0.0f },
                            {-1.0f, -1.0f, 0.0f },
                            {-1.0f, 1.0f, 0.0f },
                            {1.0f, 1.0f, 0.0f } };
//...snip!...
vertices = createFloatBuffer(12);
vertices.put(v[0]);
vertices.put(v[1]);
vertices.put(v[2]);
vertices.put(v[3]);
vertices.flip();


And how exactly should vertex arrays be used? Should I draw the array once, then glTranslatef to a new position, then draw the object again, ... ?
I appologize if these questions come off as overwhelmingly naive, but I couldn't find any good tutorials to explain this stuff. I suppose that's why you're here!

- Eric

*

Offline elias

  • *****
  • 899
    • http://oddlabs.com
Display Lists
« Reply #4 on: August 31, 2003, 19:20:26 »
Chman: not entirely correct - VBOs are only available with the newest _drivers_. Seceral older cards like the TNTs and such support them just fine.

 - elias