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: Rendering to different locations in texture

  1. #1
    Intern Newbie
    Join Date
    Feb 2014
    Posts
    38

    Rendering to different locations in texture

    Hello.

    For purposes of shading (and shadow mapping in this case) I need to pass multiple shadow maps to a shader. Using many texture slots can quickly drain all the available resources, so I guessed it's much better to pass one, bigger texture that would contain all the shadow maps layed after eachother in a rectangles let's say 800x600.
    So here comes my question: how to dynamically change viewport for rendering to texture? Something like shifting the viewport's X and Width values for some constant value.

    I've read about that geometry shader can do something like this, but isn't it an overkill? I have the whole scene, I got the texture, and using a whole additional shader stage just to change viewport seemed a bit overcomplicated to me.

  2. #2
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,190
    Use texture arrays as a primary, or texture atlases (as you allude to) as a fallback plan. See this thread. You can do a pass per shadow map, or one pass for all maps. If you chose the latter (layered rendering), see the wiki for info on having separate viewports per layer.

  3. #3
    Intern Newbie
    Join Date
    Feb 2014
    Posts
    38
    So basically I can use glFramebufferTextureLayer with texture array, right? I didn't know theese two can be combined. I guess that solves my problems. Thank you for pointing me at right direction!

  4. #4
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004
    Location
    Druidia
    Posts
    3,190
    Yes, if you want to use layered rendering.

Posting Permissions

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