# Offscreen Rendering vs Render-to-texture

**URL:** <https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665>\
**Category:** OpenGL: Advanced Coding\
**Created:** [February 23, 2011, 11:05am UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665 "2011-02-23T11:05:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![McLeary](https://community.khronos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@McLeary](https://community.khronos.org/u/McLeary)\
**Post date:** [February 23, 2011, 11:05am UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/1 "2011-02-23T11:05:22Z")

</div>

After read the OpenGL Programming Guide unnumbered times about Frame Buffer Objects I didn’t find the difference between Offscreen Rendering and Render-to-texture techniques.

Here is what I understood from the two concepts:

Offscreen rendering: Using a FBO, OpenGL is capable of rendering an entire scene onto a FBO. At least a color and a depth buffers must be attached to the FBO.

Render-to-texture: Same as above, but textures are attached onto the FBO instead of render buffers. It’s possible to detach the texture and use it in another place.

Please, correct me if I’m missing something.

The question is, what is the advantage of Offscreen rendering over render-to-texture?

As far as I know, it’s only possible to copy rectangular areas from buffers generated with offscreen rendering to the displayable frame buffer.

Thanks in advance

---

<div class="post-metadata">

**Author:** ![skynet](https://community.khronos.org/letter_avatar_proxy/v4/letter/s/919ad9/32.png) [@skynet](https://community.khronos.org/u/skynet)\
**Post date:** [February 23, 2011, 11:27am UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/2 "2011-02-23T11:27:57Z")

</div>

The purpose of renderbuffers is  
a) expose renderable pixelformats that can’t be used as texture formats (for instance, multisampled renderbuffers in the days when ARB\_texture\_multisample was not born yet)  
b) since the driver knows that a renderbuffer can’t be ever used for a texture, it has the opportunity to chose a different, more render-optimized memory layout for the renderbuffer.

So, my advice is to use renderbuffers instead of textures whenever you can (i.e. don’t need to sample the rendered data in a shader afterwards).

---

<div class="post-metadata">

**Author:** ![McLeary](https://community.khronos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@McLeary](https://community.khronos.org/u/McLeary)\
**Post date:** [February 25, 2011, 10:41am UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/3 "2011-02-25T10:41:27Z")

</div>

Thanks Skynet. I came with another doubt. Like you said, it’s a good thing the use of render buffer instead of render-to-texture, but, one can’t use the result image of a render buffer as a texture. The only way of using the result produced with render buffer is to copy rectangular data to the displayable framebuffer?

---

<div class="post-metadata">

**Author:** ![Alfonse\_Reinheart](https://community.khronos.org/user_avatar/community.khronos.org/alfonse_reinheart/32/4357_2.png) [@Alfonse\_Reinheart](https://community.khronos.org/u/Alfonse_Reinheart)\
**Post date:** [February 25, 2011, 12:39pm UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/4 "2011-02-25T12:39:22Z")

</div>

> The only way of using the result produced with render buffer is to copy rectangular data to the displayable framebuffer?

That would be just as true for textures too. You cannot render directly to the visible framebuffer with FBOs.

---

<div class="post-metadata">

**Author:** ![McLeary](https://community.khronos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@McLeary](https://community.khronos.org/u/McLeary)\
**Post date:** [February 25, 2011, 1:00pm UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/5 "2011-02-25T13:00:20Z")

</div>

> That would be just as true for textures too. You cannot render directly to the visible framebuffer with FBOs.

But when one use Textures it’s is possible to detach the texture and use it just the way you like. I guess render buffers can be more optimized for some operations rather than textures. I don’t see any other advantage then performance (I’m not saying this is not an important issue)

---

<div class="post-metadata">

**Author:** ![imported\_kyle](https://community.khronos.org/letter_avatar_proxy/v4/letter/i/e9bcb4/32.png) [@imported\_kyle](https://community.khronos.org/u/imported_kyle)\
**Post date:** [February 25, 2011, 1:31pm UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/6 "2011-02-25T13:31:48Z")

</div>

I dont see much advantage at all (perhaps if there are some renderbuffer only internal formats, but dont know that).

Internally rb and tex would probably be the same thing. You can blit from renderbuffers - which probably wont be done with specialized FF as there are format conversions, scissoring and probably more things that affect blit.

I wouldnt expect any perf difference at all would be nice if sb that measured this could provide some data.

---

<div class="post-metadata">

**Author:** ![McLeary](https://community.khronos.org/letter_avatar_proxy/v4/letter/m/e9c0ed/32.png) [@McLeary](https://community.khronos.org/u/McLeary)\
**Post date:** [February 25, 2011, 2:34pm UTC](https://community.khronos.org/t/offscreen-rendering-vs-render-to-texture/63665/7 "2011-02-25T14:34:26Z")

</div>

Maybe the only advantage is that the driver could optimize something.  
Thanks for your reply
