On Thu, Nov 10, 2011 at 1:59 PM, romaimperator <[email protected]>wrote:
> Hey guys, > > I'm using pyglet for a research project I am working on and I have a > few questions about vertex lists and batches. I'm using a single batch > with many vertex lists to draw a bunch of lines but the performance is > below what I was hoping for. Every vertex list is using the static > vertex attribute format, has the same group, and has the same mode > (GL_LINES). Also, I turned off vsync and I am running the script with > the -O flag. The video cards we are using have 256 MB of video ram. So > my questions are: > > 1) Is there a maximum limit (other than the limit on video memory) on > the number of vertex lists that can be in a single batch or is there a > recommended limit for performance? > > 2) The performance (measured in frame rate) drops as I increase the > number of vertex lists (going from 500 lists to 1000 drops the frame > rate from 30fps to 20fps) but increasing the number of vertices per > list does not (going from 2 per list to 8 per list had no effect on > frame rate). It seems that there is extra overhead by using more > vertex lists than if I combined the lines into a fewer number. I am > unfamiliar with the implementation so I am wondering, is this > expected? > > 3) Since I already have all of the vertex lists in a single batch, is > there anything else that I should do to squeeze more performance out > of the system without resorting to buying new hardware? > > 4) Is a frame rate decrease from increasing the number of vertex lists > a graphics card bottleneck as I am suspecting since the CPU > utilization is not maxed while the program is running? > > My goal is to be able to support at least 10,000 objects that would > each be able to be independent or in other words I want each object to > have one or more vertex lists but since the performance so low on the > machines with only 1000 vertex lists it seems like this won't be > possible without buying new hardware. > > Thanks in advance for any help you guys can give me. > Some general pointers: The primary performance bottleneck is generally the number of draw calls (in pyglet terms, the number of vertex lists), not the number of vertices. I take it you are making a single call to batch.draw(), rather than drawing each vertex list individually? In that case, pyglet should be accumulating your vertex lists into a few larger draw calls, provided that your vertices match format between the different lists. *** Unfortunately, line rasterisation is not considered a priority on modern graphics cards. You will likely see a substantial performance gain if you switch to textured quads instead. *** Also, culling: I can't imagine that 10,000 objects could really all be visible on screen at once, so set up some sort of spatial partition to avoid drawing the ones that are off-screen. -- Tristam MacDonald System Administrator, Suffolk University Math & CS Department http://swiftcoder.wordpress.com/ -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
