render to texture, initialisation and cyclic part How can i render cyclically to a texture?


googling for this i found an article here:

The main part in there:
General order of things:-

-cudaGLMapBuffer(ptr, pbo)

glBindBuffer(pbo) ======> Notice NO glMapBuffer
glTexSubImage(…, (last parameter = NULL))
glBindBuffer(0) =====> Unbind buffer

Draw textured quad here

It works for me if i create the texture in initialization, but not if i render to it cyclically.
I also have some doubts about about some parts in there, it tells me to glBindTexture(pbo).

glGenBuffers() and glGenTextures() creates names that it can’t distinguish, e.g. creating two textures gives [1, 2] and creating two buffers also gives [1, 2]. So i wonder if this part is correct?

Also, i wonder what i need to do once at initialization and what i need to do cyclically to update the texture? To my understanding i can only do cudaGLRegisterBufferObject() once and the rest must be done each time i want to update the texture.

  1. Is a call to glBindTexture() with a PBO correct / valid?

  2. What can i do once and what do i need to do cyclically?

Thanks for any hints,


glBindTexture() binds a texture.

You could take at look at postProcessGL SDK example.

Also there is another way to do this and this is to create a framebufferobject and bind the color-attachment as a texture. Then you could render to the framebufferobject and use the texture after you are done with the rendering. Relevant keywords, to find this, are: framebufferobject and texturebuffer.