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 2 of 2

Thread: Drawing 2D interface before the scene

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2017
    Posts
    13

    Drawing 2D interface before the scene

    Is it at all practical to draw non-transparent 2D interface objects in the framebuffer before the 3D scene and eventually any transparent 2D object in order to reduce overdraw? Would a simple Z buffer test suffice, or does this risk creating problems?

  2. #2
    Senior Member OpenGL Guru
    Join Date
    Jun 2013
    Posts
    2,522
    Quote Originally Posted by silikone View Post
    Is it at all practical to draw non-transparent 2D interface objects in the framebuffer before the 3D scene and eventually any transparent 2D object in order to reduce overdraw? Would a simple Z buffer test suffice, or does this risk creating problems?
    That would work.

    A depth test will suffice, but you need to take a bit of care to ensure that 3D primitives which touch the near plane don't appear in front of the 2D interface. Probably the simplest solution is to use glDepthRange() to ensure that the 2D and 3D elements don't overlap in depth.

Posting Permissions

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