Manual modification of texture pixel data.
Hello.
First off, let me say im a beginner with OpenGL.
What im trying to do is to render to target texture, then modify its pixels. From what i gather, for rendering to texture i need to use frame buffer object, and for texture modification - pixel buffer object. To be honest, im overwhelmed by all the information i need to gather and understand, wish there was some kind of tutorial for all this, but i guess ill manage.
What im really confused about is how to use PBO for modifying textures. The only reference ive found so far is this: http://www.songho.ca/opengl/gl_pbo.html#unpack
What i dont understand is how to copy pixels from texture to buffer, and how to actually modify said pixels while theyre in PBO.
Im also not sure how to copy pixel data from buffer to texture. Am i right thinking that i just need to use glTexSubImage2D, using pointer to the target of PBO from glBindBufferARB for const GLvoid *pixels parameter?
FBO based render to texture can be used if you will be using GL commands to render.
If you want to update the texture yourself, use glTexSubImage2D which is a sync operation.
PBO just helps to make that into a async operation so glTexSubImage2D returns immediately without the texture being updated. Sometime in the future, it gets updated.
If you want to update the texture yourself, use glTexSubImage2D which is a sync operation.
PBO just helps to make that into a async operation so glTexSubImage2D returns immediately without the texture being updated. Sometime in the future, it gets updated.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement