- var
- FVBO: TGluInt;
- FVBOPointer: PGlVoid;
- i: integer;
- VertexPointer: PVertex;
DGL https://delphigl.com/forum/ |
|
getting started with VBO (vertex buffer objects) https://delphigl.com/forum/viewtopic.php?f=19&t=7197 |
Seite 1 von 1 |
Autor: | noeska [ Sa Jan 12, 2008 19:12 ] |
Betreff des Beitrags: | getting started with VBO (vertex buffer objects) |
It is time to go on and use the 'new' ways for rendering namely vertex buffer objects. So i thougt i start simple an try to render a triangle first, but i must be doing something wrong ... First i declare 4 vars: Code:
Then i initialize the vertex buffer object and fill it with the vertexes making up the triangle. Code:
Now when i want to render it i do: Code:
Enlighten me and tell me what i do wrong. Thanks in advance. |
Autor: | Lord Horazont [ Sa Jan 12, 2008 19:52 ] |
Betreff des Beitrags: | |
You didn't unmap the buffer before rendering with: Code:
And the second parameter of glInterleavedArrays definies the space between one element in the vbo and another. Since your records are lying directly behind each other in the memory as far as i can see, this should be zero. Also make sure that the client state GL_VERTEX_ARRAY is still activated at the point of rendering. Greetz Lord Horazont |
Autor: | noeska [ Sa Jan 12, 2008 20:13 ] |
Betreff des Beitrags: | |
Ok with glUnmapBufferARB subsequent renders work again by the vbo itself is still not drawn. ![]() |
Autor: | Lord Horazont [ Sa Jan 12, 2008 20:18 ] |
Betreff des Beitrags: | |
Did you changed the parameter of glInterleavedArrays also? Does OpenGL returns any error with glGetError? Greetz Lord Horazont |
Autor: | noeska [ Sa Jan 12, 2008 20:26 ] |
Betreff des Beitrags: | |
Yes i changed the second parameter for glInterleavedArrays also. Same result nothing... Now let's see what glGetError can tell me... |
Autor: | noeska [ Sa Jan 12, 2008 21:45 ] |
Betreff des Beitrags: | |
To start with: my vertexes were wrong to begin with. It would not even render properly the old way. ![]() Also the filling part needed to be changed to: Code:
Now i see the triangle . GlInterleafedArrays could stay like it originaly was. To be compete here is the type for PVertex i forgot to post earlier: Code:
|
Autor: | noeska [ So Jan 13, 2008 16:49 ] |
Betreff des Beitrags: | |
Now larger meshes also work. Now i read that there is also a thing called buffers with indexed arrays. If i understand it correctly i do not need to feed all the vertexes even double but only the unique ones and pass indices to them. So like i do in gld3ds where i have a list of vertexes and a list containing indices to them. so i need two vbo's one for the vertexes and one for the indices. but how are these combined? Simple example anyone? |
Autor: | noeska [ So Jan 13, 2008 17:46 ] |
Betreff des Beitrags: | |
Figured it out: Code:
and i render this with: Code:
Now is there a best way? Should i go for indexed or non-indexed? Does that matter for vertex and or fragment programs? Should i have used the second render method even for my first example? |
Autor: | TAK2004 [ Mo Jan 14, 2008 09:55 ] |
Betreff des Beitrags: | |
The best way is the second one with index array because smaller memory use and you can sort the tris very easy for vertex cache. You can use Batches this mean you set a maximum cap for the vertex count. Good values are 200-20k(r9800-x1950) with newer cards the top cap go up. The most power come from vertex cache, high usage of cache mean higher FPS. Test for the optimal balance between batchsize and number of batches. |
Seite 1 von 1 | Alle Zeiten sind UTC + 1 Stunde |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |