Re: [PyOpenGL-Users] Rolling spectrogram with pyopengl
Brought to you by:
mcfletch
From: Timothée L. <tim...@lp...> - 2009-12-07 08:18:48
|
Le 6 déc. 09 à 15:54, Gijs a écrit : >> Since I'm doing things synchronously in one thread, I don't see how >> using two textures could make the whole thing faster. >> Moreover, there's one single bottleneck which is the writing of the >> two columns of the texture (that's two times approx. 500 pixels >> every 20 ms, with the glTexSubImage2D calls). The display in itself >> appears much below in the profile, so converting it to a display >> list is not my first priority. >> > Even if it looks to be executing synchronously, underneath, the GPU > actually performs commands asynchronously. You provide the GPU with > a whole bunch of commands and the GPU itself decides when and how it > will execute the commands. For certain commands like glReadPixels, > the CPU waits for the GPU to finish before it continues to read the > texture. For optimal GPU performance, you would want as little of > those commands as possible. This is the very reason why ping-ponging > gives you a performance boost. The GPU knows that you don't access > texture A for instance, while you are writing to texture B, so it > can schedule the execution of the commands more efficiently (that's > the basic idea anyway). That's a very interesting candidate to explain why those cheap glTexSubImage2D calls take so much time. So maybe the GPU is still busy drawing to the screen when I'm going from one iteration to the next... I'll take a look at ping-ponging. Thanks. > > However, after reading the reply of Ian Mallett, I would also > suggest using a shader. As Ian said, you can use shaders and render- > to-texture techniques with FBOs (that's something different than > PBOs) to achieve high performance. You can supply the shader with > the old data and the new data in the form of textures. You offset > everything by one texel, and for the last column of pixels you use > the new data. You could use PBOs to transfer the new data to the > input texture which should make it a little bit faster, if properly > used. For some good tutorials regarding FBOs, PBOs and other GPGPU > stuff, I'd suggest the site of Dominik Göddeke (http://www.mathematik.uni-dortmund.de/~goeddeke/gpgpu/tutorial.html > <http://www.mathematik.uni-dortmund.de/%7Egoeddeke/gpgpu/tutorial.html > >). Even though it's C code, most of the code is practically the > same in PyOpenGL. I'll look at shaders too, thanks ! > > Hope this all makes sense :) > > Regards, Gijs |