Cogs.Core
Public Member Functions | Private Attributes | List of all members
Cogs::SwapChainGL20 Class Reference
Inheritance diagram for Cogs::SwapChainGL20:
Cogs::ISwapChain

Public Member Functions

 SwapChainGL20 (GraphicsDeviceGL20 *device, bool isPrimary)
 
bool initialize (WindowData *windowData, bool debugLogging)
 Initialises this swap chain and attaches it to the window provided.
 
void destroy ()
 
virtual void beginFrame () override
 Prepares this swap chain for rendering.
 
virtual void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None) override
 Finalises rendering and swaps the front and back buffers of this swap chain instance.
 
void ReleaseFence ()
 
void ReleaseWait ()
 
virtual void setSize (int newWidth, int newHeight, bool forceIt=false) override
 Changes the size of this swap chain's viewport.
 
virtual void setFullscreen (bool enabled) override
 Switch this swap chain to fullscreen or windowed depending on the parameter.
 
virtual bool isFullscreen () override
 Test whether the current swap chain is fullscreen.
 
virtual int getWidth () const override
 Returns the pixel width of this swap chain.
 
virtual int getHeight () const override
 Returns the pixel height of this swap chain.
 
virtual int getSamples () const override
 Returns the number of samples this swap chain has.
 
virtual const RenderTargetHandlegetRenderTarget () const override
 Returns the render target managed by this swap chain.
 
virtual const DepthStencilHandlegetDepthStencil () const override
 Returns the depth stencil managed by this swap chain.
 
bool recreateOffscreenBuffers ()
 Recreates the textures and render targets used for offscreen rendering.
 
virtual void setSize (int newWidth, int newHeight, bool forceIt=false)=0
 Set the size of the main drawing buffer used by the graphics device in pixels.
 
virtual void setFullscreen (bool enabled)=0
 Switch this swap chain to fullscreen or windowed depending on the parameter.
 
virtual bool isFullscreen ()=0
 Test whether the current swap chain is fullscreen.
 
virtual void beginFrame ()=0
 Signal the beginning of a new frame to the graphics device.
 
virtual void endFrame (uint32_t syncInterval=0, uint32_t presentFlags=PresentFlags::None)=0
 Signal the end of a frame to the graphics device.
 
virtual const RenderTargetHandlegetRenderTarget () const =0
 Returns the render target managed by this swap chain.
 
virtual const DepthStencilHandlegetDepthStencil () const =0
 Returns the depth stencil managed by this swap chain.
 
virtual int getWidth () const =0
 Returns the pixel width of this swap chain.
 
virtual int getHeight () const =0
 Returns the pixel height of this swap chain.
 
virtual int getSamples () const =0
 Returns the number of samples this swap chain has.
 

Private Attributes

GLContext glContext
 
GLsync release = 0
 
GraphicsDeviceGL20graphicsDevice = nullptr
 
int width = 1280
 
int height = 720
 
TextureHandle textureHandle
 
RenderTargetHandle renderTarget
 
DepthStencilHandle depthStencil
 
uint32_t framebuffer = 0
 
const bool isPrimary = false
 
bool fullscreen = false
 
bool needsResize = true
 

Additional Inherited Members

- Protected Attributes inherited from Cogs::ISwapChain
WindowDatawindowData = nullptr
 

Detailed Description

Definition at line 20 of file SwapChainGL20.h.

Constructor & Destructor Documentation

◆ SwapChainGL20()

Cogs::SwapChainGL20::SwapChainGL20 ( GraphicsDeviceGL20 device,
bool  isPrimary 
)

Definition at line 14 of file SwapChainGL20.cpp.

◆ ~SwapChainGL20()

Cogs::SwapChainGL20::~SwapChainGL20 ( )

Definition at line 19 of file SwapChainGL20.cpp.

Member Function Documentation

◆ beginFrame()

void Cogs::SwapChainGL20::beginFrame ( )
overridevirtual

Prepares this swap chain for rendering.

*============================================================================================

Implements Cogs::ISwapChain.

Definition at line 77 of file SwapChainGL20.cpp.

◆ destroy()

void Cogs::SwapChainGL20::destroy ( )

Definition at line 68 of file SwapChainGL20.cpp.

◆ endFrame()

void Cogs::SwapChainGL20::endFrame ( uint32_t  syncInterval = 0,
uint32_t  presentFlags = PresentFlags::None 
)
overridevirtual

Finalises rendering and swaps the front and back buffers of this swap chain instance.

*============================================================================================

Implements Cogs::ISwapChain.

Definition at line 95 of file SwapChainGL20.cpp.

◆ getDepthStencil()

virtual const DepthStencilHandle & Cogs::SwapChainGL20::getDepthStencil ( ) const
inlineoverridevirtual

Returns the depth stencil managed by this swap chain.

Implements Cogs::ISwapChain.

Definition at line 44 of file SwapChainGL20.h.

◆ getHeight()

virtual int Cogs::SwapChainGL20::getHeight ( ) const
inlineoverridevirtual

Returns the pixel height of this swap chain.

Implements Cogs::ISwapChain.

Definition at line 40 of file SwapChainGL20.h.

◆ getRenderTarget()

