LWJGL
May 21, 2012, 00:43:51 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: LWJGL 2.8.3 released!
 
   Home   Help Search Login Register  



Pages: [1]
  Print  
Author Topic: Display Lists  (Read 4148 times)
EricTheRed
Newbie
*
Posts: 13


« on: August 30, 2003, 20: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 Tongue. 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
Logged
elias
Nerdus Imperius
*****
Posts: 899



WWW
« Reply #1 on: August 30, 2003, 23: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
Logged

Chman
Talks Too Much
***
Posts: 100



WWW
« Reply #2 on: August 31, 2003, 11: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
Logged
EricTheRed
Newbie
*
Posts: 13


« Reply #3 on: August 31, 2003, 12: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 Tongue. I still have some questions, though:

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

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
Logged
elias
Nerdus Imperius
*****
Posts: 899



WWW
« Reply #4 on: August 31, 2003, 12: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
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines
SMFAds for Free Forums
Valid XHTML 1.0! Valid CSS!