Where are vertex's stored?

BlitzMax Forums/BlitzMax Programming/Where are vertex's stored?

ImaginaryHuman(Posted 2005) [#1]
If I wanted to move around and display a large number of individual pixels (ie vertexes in OpenGL), would it be best to have them in a display list, and if so is that display list stored in main memory or videoram? What the best/fastest way to plot a lot of colored pixels as in a particle system?


teamonkey(Posted 2005) [#2]
Probably vertex arrays. Vertex arrays store all the data in one big block of system memory, then send it all across to the card in one go. (There's also Vertex Buffers, which stores the data in video RAM, but they're only faster if the data doesn't change at all, like static 3D meshes.)

The head demo in the samples folder uses vertex arrays, IIRC.

I did a test with sprites a few days ago to see if it was faster drawing lots of them using VAs or just using DrawImage. VAs were faster, but only by a small amount on my system (1% or so). YMMV.


jhague(Posted 2005) [#3]
Display lists are stored in internal, video card friendly formats, and they may indeed be cached in video ram. Vertex array have neither of these properties.

For the highest performance, display lists are the way to go. For smallish models, you might not notice a huge difference, however.


Dreamora(Posted 2005) [#4]
always thought that VBO are the far best performance wise ...


ImaginaryHuman(Posted 2005) [#5]
And if you need to animate each of the vertexes individually?


Loonie(Posted 2005) [#6]
vertices.

look up a book called something like "computer graphics, a top-down approach using opengl"....i remember using this in school and doing a sierpinski gasket exercise, one in 2D and one in 3D......can't remember exactly the method used, but it was just pushing a ton of pixels on screen, and the 3D version also rotated/translated those pixels.

also a cool way of learning recursion, for those who don't know about it....


teamonkey(Posted 2005) [#7]
And if you need to animate each of the vertexes individually?

Vertex Arrays or individual vertices. VBs and display lists are only an advantage for static vertex lists that you don't change.


ImaginaryHuman(Posted 2005) [#8]
I have seen mention of display lists but nothing about vertex arrays. are they supported in blitzmaX? how?


teamonkey(Posted 2005) [#9]
glhead.bmx uses them.

Also,

Sorry about the length of that - what's the name of the tag that puts it in a scrollable box?

EDIT: Thanks, mephtis.

BTW, don't worry about the maths in the SetPos method. I just copied and pasted it (on the whole) from DrawImage. It basically sets four vertex co-ordinates per sprite (top-left, top-right, bottom-right, bottom-left in turn) with texture co-ordinates to match. It's more complex than it could be, because I've left in the transform bits that could potentially let you rotate the sprites.


flying willy(Posted 2005) [#10]
codebox


Dirk Krause(Posted 2005) [#11]
To run the code, you must have ball.png from the samples in the same directory.