Re: [PyOpenGL-Users] VBO help and performance
Brought to you by:
mcfletch
From: Wakefield, R. <rjw...@en...> - 2010-05-07 08:52:23
|
I'm at a loss as how to fix things, please help if you can. I just can't figure out how to get glBufferSubData to work with the built-in VBO class from GL.arrays.vbo. Without the VBO class, I can't get anything to display at all; I guess I'm missing how to do the calls. My understanding was that glBindBuffer() would cause subsequent pointer calls (ex. glVertexPointer) to work as an offset from the bound buffer, so offset 0 would be the start of the buffer. However, using the VBO class, I have to pass it to get the correct offset, e.g. vbo.bind() ... glEnableClientState(GL_VERTEX_ARRAY) glVertexPointer(2, GL_FLOAT, 0, vbo + self.voffset) # would expect '0 + self.voffset' would work, but if I do that, result is that nothing draws, same as above If I try to use glBufferData, how would I even get a pointer like this? I don't really understand what's going on behind the scenes well enough to fix it, but I've tried everything I can think of fiddling around with the VBO class and other code samples. I've attached my actual code, which I've stripped of everything that could possibly interfere. Before trying to run the code, please note: 1.) I've built the basic GUI on pygame and use numpy arrays for the VBO submission, so you'll need those libs to run 2.) the PNG should be placed in a folder 'gfx', 1 level down from the .py files 3.) the use of IBO or VBO only is controlled by the default parameter to the VBO_dat wrapper class, if useIBO is false, we use VBO only and glDrawArrays. Without the culling step, it's actually faster than the IBO version due to less glBindBuffer calls (at least on my machine). 4.) the calculation of the visible region works fine, and in fact on large maps (256*256 tiles = 4096*4096 pixels) immediate-mode performance is notably better than non-culling methods. Still slower than I'd like though. Many thanks in advance! |