PDA

View Full Version : Draw many vertexs with the motion speed fast



Rondey
03-03-2009, 03:31 PM
I try to draw around 20.000 vertexes with textures but the motion animation is slow when run the program.

I have a file (.txt) with 20.000 vertexes vectorial directions; the program read the file perfectly; charge the arrays with the data; and show the scene but very slow. How I do for the motion will be normal (fast) and not slow.

the structure is read array file (.txt) use glvertexf();

show scene

that program is with opengl and delphi 6

ZbuffeR
03-03-2009, 04:03 PM
So your object data is static ? Then use a display list or better a VBO (vertex buffer object).
20000 vertices is very small, should not be a problem. What is you hardware ?

enunes
03-03-2009, 04:09 PM
Hi,

i'm not sure that would be the problem but, either way, you could (should!) try a better solution for rendering those vertex.

glVertex*() is the slowest way possible to draw geometry.

Better than that are Display Lists, Vertex Arrays and then VBO as options.
You can google those terms around and learn a bit more about each.

You could start with Vertex Arrays as they are basically rendering from an array of vertex coordinates, and you seem to have one. You basically enable the feature and tell OpenGl which is your array and draw it all (or parts of it) with a single call, rather than looping for the whole it and making a call for each vertex.


edit: beat me to it :(

Rondey
03-03-2009, 06:37 PM
Hi;
Yes, I need a some example code about vertex arrays but in delphi+opengl; I see what its the problem; so I believe so glvertexf() is so very slow way to draw many vertexes.



VBO no is support by my AGP card

PD. the data is dinamic. get from a file (.txt) this records are generated and saved with the same program.

scratt
03-03-2009, 08:45 PM
If VBOs are not supported then load the vertex data into main memory, and then use glDrawArrays or glDrawElements to draw from client space.

Don't know much about Delphi I am afraid.. But I found this useful when wanting to understand the concept..
http://www.songho.ca/opengl/gl_vertexarray.html