Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 3 123 LastLast
Results 1 to 10 of 28

Thread: MRT, render to texture

  1. #1
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    MRT, render to texture

    It's time to have an extension for rendering to many textures and the frame buffer.

    I guess p-buffers are out of the loop because they have their own contexts, but perhaps p-buffer + other textures is a possible valid combination.

    Has this been suggested before? Is the problem beeing addressed?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    Location
    The Round Table at Camelot
    Posts
    1,537

    Re: MRT, render to texture

    You mean like rendering to a texture and framebuffer at the same time? Instead of render to a texture (pbuffer) then copying it to the framebuffer.

    -SirKnight
    -SirKnight

  3. #3
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: MRT, render to texture

    Who said anything about both targets containing the same thing?
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  4. #4
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: MRT, render to texture

    MRT renders to AUX buffers. Any RTT extension worth the effort allows you to bind to AUX buffers, so you can render to multiple textures.

  5. #5
    Super Moderator OpenGL Guru
    Join Date
    Feb 2000
    Location
    Montreal, Canada
    Posts
    4,421

    Re: MRT, render to texture

    Originally posted by Korval:
    MRT renders to AUX buffers. Any RTT extension worth the effort allows you to bind to AUX buffers, so you can render to multiple textures.
    I know that but what is the procedure? If I render to an AUX buffer, I think I would have to copy it to a texture with glCopyTexSubImage2D

    Render to a texture directly would be better.
    ------------------------------
    Sig: http://glhlib.sourceforge.net
    an open source GLU replacement library. Much more modern than GLU.
    float matrix[16], inverse_matrix[16];
    glhLoadIdentityf2(matrix);
    glhTranslatef2(matrix, 0.0, 0.0, 5.0);
    glhRotateAboutXf2(matrix, angleInRadians);
    glhScalef2(matrix, 1.0, 1.0, -1.0);
    glhQuickInvertMatrixf2(matrix, inverse_matrix);
    glUniformMatrix4fv(uniformLocation1, 1, FALSE, matrix);
    glUniformMatrix4fv(uniformLocation2, 1, FALSE, inverse_matrix);

  6. #6
    Member Regular Contributor
    Join Date
    Apr 2004
    Location
    UK
    Posts
    423

    Re: MRT, render to texture

    i've never tried this, but surely you'd just bind a texture to the correct aux buffer and it would have the content mapped to it?

  7. #7
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: MRT, render to texture

    I know that but what is the procedure?
    What "procedure"? There's no RTT extension yet (unless you want to count WGL_ARB_RTT), so there's no rendering to a texture in any way, shape, or form.

  8. #8
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Santa Clara, CA
    Posts
    85

    Re: MRT, render to texture

    WGL_ARB_render_texture may be ugly, but it does work.

    You can use render to texture with MRT, you just bind the AUX buffers as textures just as you would the front buffer. There is an example in our SDK (multiple draw buffers)that demonstrates this:
    http://download.nvidia.com/developer...s/samples.html

    Originally posted by Korval:
    I know that but what is the procedure?
    What "procedure"? There's no RTT extension yet (unless you want to count WGL_ARB_RTT), so there's no rendering to a texture in any way, shape, or form.

  9. #9
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    2,704

    Re: MRT, render to texture

    I don't understand what's "ugly" about WGL_ARB_render_texture? It's fairly well defined, and it provides the actual functionality you typically need when rendering to textures.

    Between CopyTexSubImage() and WGL_ARB_render_texture, the only thing I really miss from Direct3D is the ability to re-attach depth buffers to different render surfaces, and the ability to use a single context (device) for various disparate pbuffers (render targets) -- say, float vs int, and double-buffer vs single-buffer.
    "If you can't afford to do something right,
    you'd better make sure you can afford to do it wrong!"

  10. #10
    Senior Member OpenGL Guru
    Join Date
    Mar 2001
    Posts
    3,768

    Re: MRT, render to texture

    Between CopyTexSubImage() and WGL_ARB_render_texture, the only thing I really miss from Direct3D is the ability to re-attach depth buffers to different render surfaces, and the ability to use a single context (device) for various disparate pbuffers (render targets) -- say, float vs int, and double-buffer vs single-buffer.
    Let's not forget the performance...

Posting Permissions

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