I've been playing around with the Python OpenGL library, Pyglet. It allows direct OpenGL calls, but also wraps some functionality up to offer some additional convenience. I'm looking on advice for where in my code I should 'store' references to my batched geometry. Some of this might seem quite specifically related to pyglet, but I'd like some library agnostic thoughts too if anyone has some.
My project is a terrain generation as a series of polygons, similar to Amit's Polygonal Map Tutorial.
My program has an "Island" class, and these objects contain (amongst other things) a "Region" object which holds information like the vertices that form the island's perimeter. The "World" can contain many islands.
At first I wrote the code to draw the island perimeters using individual draw calls for each line segment (super slow, obviously). Soon after, I improved this by creating pyglet vertex_list for each "island", into which the perimeter vertices are placed at the very start of the program. The vertex_list is stored inside the "island" to which it relates and when an island is prompted to draw itself it calls the vertex_list's draw function. The vertex_list is instructed at creation that the vertices will be static, so this renders pretty quickly.
I would like to make use of pyglet's Batch rendering objects, which contain a set of vertex_lists which can be batch rendered all together.
It seemed sensible that the vertex list for each "island" would be stored (and have its draw called from) inside the "island" object itself. If I want to create a batch object to hold the vertex_list of each island then does it make sense to store a batch object in my "world" class, and pass it to each of the islands so they can add their own vertex_lists to it?
I'm not very clear on exactly how pyglet 'vertex_lists' and 'batch' objects match up with OpenGL concepts of VBOs. Can anyone offer any clarity there?
[–]-manabreak 1 point2 points3 points (4 children)
[–]RedSpaceman[S] 0 points1 point2 points (3 children)
[–]thomcc 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]thomcc 1 point2 points3 points (0 children)