Re: [PyOpenGL-Users] VBO help and performance
Brought to you by:
mcfletch
From: Wakefield, R. <rjw...@en...> - 2010-05-07 01:17:48
|
How do you get openGL to cull offscreen triangles? In performance tests, if I don't cull myself the framerate drops proportionate to mapsize. My IBO is already contiguous by row, with (screenheight/tileheight)+1 rows used to cover the screen, the screen IBO. At each frame I make one call to glDrawElements with the screen IBO or an index array in immediate mode. Speed is about the same for either, and I suspect the issue is that I transfer the data from the CPU either way (a screen worth of indices). If I could speed this up a bit I think I'd be okay. Do you know if glBufferSubData would help? The issue I see is that I send much less net data (a few pointers and sizes instead of a full index array), but I'd also need to make ~20 or so calls per frame. I realize these issues would be lessened if I used a larger rectangle for the tile size, but that would be a last resort since it adds a lot of work on the mapping end (each permutation of 4/16/etc small tiles making up a large tile will need to be made into part of the texture atlas). ________________________________________ From: Greg Ewing [gre...@ca...] Sent: Wednesday, May 05, 2010 7:36 PM To: Wakefield, Robert Cc: pyo...@li... Subject: Re: [PyOpenGL-Users] VBO help and performance Wakefield, Robert wrote: > Now that I have a VBO working, I'm wondering what is the best way to speed up culling? First of all, have you tried just drawing the whole map with one big glDrawElements call and relying on OpenGL to cull the off-screen triangles? Unless your map is really enormous, you may find that it's fast enough. If not, I'd suggest dividing the map up into rectangles, sized so that a handful of them cover the screen at any given scrolling position. Organize your indices so that each rectangle occupies a contiguous range in the IBO. Then you can make one call for each rectangle that overlaps the screen. -- Greg |