howto speed up rendering with 5 viewports

Started by
18 comments, last by aggressor 18 years, 9 months ago
Display lists and VBO is not the same.

Even though display lists speed things up a bit vbos loads the triangle & vertex data onto the graphics card self and then when you render you simple direct the client calls to the vbos

ie
glVertexPointer3f(Pointer to VBO)
DrawElements(TRIANGLES)
----------------------------

http://djoubert.co.uk
Advertisement
what's VBO please and can you send over a sample code on how to init and use it.

ciao
Quote:Original post by dawidjoubert
Display lists and VBO is not the same.

Even though display lists speed things up a bit vbos loads the triangle & vertex data onto the graphics card self and then when you render you simple direct the client calls to the vbos


Display list may also reside on video ram (as always its the drivers decistion whats in vram and what not). And how VBOs perform agains display lists depends on many things. In most cases for static geometry, display list perform better.

As for how to use VBOs: lesson 45
Hi

You can use compiled vertex array extension (GL_EXT_compiled_vertex_array).

void Render()
{
// Define all geometry data as single vertex array
// By using you can set up all you geometry data by a single func call
1) glInterleavedArrays(...);
2) glLockArrays();
// First viewport transforms glRotate etc
3) glDrawArrays(...);
// Second viewport transforms glRotate etc
3) glDrawArrays(...);
...
// Fifth viewport transforms glRotate etc
3) glDrawArrays(...);
4) glUnlockArrays();
}

1) Setup all you geometry data
2) This function call will transfer all data from 1) to GPU mem.
3) After glDrawArrays call GPU will render data from its mem.
4) Free GPU mem.

This code work very fast it can give about 100 - 150 fps speed up.
Quote:
Fake it with one viewport (one context) and scissoring.


Multiple viewports do not mean multiple rendering contexts. Also, viewport and scissoring do not do the same thing. One affects the transformation process, the other just rejects pixels outsite of an area.

Anyway, a simple but very important issue: Are you clearing the buffer(depth+color+possibly stencil) each time you render one of the viewports? If yes, then it's unnecessary since I imagine the viewports don't overlap. Clearing the buffers is an expensive function. Just clear the buffer once in every frame, and then render the multiple viewports(glClear() clears the whole buffer, not just the pixels that are inside viewport boundaries).
Quote:Original post by nefthy
Display list may also reside on video ram (as always its the drivers decistion whats in vram and what not). And how VBOs perform agains display lists depends on many things. In most cases for static geometry, display list perform better.


Actually thats not true, static indexed VBO's are far quicker than display lists since

1. All data is in vram
2. Most drivers transform the vertex buffer only once, whereas display lists work upon an expanded data set. Normally an indexed data set is about 30 to 50% the size of the equivalent expanded set (which would explain the 300% speed increase mentioned by a previous poster). Currently, static indexed VBO's are the fastest rendering method available.

One nifty trick however is to insert the code to set each viewport and projection matrix into a display list. It probably won't help a great deal, but VBO's will.....

so far all my code is built on the display list principle, and i would greatly like to try the use VBO. however there is some limitatiions if I have not misunderstood. By the way, is Vertex Arrays anything to do with Vertex Buffer Objects.?
vertex buffer object's speed up vertex arrays by copying the data to the video card's memory (once), then renering many times. So VBO's give little improvment to dynamic data unless done well (whcih is hard).

compiled vertex arrays are very slow on modern hardware, as they are suited to software renderers, and the extension will often run software vertex processing too.

Display lists often will implicity use VBO's anyway, so VBOs may not give much performance improvement.
If you are creating the display list every frame however, thats your problem right there...

Whats your hardware?

Is it one window/render context with many opengl viewports? or many windows/render context's with a single opengl viewport?

Setting the openGL viewport can be considered a free operation.

Instancing only helps out when drawing many objects that are exactly the same in the same viewport, so it will not help here. Plus as mentioned it's D3D only.

More description of you application will help.
Try to implement a code posted by "Anonymous Poster".
It's better than using display list anyway.

I think that compiled vertex arrays can give more performance speed up, rather then VBO. It's very hard to implement dynamic VBO. You need to alter buffers each frame.
Look here www.delphi3d.net/listfiles.php?category=5

->> transfer.zip it shows different transfer modes.

This topic is closed to new replies.

Advertisement