virtual const RenderTargetHandle & Cogs::SwapChainGL20::getRenderTarget ( ) const
inlineoverridevirtual

Returns the render target managed by this swap chain.

Implements Cogs::ISwapChain.

Definition at line 43 of file SwapChainGL20.h.

◆ getSamples()

int Cogs::SwapChainGL20::getSamples ( ) const
overridevirtual

Returns the number of samples this swap chain has.

Implements Cogs::ISwapChain.

Definition at line 157 of file SwapChainGL20.cpp.

◆ getWidth()

virtual int Cogs::SwapChainGL20::getWidth ( ) const
inlineoverridevirtual

Returns the pixel width of this swap chain.

Implements Cogs::ISwapChain.

Definition at line 39 of file SwapChainGL20.h.

◆ initialize()

bool Cogs::SwapChainGL20::initialize ( WindowData winData,
bool  debugLogging 
)

Initialises this swap chain and attaches it to the window provided.

*============================================================================================

Definition at line 25 of file SwapChainGL20.cpp.

References Cogs::GraphicsDeviceSettings::numSamples.

Referenced by Cogs::GraphicsDeviceGL20::createSwapChain().

◆ isFullscreen()

virtual bool Cogs::SwapChainGL20::isFullscreen ( )
inlineoverridevirtual

Test whether the current swap chain is fullscreen.

Implements Cogs::ISwapChain.

Definition at line 37 of file SwapChainGL20.h.

◆ recreateOffscreenBuffers()

bool Cogs::SwapChainGL20::recreateOffscreenBuffers ( )

Recreates the textures and render targets used for offscreen rendering.

This function will be called in response to a resize request (through a call to setSize), and once after initialisation of this swap chain. Offscreen rendering will be used for all secondary swap chains, and the primary swap chain in the case of headless rendering. *============================================================================================

Definition at line 167 of file SwapChainGL20.cpp.

References Cogs::GraphicsDeviceSettings::colorFormat, Cogs::RenderTargetsGL20::createDepthStencilTarget(), Cogs::RenderTargetsGL20::createRenderTarget(), Cogs::TexturesGL20::loadTexture(), Cogs::RenderTargetViewDescription::numLayers, Cogs::GraphicsDeviceSettings::numSamples, Cogs::RenderTargetsGL20::releaseDepthStencilTarget(), Cogs::RenderTargetsGL20::releaseRenderTarget(), Cogs::TexturesGL20::releaseTexture(), Cogs::TextureFlags::RenderTarget, and Cogs::RenderTargetViewDescription::texture.

◆ ReleaseFence()

void Cogs::SwapChainGL20::ReleaseFence ( )

Definition at line 127 of file SwapChainGL20.cpp.

◆ ReleaseWait()

void Cogs::SwapChainGL20::ReleaseWait ( )

Definition at line 133 of file SwapChainGL20.cpp.

◆ setFullscreen()

void Cogs::SwapChainGL20::setFullscreen ( bool  enabled)
overridevirtual

Switch this swap chain to fullscreen or windowed depending on the parameter.

Implements Cogs::ISwapChain.

Definition at line 154 of file SwapChainGL20.cpp.

◆ setSize()

void Cogs::SwapChainGL20::setSize ( int  newWidth,
int  newHeight,
bool  forceIt = false 
)
overridevirtual

Changes the size of this swap chain's viewport.

(Actually requests a size change before rendering commences.) *============================================================================================

Implements Cogs::ISwapChain.

Definition at line 146 of file SwapChainGL20.cpp.

Member Data Documentation

◆ depthStencil

DepthStencilHandle Cogs::SwapChainGL20::depthStencil
private

Definition at line 57 of file SwapChainGL20.h.

◆ framebuffer

uint32_t Cogs::SwapChainGL20::framebuffer = 0
private

Definition at line 58 of file SwapChainGL20.h.

◆ fullscreen

bool Cogs::SwapChainGL20::fullscreen = false
private

Definition at line 61 of file SwapChainGL20.h.

◆ glContext

GLContext Cogs::SwapChainGL20::glContext
private

Definition at line 49 of file SwapChainGL20.h.

◆ graphicsDevice

GraphicsDeviceGL20* Cogs::SwapChainGL20::graphicsDevice = nullptr
private

Definition at line 52 of file SwapChainGL20.h.

◆ height

int Cogs::SwapChainGL20::height = 720
private

Definition at line 54 of file SwapChainGL20.h.

◆ isPrimary

const bool Cogs::SwapChainGL20::isPrimary = false
private

Definition at line 60 of file SwapChainGL20.h.

◆ needsResize

bool Cogs::SwapChainGL20::needsResize = true
private

Definition at line 62 of file SwapChainGL20.h.

◆ release

GLsync Cogs::SwapChainGL20::release = 0
private

Definition at line 50 of file SwapChainGL20.h.

◆ renderTarget

RenderTargetHandle Cogs::SwapChainGL20::renderTarget
private

Definition at line 56 of file SwapChainGL20.h.

◆ textureHandle

TextureHandle Cogs::SwapChainGL20::textureHandle
private

Definition at line 55 of file SwapChainGL20.h.

◆ width

int Cogs::SwapChainGL20::width = 1280
private

Definition at line 53 of file SwapChainGL20.h.


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