Methods to boost rendering speed

Jones
Unregistered
 
Post: #31
I fixed it. Now I'm wondering how I should try to implement vertex arrays/vobs.

It has been mentioned that VOB's are available as an extension, if not as part of the core. What I'm pondering is this:

Is it worth building in vertex array support for systems without VOB support as an extension or in the core? They're not the hardest things in the world to implement, but as I've mentioned, my motto is "If it ain't broke don't fix it." Adding features counts as fixing it. Rasp
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #32
It takes essentially 0 effort to transition from VBOs to vertex arrays. All you need to do is make sure you don't do anything with the buffer objects and call glVertexPointer and co. with the pointers rather than offsets. It would probably be worth it, though, just for legacy support. (and it would take all of 20 seconds to implement)
Quote this message in a reply
Jones
Unregistered
 
Post: #33
Thanks!

Is it VBO or VOB? I call it VOB because a couple of books I have call them Vertex Object Buffers.

Guess it works both ways.
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #34
Quote this message in a reply
Jones
Unregistered
 
Post: #35
arekkusu Wrote:Vertex Buffer Object

Why am I not surprised that you are the one to link to the specs. Wink
Quote this message in a reply
Sage
Posts: 1,232
Joined: 2002.10
Post: #36
Why am I still surprised that nobody seems to ever read the specs?
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #37
Because they look official, so they don't apply to me? Rasp
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #38
I always read the specs - but I rarely understand them! Example code sticks to my brain better...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #39
The newer specs all have good example code in them.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #40
OneSadCookie Wrote:The newer specs all have good example code in them.
Ya, but it's at the bottom - most people give up way before then Wink

I was actually very glad to see example code showing up in the specs but some older extensions are still difficult to grok from the specs alone.
Quote this message in a reply
Jones
Unregistered
 
Post: #41
arekkusu Wrote:Why am I still surprised that nobody seems to ever read the specs?

You need to have a laziness value of 5.7 or less to do so. I have a laziness of value of 7.84. Wink

Here are my frame-rates rendering my terrain:

Lists enabled: 2 - 6.
Lists disabled: 5 - 7.

For 65,536 vertices.

Hmm, results are a little better without lists, but suck all around. Of course it could be my fps meter which totally sucks. It works like this:

Code:
int frames;
int last_time;

display() {
// draw
   frames++
   if (time(NULL) > last_time) {
    cout << frames << endl;
    frames = 0;
    last_time = time(NULL);
   }
}

Display is called when everything is idle, so it's continuous. You may begin laughing. Blush
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #42
Quote:You need to have a laziness value of 5.7 or less to do so. I have a laziness of value of 7.84. Wink

Well then, don't expect us to help you...

That's not a very accurate FPS counter. There's a much better one for a GLUT application near the bottom of the display() function here: http://onesadcookie.com/svn/repos/ARB_te...est/main.c

Either way, you must be doing something very wrong with your display list code to get worse performance than immediate mode. Something like generating the list every frame, maybe.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #43
Do not use time(). It has a resolution in seconds, which is... bad. Instead, look at using gettimeofday. It has a resolution of microseconds. Here's some sample code to get the time (in seconds) using gettimeofday.
Code:
struct timeval time;
double currentTime;
gettimeofday(&time, NULL);
currentTime = time.tv_sec + time.tv_usec*1e-6;
Note that currentTime needs to be a double, because a float doesn't have enough precision. For a quick and dirty framerate counter, you can just find the average framerate every 10 frames, by incrementing the frame counter every frame then taking the time elapsed and dividing it by 10. (or any other number of your choice)
Quote this message in a reply
Jones
Unregistered
 
Post: #44
OneSadCookie Wrote:Well then, don't expect us to help you...

No worries, I was joking. I hope you got that. Smile

Thanks for the link to that source file I'll try that method.

@akb:

I like your suggestion to get the frames once every ten loops, it's probably more efficient that checking every loop.

EDIT: I used Cookie's FPS code in my display loop, and I get more precise results....

Lists Disabled: 2.67 - 4.89
Lists Enabled: 1.69 - 4.32

That's just depressing. I am a sad sad graphics programmer. Rasp

Here, try running this app from the command line:
Download.

I grabbed the heightmap and textures from google quickly. They aren't great, but whatever. They do for testing purposes. You will have to run it from the command line to see the console output.

I think most people here (in this thread) will have the SDL framework, which the app requires.

Controls:

w, a, s, d = move around, like in most FPS games.
q = look left.
e = look right.
t = look down.
g = look up.
space = up.
z = down.
i = toggle immediate/list rendering. (console will alert. starts in immediate)

Just try it, if anything, it'll be a moral booster for those of you who though *their* code was slow.
Quote this message in a reply
Moderator
Posts: 1,140
Joined: 2005.07
Post: #45
BTW, you haven't answered OSC's question about display lists: are you re-creating them every frame? Also, what kind of stuff are you putting in there? If you're putting things like texture loading in there, it isn't going to perform too well either.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  what methods can't be used in display lists? ghettotek 9 4,188 Feb 9, 2003 12:47 PM
Last Post: OneSadCookie