What am I doing wrong?
I want to do environment mapping.
I render to a texture using glCopyTexImage.
I get a texture but glCopyTexImage is too slow (reallocating memory) so I tried glCopyTexSubImage.
But it doesn’t seem to save anything to my texture object.
Is there anything I am missing when using glCopyTexSubImage?
glCopyTexImage will create a new image. Doing this every frame is not going to be very fast. But you are on the right track. Changing to glCopyTexSubImageis what you have to do. My guess is that you don’t really know what that function does. It does not create a new texture, but updates an existing one. That means you first have to create a base texture (using glTexImage), and then update it with glCopyTexSubImage every frame.
But there’s also another problem. Dynamically updating a texture is always going to be slow if your texture is too large. How large is your texture? A size of 128x128, or at a maximum 256x256, is what I believe is good for both performance and quality.