   pbuffer & glCopyTexSubImage2D
  I want to render to a texture, with a pbuffer, and a glCopyTexSubImage2D, but it doesn''t work. I can succesfully create the pbuffer, and render my things to it (only a glClear yet). Then I try glCopyTexSubImage2D, but that doesn''t work. My texture just remains the same.If I do glReadPixels, I get the correct pixel values, so my pbuffer and all is working, but then if I try to upload that pixel data to a texture with glTexSubImage2D, it doesn''t work, unless I first set the original render target again, then glTexSubImage2D does work.So how should I do this? It seems that I can''t use a texture from another render target, while the pbuffer is active, but I can''t believe that''s true, for everyone says you have to use glCopyTexSubImage2D for copying from a pbuffer to a texture.   My Site
  on this page I read:The important thing to note here is that the texture object which will use the pbuffer image is part of the window context. The image on the teapot is part of the pbuffer context. It is important to load the image when the pbuffer context is current since in this demo, the two contexts do not share textures.This sucks. So this means that if I want to use resources in both my pbuffer and my main render target I have to make them share a context? As far as I understand the pbuffer and main render target have to be of the same format. I can do that, but doesn''t that also mean that if I want to upload to a texture of another type, that there has to be done some sort of (slow)conversion?What''s the best way to render to a texture? I want to be able to use the same texture in both the main rendering, and in the render to texture rendering.   My Site;  There is a very simple way to render things to a texture. You can find it at NeHe''s radial blur tutorial. There was also a thread about it  some time ago, and i posted a simple function that does this.No worries about contexts or extensions or anything. Look them up. ;quote:Original post by Tassu  There is a very simple way to render things to a texture. You can find it at NeHe''s radial blur tutorial. There was also a thread about it  some time ago, and i posted a simple function that does this.No worries about contexts or extensions or anything. Look them up.   I know, but that uses the backbuffer to render the texture, and that''s not good for me, because I want to render the texture over a couple of frames.However, I solved it. I just made a pbuffer of the same pixel format as the backbuffer, and then I use the same context as the main backbuffer. It works fine now. My Site