VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtSwapChain Class Referenceabstract

Base implementation of a texture swapchain.

Inheritance diagram for makVrv::DtSwapChain:
Inheritance graph
[legend]

Public Member Functions

 DtSwapChain (DtDe &de, vrvVirtualReality::DtEye eye)
 
virtual ~DtSwapChain ()
 
virtual bool initalise (unsigned int width, unsigned int height, unsigned int layers, DtSwapChainTextureType type, DtGlImageType format)
 
virtual bool addFormat (DtSwapChainTextureType type, DtGlImageType format)
 
virtual void acquireTextures ()=0
 
unsigned int getAcquiredIndex (DtSwapChainTextureType type) const
 
virtual unsigned int getTexture (DtSwapChainTextureType type, int index) const =0
 
virtual void releaseTextures ()=0
 
bool isInitialized () const
 
unsigned int length () const
 
DtSwapChainTextureType type (unsigned int index) const
 
DtGlImageType format (unsigned int index) const
 
DtGlImageType format (DtSwapChainTextureType type) const
 
unsigned int width () const
 
unsigned int height () const
 
unsigned int layers () const
 
vrvVirtualReality::DtEye eye () const
 
GLuint getFbo (unsigned int index) const
 
virtual void copyTextures (osg::RenderInfo &renderInfo, unsigned int srcColorId, unsigned int srcDepthId, unsigned int srcStencilId, bool copySrcAlpha=false, bool srcIsArray=true, int mode=0) const
 
virtual void blitTextureToScreen (int swidth, int sheight, bool showleftEye, int overrideIndex=-1)
 
virtual void blendSwapChains (osg::RenderInfo &renderInfo, DtSwapChain *base, DtSwapChain *overlay) const
 

Protected Member Functions

virtual bool initaliseFbos () const
 
virtual bool initCopyProgram (bool copyDepth, bool copyStencil, bool copySrcAlpha, bool srcIsArray) const
 
virtual bool initBlendProgram () const
 

Protected Attributes

bool myIsInitialized
 
vrvVirtualReality::DtEye myEye
 
unsigned int myLength
 
std::vector
< DtSwapChainTextureType
myTextureTypes
 
std::vector< DtGlImageTypemyFormats
 
unsigned int myWidth
 
unsigned int myHeight
 
unsigned int myLayers
 
std::map
< DtSwapChainTextureType,
unsigned int
mySwapChainIndexes
 
std::vector< GLuintmyFbos
 
DtGlProgrammyCopyProgram
 
int myLastCopyProgramConfig
 
osg::ref_ptr< osg::StateSet > myCopyStateSet
 
unsigned int myCopyQuadVbo
 
unsigned int myLastStencilTexId
 
unsigned int mySrcStencilTexId
 
DtGlProgrammyBlendProgram
 
DtDemyDe
 

Private Member Functions

 DtSwapChain ()
 
 DtSwapChain (const DtSwapChain &orig)
 
DtSwapChainoperator= (const DtSwapChain &)
 

Constructor & Destructor Documentation

makVrv::DtSwapChain::DtSwapChain ( )
private

prevent default constructor

makVrv::DtSwapChain::DtSwapChain ( const DtSwapChain orig)
private

prevent copy construction

makVrv::DtSwapChain::DtSwapChain ( DtDe de,
vrvVirtualReality::DtEye  eye 
)

CTOR takes the post processor, eye to submit for and the VR driver.

virtual makVrv::DtSwapChain::~DtSwapChain ( )
virtual

DTOR.

Member Function Documentation

DtSwapChain& makVrv::DtSwapChain::operator= ( const DtSwapChain )
private

prevent assignment

virtual bool makVrv::DtSwapChain::initalise ( unsigned int  width,
unsigned int  height,
unsigned int  layers,
DtSwapChainTextureType  type,
DtGlImageType  format 
)
virtual

create our swap chain with the requested format, deleting any existing one

Reimplemented in makVrv::DtVarjoSwapChain, makVrv::DtOculusSwapChain, makVrv::DtOpenVRSwapChain, and makVrv::DtXtalSwapChain.

virtual bool makVrv::DtSwapChain::addFormat ( DtSwapChainTextureType  type,
DtGlImageType  format 
)
virtual

add a swap chain of the specified format, initalise needs to have been called first to set dimensions

Reimplemented in makVrv::DtVarjoSwapChain, makVrv::DtOculusSwapChain, makVrv::DtOpenVRSwapChain, and makVrv::DtXtalSwapChain.

virtual void makVrv::DtSwapChain::acquireTextures ( )
pure virtual

acquire the textures from the swap chain for this frame, storing the index in mySwapChainIndexes

Implemented in makVrv::DtVarjoSwapChain, makVrv::DtOculusSwapChain, makVrv::DtOpenVRSwapChain, and makVrv::DtXtalSwapChain.

unsigned int makVrv::DtSwapChain::getAcquiredIndex ( DtSwapChainTextureType  type) const

use basic texture type to get acquired index

virtual unsigned int makVrv::DtSwapChain::getTexture ( DtSwapChainTextureType  type,
int  index 
) const
pure virtual

return the GL texture id of the color swapchain texture at index, pass -1 for currently aquired

