render to texture

yes, i know how to do it, but is it reliable? will some cards go crazy when doing glCopyxxx and so on? the reason i want to use it is drawing all my stuff in software 2d into a buffer (now doing it with GDI or DirectDraw)…

thanks for any replies (if any :slight_smile: ),

Is there a reason to think any card would go crazy? Some may go slow though I suspect, not sure if glCopyTexImage stuff is accelerated on Radeon cards yet … (personally I don’t care though since the WGL_ARB_render_texture way of doing things are usually much better)

Doesn’t the Render texture entension use Pbuffers, which requires a context switch? They are more flexable, in that you dont have to trash your backbuffer, but if that isn’t important, I’m sure glCopyTexSubImage will be faster, on nvidia hardware at least.

This is theory, so feel free to tell me I’m wrong.

Also, glCopyTexSubImage is part of core GL 1.1 (think) whereas the render_texture is an extension not supported by alot of cards.


I have found that context switches aren’t at all particularily expensive, not in any way that it hinders my performance significantly, I’m easily able to reach several houndred fps while rendering to a texture each frame (and thus switching contexts back and forth each frame). I would certainly think it’s way cheaper than doing a copy as with glCopyTexImage, even on nVidia cards.
While it’s true that glCopyTexImage is a core OpenGL feature I’m not sure that it’s accelerated by every cards out there, a good solution could be to use the extension if available and use glCopyTexImage as a fallback if it’s not supported.

Btw, I downloaded a little render to texture demo today using glCopyTexImage and it ran at 200 fps, so I would think that it’s accelerated on Radeon these days. I remember last time I tried glCopyTexImage I got 13fps , but that was quite long ago.

The thing about render to texture is that I dont think that textures are usually stored in quite the same format as the back buffer. When you do a render-to-back-buffer-and-copy, the conversion between formats only has to take place once. When you do a render-to-texture directly, this conversion has to be done once for each pixel drawn every time that pixel is drawn. The last time I spoke with any of the nvidia OpenGL guys on this issue was over a year ago, so maybe they found a way to address this since then, but at the time they told me that even if they added support for render-to-texture, drawing and copying would still be faster. Of course, if you are tring to create a 2048x2048 texture, render to texture is probably your only choice.