EXT_PIXEL_BUFFER_OBJECT tutorial

Started by
9 comments, last by glJack 18 years, 9 months ago
Where I can find a tutorial explaining how to use this extenstion. I googled many times, but everything I find is this ext' spec. thanx
Advertisement
You shouldn't really expect to get much out of tutorials for this extension. It's a rather advanced feature, enabling things like particle physics on the GPU, but what you actually use it for will vary widely. The spec should be all you need; if you read the spec and find yourself scratching your head and having no idea why you'd want this stuff, you probably don't need it.
Sneftel
thanx. any Idea how this ext can be used to implement Render to texture functionality??
it cant.
the pixel buffer object extension is for async upload/download of texture data to the gfx card/driver.

The framebuffer object extension is the one required for performing render to texture operations.
Check out UltimateGameProgramming . Just go to the OpenGL tutorials section. The deferred shading demo used a pbuffer. Its on page 11.

hope that helps

J
Yeah, don't confuse PBO with pbuffer or FBO. It doesn't have very much at all to do with the sort of render-to-texture one uses for normal render-to-texture tasks.
thanx for help. Now I see, why I couldn't find demos demonstrating render-to-texture using PBO :)

But when this extension can be useful? What for it has been made?
as I said before...

Quote:Original post by _the_phantom_
the pixel buffer object extension is for async upload/download of texture data to the gfx card/driver.


goto the nvidia devleoper section im pretty sure they have an example of its use
Optimally we create two PBO client-to-server streamers per texture object:

    if(GLEE_EXT_pixel_buffer_object)    {      glGenBuffers(2, pixelStreamers);      for(int i = 0; i < 2; i++)      {        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, pixelStreamers);        glBufferData(GL_PIXEL_UNPACK_BUFFER_EXT, textureWidth*textureHeight*colorChannelsCount*sizeOfASingleChannelInBytes, NULL, GL_STREAM_DRAW);        glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);      }    }


In the following code, the tickTock variable is of type bool, we use it to alternate the PBO streamers per-frame again for optimal performance.

    void*    pboMemory = NULL;    tickTock = !tickTock;        glBindTexture(yourTextureType, yourTextureID);    if(pixelStreamers[tickTock])    {      glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, pixelStreamers[tickTock]);      pboMemory = glMapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, GL_WRITE_ONLY);      memcpy(pboMemory, videoData, textureWidth*textureHeight*colorChannelsCount*sizeOfASingleChannelInBytes);      glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER_EXT);       //Notify texture object of the new update      glTexSubImage2D(getTarget(), 0, 0, 0, textureWidth, textureHeight, yourTextureFormat, yourTextureDataType, NULL);      //Shut the streamer off      glBindBuffer(GL_PIXEL_UNPACK_BUFFER_EXT, 0);    }

This topic is closed to new replies.

Advertisement