Implemented in makVrv::DtVarjoSwapChain, makVrv::DtOculusSwapChain, makVrv::DtOpenVRSwapChain, and makVrv::DtXtalSwapChain.

virtual void makVrv::DtSwapChain::releaseTextures ( )
pure virtual

release the current swapchain texture

Implemented in makVrv::DtVarjoSwapChain, makVrv::DtOculusSwapChain, makVrv::DtOpenVRSwapChain, and makVrv::DtXtalSwapChain.

bool makVrv::DtSwapChain::isInitialized ( ) const

has the swapchainb initalised properly

unsigned int makVrv::DtSwapChain::length ( ) const

length of the swapchain/number of textures

DtSwapChainTextureType makVrv::DtSwapChain::type ( unsigned int  index) const

format of the swapchain textures

DtGlImageType makVrv::DtSwapChain::format ( unsigned int  index) const

format of the swapchain textures

DtGlImageType makVrv::DtSwapChain::format ( DtSwapChainTextureType  type) const

returns the format used by the texture type

unsigned int makVrv::DtSwapChain::width ( ) const

width of the swapchain textures

unsigned int makVrv::DtSwapChain::height ( ) const

height of the swapchain textures

unsigned int makVrv::DtSwapChain::layers ( ) const

layers/depth of the swapchain textures

vrvVirtualReality::DtEye makVrv::DtSwapChain::eye ( ) const

return the eye this swapchain is handling

GLuint makVrv::DtSwapChain::getFbo ( unsigned int  index) const

return fbo for the swap chain texture at index

virtual void makVrv::DtSwapChain::copyTextures ( osg::RenderInfo &  renderInfo,
unsigned int  srcColorId,
unsigned int  srcDepthId,
unsigned int  srcStencilId,
bool  copySrcAlpha = false,
bool  srcIsArray = true,
int  mode = 0 
) const
virtual

copy the color texture to the color swapchain using the stencil as the source for alpha

virtual void makVrv::DtSwapChain::blitTextureToScreen ( int  swidth,
int  sheight,
bool  showleftEye,
int  overrideIndex = -1 
)
virtual

blit the currently aquired texture to the default framebuffer, it's recommended you call this before aquiring a new textur essentially it's best to blit the last frames texture

Reimplemented in makVrv::DtOculusSwapChain.

virtual void makVrv::DtSwapChain::blendSwapChains ( osg::RenderInfo &  renderInfo,
DtSwapChain base,
DtSwapChain overlay 
) const
virtual

blend two swapchains into this one

virtual bool makVrv::DtSwapChain::initaliseFbos ( ) const
protectedvirtual

initalise the FBOs using the available swapchain types. An FBO will be created for each texture in the swapchain. If there are color and depth swap chains the swapchain will also bind the depth texture to the fbos

virtual bool makVrv::DtSwapChain::initCopyProgram ( bool  copyDepth,
bool  copyStencil,
bool  copySrcAlpha,
bool  srcIsArray 
) const
protectedvirtual

compile copy shader program

virtual bool makVrv::DtSwapChain::initBlendProgram ( ) const
protectedvirtual

compile the blend shader program

Member Data Documentation

bool makVrv::DtSwapChain::myIsInitialized
protected
vrvVirtualReality::DtEye makVrv::DtSwapChain::myEye
protected
unsigned int makVrv::DtSwapChain::myLength
mutableprotected

the length/number of textures in the swapchain

std::vector<DtSwapChainTextureType> makVrv::DtSwapChain::myTextureTypes
protected

the type of the texture swap chain

std::vector<DtGlImageType> makVrv::DtSwapChain::myFormats
protected

the format of the texture swap chain

unsigned int makVrv::DtSwapChain::myWidth
mutableprotected

the pixel width of the texture swap chain

unsigned int makVrv::DtSwapChain::myHeight
mutableprotected

the pixel height of the texture swap chain

unsigned int makVrv::DtSwapChain::myLayers
mutableprotected

the number of layers in the textures i.e. array layers

std::map<DtSwapChainTextureType, unsigned int> makVrv::DtSwapChain::mySwapChainIndexes
mutableprotected

active swapchain index for each format

std::vector<GLuint> makVrv::DtSwapChain::myFbos
mutableprotected

fbo for swapchain copy operations

DtGlProgram* makVrv::DtSwapChain::myCopyProgram
mutableprotected

shader to copy sources texture into swapchain

int makVrv::DtSwapChain::myLastCopyProgramConfig
mutableprotected

the bit mask for the last complied version of the copy program

osg::ref_ptr<osg::StateSet> makVrv::DtSwapChain::myCopyStateSet
mutableprotected

state set to encapsulate state changes when doing swapchain fill

unsigned int makVrv::DtSwapChain::myCopyQuadVbo
mutableprotected

vbo for draw command used for swapchain fill

unsigned int makVrv::DtSwapChain::myLastStencilTexId
mutableprotected

the current source depth texture id, tracked so we can recreate stencil view if it changes

unsigned int makVrv::DtSwapChain::mySrcStencilTexId
mutableprotected

the current depth textures stencil view texture id

DtGlProgram* makVrv::DtSwapChain::myBlendProgram
mutableprotected

shader to blend two swapchains into one (scene and overlay)

DtDe& makVrv::DtSwapChain::myDe
protected

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

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)