Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Render buffer to texture

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2013
    Posts
    22

    Render buffer to texture

    I'm using glFramebufferTexture2D() to render a buffer to a texture, but that causes it not to display on the screen. How can I write to the texture and to the screen at the same time?

  2. #2
    Member Regular Contributor
    Join Date
    Jun 2013
    Posts
    490
    Quote Originally Posted by Rakehell View Post
    I'm using glFramebufferTexture2D() to render a buffer to a texture, but that causes it not to display on the screen. How can I write to the texture and to the screen at the same time?
    You can't. You render to the texture, then render (or blit) the texture to the screen afterwards. Or render to the texture then render to the screen afterwards.

  3. #3
    Junior Member Newbie
    Join Date
    Jul 2013
    Posts
    22
    Quote Originally Posted by GClements View Post
    You can't. You render to the texture, then render (or blit) the texture to the screen afterwards.
    How do you do that? Right now I'm just making a copy of the texture.

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,188
    Quote Originally Posted by Rakehell View Post
    How do you do that? Right now I'm just making a copy of the texture.
    glBlitFramebuffer(). See this. Note that you can't always take this approach depending on the format differences between your texture and the system framebuffer and/or your needs for resizing the texture in the blit.

    Or as GClements said, you can just render the texture to the screen in the normal way you render with textures. For instance, draw a textured quad.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •