Dark Bit Factory & Gravity
PROGRAMMING => General coding questions => Topic started by: Canopy on March 22, 2012
-
hi guys,
i'm planning the my opengl project base code, and the first phase is primarily 2D based.
what i plan to do is have a 'decoupled' base code (call it an engine if you like) that has 2 parts.
1) this part deals with calculating/updating the effects
2) this part deals with sending the effect to the gl library, and handles any updates
to begin with lets say the effect is a huge 2d plane/chessboard, i want the screen to be able to go from being at pixel level to zooming in and rotating.
after that i'll want to dynamically be able to change the colour of each square (say to bounce a different coloured square around the grid) or do some colour cycling effects - all kinds of stuff. basically this matrix is the playground of a certain class of my effects.
from what i've read i should deal with triangles.. so for each chessboard square draw the two triangles
i understand the whole keeping lists in faster gpu memory thing and with a bit of work i can work out which 'squares' have changed so i can adjust list that has already been sent to the card.
but this is where i'm confused.
i also read i should be using vertex arrays and not vertex buffer objects as they're deprecated. then i'll find something that says the opposite - this is confusing me as everytime i look up vbo's they're positively suggested over vao's.
i think part of this is due to them not being deprecated in opengl es? (which in turn i think is because in SoC type devices the ram for cpu/gpu is partitioned, so there's not much point differentiating)
so to be bang up to date and not using stuff thats deprecated. what should i use?
as an additional gotcha.. i'd hope to maintain compatibility with opengl es 2.0.
although i'm going to be working under opengl on windows, i hope to down the line recompile without too much effort on arm based devices like the raspberry pi and tablets using that kind of SoC with open gl es 2.0 on board.
-
Vertex buffer objects (vbo) are the way to go and they work work perfectly well on OpenGL ES 1.1.
Low-budget devices with a shared memory architecture (no dedicated gpu memory) naturally show little benefit from vbo-usage, though.
-
ta
the thing that put me off is that this says they're deprecated > http://www.opengl.org/wiki/Vertex_Buffer_Object
BUT - i've also realised, that as long as I code it correctly then i can always work around where the vertex data is as that won't change.. i could even send it all every frame if necessary (euuurgggh)
the idea behind having a front-end/back-end approach so i can do new effects under my existing front-end common code/engine - so if i move it to another platform only those bits would need #ifdef'ing and swapping out.
i'm leaving notes here for myself..
i found this that shows how to mem map and update the buffer on the fly
http://stackoverflow.com/questions/8333401/can-i-create-vertex-buffer-objects-without-color-information
so thats colour cycling/updating taken care off..
hmm... :)
-
It's just client side (system memory) VBOs that are deprecated as of 3.0 and 'removed' in 3.1.
Jim
-
ahhh! thats even more better news, i guess their page needs better clarification!
i found a good bunch of resources about them easily, so once i'm up n running my plans won't be too hard to implement at all.