OGRE-Next  3.0.0
Object-Oriented Graphics Rendering Engine
Ogre::GLES2DepthBuffer Class Reference

An abstract class that contains a depth/stencil buffer. More...

#include <OgreGLES2DepthBuffer.h>

+ Inheritance diagram for Ogre::GLES2DepthBuffer:

Public Member Functions

 GLES2DepthBuffer (uint16 poolId, GLES2RenderSystem *renderSystem, GLES2Context *creatorContext, GLenum depthFormat, GLenum stencilFormat, uint32 width, uint32 height, uint32 fsaa, uint32 multiSampleQuality, PixelFormat pixelFormat, bool isDepthTexture, bool isManual)
 
 ~GLES2DepthBuffer ()
 
void bindToFramebuffer (GLenum target=GL_FRAMEBUFFER)
 
GLuint getDepthBuffer () const
 
GLES2ContextgetGLContext () const
 
GLuint getStencilBuffer () const
 
bool hasSeparateStencilBuffer () const
 
virtual bool isCompatible (RenderTarget *renderTarget, bool exactFormatMatch) const
 

Additional Inherited Members

- Public Types inherited from Ogre::DepthBuffer
enum  DepthFormatsMask { DFM_D32 = 1u << 0u , DFM_D24 = 1u << 1u , DFM_D16 = 1u << 2u , DFM_S8 = 1u << 3u }
 
enum  PoolId {
  POOL_NO_DEPTH = 0 , OGRE_DEPRECATED_ENUM_VER =( 3 ) = 0 , POOL_DEFAULT = 1 , OGRE_DEPRECATED_ENUM_VER =( 3 ) = 0 ,
  NO_POOL_EXPLICIT_RTV = 65534 , POOL_INVALID = 65535
}
 
- Static Public Attributes inherited from Ogre::DepthBuffer
static uint8 AvailableDepthFormats
 During initialization DefaultDepthBufferFormat is overriden with a supported format. More...
 
static PixelFormatGpu DefaultDepthBufferFormat
 

Detailed Description

An abstract class that contains a depth/stencil buffer.

Depth Buffers can be attached to render targets. Note we handle Depth & Stencil together. DepthBuffer sharing is handled automatically for you. However, there are times where you want to specifically control depth buffers to achieve certain effects or increase performance. You can control this by hinting Ogre with POOL IDs. Created depth buffers can live in different pools, or all together in the same one. Usually, a depth buffer can only be attached to a RenderTarget if it's dimensions are bigger and have the same bit depth and same multisample settings. Depth Buffers are created automatically for new RTs when needed, and stored in the pool where the RenderTarget should have drawn from. By default, all RTs have the Id POOL_DEFAULT, which means all depth buffers are stored by default in that pool. By choosing a different Pool Id for a specific RenderTarget, that RT will only retrieve depth buffers from that pool, therefore not conflicting with sharing depth buffers with other RTs (such as shadows maps). Setting an RT to POOL_MANUAL_USAGE means Ogre won't manage the DepthBuffer for you (not recommended) RTs with POOL_NO_DEPTH are very useful when you don't want to create a DepthBuffer for it. You can still manually attach a depth buffer though as internally POOL_NO_DEPTH & POOL_MANUAL_USAGE are handled in the same way.

Behavior is consistent across all render systems, if, and only if, the same RSC flags are set RSC flags that affect this class are:

  • RSC_RTT_SEPARATE_DEPTHBUFFER: The RTT can create a custom depth buffer different from the main depth buffer. This means, an RTT is able to not share it's depth buffer with the main window if it wants to.
  • RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE: When RSC_RTT_SEPARATE_DEPTHBUFFER is set, some APIs (ie. OpenGL w/ FBO) don't allow using the main depth buffer for offscreen RTTs. When this flag is set, the depth buffer can be shared between the main window and an RTT.
  • RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL: When this flag isn't set, the depth buffer can only be shared across RTTs who have the EXACT same resolution. When it's set, it can be shared with RTTs as long as they have a resolution less or equal than the depth buffer's.
Remarks
Design discussion http://www.ogre3d.org/forums/viewtopic.php?f=4&t=53534&p=365582
Author
Matias N. Goldberg
Version
1.0

OpenGL supports 2 different methods: FBO & Copy. Each one has it's own limitations. Non-FBO methods are solved using "dummy" DepthBuffers. That is, a DepthBuffer pointer is attached to the RenderTarget (for the sake of consistency) but it doesn't actually contain a Depth surface/renderbuffer (mDepthBuffer & mStencilBuffer are null pointers all the time) Those dummy DepthBuffers are identified thanks to their GL context. Note that FBOs don't allow sharing with the main window's depth buffer. Therefore even when FBO is enabled, a dummy DepthBuffer is still used to manage the windows.

Constructor & Destructor Documentation

◆ GLES2DepthBuffer()

Ogre::GLES2DepthBuffer::GLES2DepthBuffer ( uint16  poolId,
GLES2RenderSystem renderSystem,
GLES2Context creatorContext,
GLenum  depthFormat,
GLenum  stencilFormat,
uint32  width,
uint32  height,
uint32  fsaa,
uint32  multiSampleQuality,
PixelFormat  pixelFormat,
bool  isDepthTexture,
bool  isManual 
)

◆ ~GLES2DepthBuffer()

Ogre::GLES2DepthBuffer::~GLES2DepthBuffer ( )

Member Function Documentation

◆ bindToFramebuffer()

void Ogre::GLES2DepthBuffer::bindToFramebuffer ( GLenum  target = GL_FRAMEBUFFER)

◆ getDepthBuffer()

GLuint Ogre::GLES2DepthBuffer::getDepthBuffer ( ) const
inline

◆ getGLContext()

GLES2Context* Ogre::GLES2DepthBuffer::getGLContext ( ) const
inline

◆ getStencilBuffer()

GLuint Ogre::GLES2DepthBuffer::getStencilBuffer ( ) const
inline

◆ hasSeparateStencilBuffer()

bool Ogre::GLES2DepthBuffer::hasSeparateStencilBuffer ( ) const

◆ isCompatible()

virtual bool Ogre::GLES2DepthBuffer::isCompatible ( RenderTarget *  renderTarget,
bool  exactFormatMatch 
) const
virtual

The documentation for this class was generated from the following file: