Hi Ascheer, you can take a look into osgPPU::Unit::drawImplementation. There is PixelDataBufferObejct used to copy the data between GPU und objects attached with PBO (in this case this could be a CPU data).
In general the use is like this: // CPU to GPU Code: PixelDataBufferObject* pbo = ... // specify size of the buffer pbo->setDataSize(dataSize); // set buffer in read mode, i.e. CPU->GPU pbo->bindBufferInReadMode(state); // upload buffer content into the texture state->applyTextureAttribute(Unit, Texture); glTexSubImage2D(Texture->getTextureTarget(), 0, 0, 0, Texture->getTextureWidth(), Texture->getTextureHeight(), osg::Image::computePixelFormat(Texture->getInternalFormat()), osg::Image::computeFormatDataType(Texture->getInternalFormat()), NULL); pbo->unbindBuffer(state.getContextID()); for the GPU to CPU case, it would looks like similar to this: Code: // bind buffer in write mode and copy texture content into the buffer pbo->bindBufferInWriteMode(tate); state->applyTextureAttribute(Unit, Texture); // copy content from texture to the pbo glGetTexImage(Texture->getTextureTarget(), osg::Image::computePixelFormat(Texture->getInternalFormat()), osg::Image::computeFormatDataType(Texture->getInternalFormat()), NULL); pbo->unbindBuffer(state.getContextID()); Reading or writing to the memory is done between the bindBufferIn*Mode() and unbindBuffer() methods by similar to this: Code: // map buffer to some memory // here setup target: GL_PIXEL_PACK_BUFFER_ARB if you have buffer in write mode // or GL_PIXEL_UNPACK_BUFFER_ARB if in read mode // second parameter either GL_READ_ONLY or GL_WRITE_ONLY void* pboMemory = glMapBuffer(_target, _access); // copy data from CPU to buffer memcpy(pboMemory, dataPointer, YourDesiredDattaSize) // or copy data from buffer to CPU memcpy(dataPointer, pboMemory, YourDesiredDattaSize) Of course this is just a reference. Take a look, maybe this can help you. Take also a look into osg/src/BufferObject.cpp which might help you to understand the idea behind the buffered operation. Cheers, Art ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=15641#15641 _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

