SGCT master (487fac4)
Simple Graphics Cluster Toolkit
Loading...
Searching...
No Matches
sgct::Window Class Reference

#include <sgct/window.h>

Public Types

enum class  StereoMode : uint8_t {
  NoStereo = 0 , Active , AnaglyphRedCyan , AnaglyphAmberBlue ,
  AnaglyphRedCyanWimmer , Checkerboard , CheckerboardInverted , VerticalInterlaced ,
  VerticalInterlacedInverted , Dummy , SideBySide , SideBySideInverted ,
  TopBottom , TopBottomInverted
}
 Different stereo modes used for rendering. More...

Public Member Functions

 Window (const config::Window &window)
 ~Window ()
void openWindow (GLFWwindow *share, bool isLastWindow)
 This function is used to open the window.
void closeWindow ()
void initialize ()
 Initialize window buffers such as textures, FBOs, VAOs, VBOs and PBOs.
void initializeContextSpecific ()
void updateResolutions ()
void update ()
void draw ()
void renderFBOTexture ()
void swapBuffers (bool takeScreenshot)
 Swap previous data and current data.
void makeOpenGLContextCurrent ()
bool needsCompatibilityProfile () const
bool shouldTakeScreenshot () const
bool isOpenXREnabled () const
vec2 scale () const
float aspectRatio () const
ivec2 windowSize () const
GLFWwindow * windowHandle () const
void addViewport (std::unique_ptr< Viewport > vpPtr)
const std::vector< std::unique_ptr< Viewport > > & viewports () const
void updateFrustums (float nearClip, float farClip)
void renderScreenQuad () const
void setFramebufferResolution (ivec2 resolution)
 Sets the framebuffer resolution.
ivec2 framebufferResolution () const
 Get the dimensions of the final FBO.
bool isWindowResized () const
bool isFocused () const
int id () const
void setName (std::string name)
 Name this window.
const std::string & name () const
void setTags (std::vector< std::string > tags)
 Tag this window.
bool hasTag (std::string_view tag) const
void setVisible (bool state)
 Set the visibility state of this window.
bool isVisible () const
void setRenderWhileHidden (bool state)
 Set if window should render while hidden.
bool isRenderingWhileHidden () const
void setFullscreen (bool fullscreen)
 Set if fullscreen mode should be used.
void setAutoiconify (bool shouldAutoiconify)
 Sets whether a full screen window should automatically iconify when losing focus.
void setFloating (bool floating)
 Set if the window should float (be on top / topmost).
void setTakeScreenshot (bool takeScreenshot)
 Set if the window should participate in screenshot taking.
void setWindowDecoration (bool state)
 Set if window borders should be visible.
void setWindowResizable (bool state)
 Set if the window should be resizable.
void setFixResolution (bool state)
 Force the framebuffer to a fixed size which may be different from the window size.
bool isFixResolution () const
void setHorizFieldOfView (float hFovDeg)
float horizFieldOfViewDegrees () const
 Get FOV of viewport[0].
void setCallDraw2DFunction (bool state)
 Set if the specified Draw2D function pointer should be called for this window.
void setCallDraw3DFunction (bool state)
 Set if the specified Draw3D function pointer should be called for this window.
void setStereoMode (StereoMode sm)
 Set the stereo mode.
StereoMode stereoMode () const
bool isStereo () const
unsigned int frameBufferTextureEye (Eye eye) const

Static Public Member Functions

static void makeSharedContextCurrent ()
static void initNvidiaSwapGroups ()
 Init Nvidia swap groups if supported by hardware.
static void resetSwapGroupFrameNumber ()
 Force a restore of the shared OpenGL context.
static void setBarrier (bool state)
static bool isBarrierActive ()
static bool isUsingSwapGroups ()
static unsigned int swapGroupFrameNumber ()

Member Enumeration Documentation

◆ StereoMode

enum class sgct::Window::StereoMode : uint8_t
strong

Different stereo modes used for rendering.

Enumerator
NoStereo 
Active 
AnaglyphRedCyan 
AnaglyphAmberBlue 
AnaglyphRedCyanWimmer 
Checkerboard 
CheckerboardInverted 
VerticalInterlaced 
VerticalInterlacedInverted 
Dummy 
SideBySide 
SideBySideInverted 
TopBottom 
TopBottomInverted 

Constructor & Destructor Documentation

◆ Window()

sgct::Window::Window ( const config::Window & window)

◆ ~Window()

sgct::Window::~Window ( )

Member Function Documentation

◆ addViewport()

void sgct::Window::addViewport ( std::unique_ptr< Viewport > vpPtr)

◆ aspectRatio()

float sgct::Window::aspectRatio ( ) const
Returns
The aspect ratio of the window

◆ closeWindow()

void sgct::Window::closeWindow ( )

◆ draw()

void sgct::Window::draw ( )

◆ framebufferResolution()

ivec2 sgct::Window::framebufferResolution ( ) const

Get the dimensions of the final FBO.

Regular viewport rendering renders directly to this FBO but a fisheye renders first a cubemap and then to the final FBO. Post effects are rendered using these dimensions.

◆ frameBufferTextureEye()

unsigned int sgct::Window::frameBufferTextureEye ( Eye eye) const

◆ hasTag()

bool sgct::Window::hasTag ( std::string_view tag) const
Returns
true if a specific tag exists

◆ horizFieldOfViewDegrees()

float sgct::Window::horizFieldOfViewDegrees ( ) const

Get FOV of viewport[0].

◆ id()

int sgct::Window::id ( ) const
Returns
This window's id

◆ initialize()

void sgct::Window::initialize ( )

Initialize window buffers such as textures, FBOs, VAOs, VBOs and PBOs.

◆ initializeContextSpecific()

void sgct::Window::initializeContextSpecific ( )

◆ initNvidiaSwapGroups()

void sgct::Window::initNvidiaSwapGroups ( )
static

Init Nvidia swap groups if supported by hardware.

Supported hardware is NVidia Quadro graphics card + sync card or AMD/ATI FireGL graphics card + sync card.

◆ isBarrierActive()

bool sgct::Window::isBarrierActive ( )
static

◆ isFixResolution()

bool sgct::Window::isFixResolution ( ) const
Returns
If the frame buffer has a fix resolution this function returns true

◆ isFocused()

bool sgct::Window::isFocused ( ) const
Returns
this window's focused flag

◆ isOpenXREnabled()

bool sgct::Window::isOpenXREnabled ( ) const

◆ isRenderingWhileHidden()

bool sgct::Window::isRenderingWhileHidden ( ) const
Returns
true if the window is set to render while hidden

◆ isStereo()

bool sgct::Window::isStereo ( ) const
Returns
true if any kind of stereo is enabled

◆ isUsingSwapGroups()

bool sgct::Window::isUsingSwapGroups ( )
static

◆ isVisible()

bool sgct::Window::isVisible ( ) const
Returns
true if the window is visible or not

◆ isWindowResized()

bool sgct::Window::isWindowResized ( ) const
Returns
true if this window is resized

◆ makeOpenGLContextCurrent()

void sgct::Window::makeOpenGLContextCurrent ( )

◆ makeSharedContextCurrent()

void sgct::Window::makeSharedContextCurrent ( )
static

◆ name()

const std::string & sgct::Window::name ( ) const
Returns
The name of this window

◆ needsCompatibilityProfile()

bool sgct::Window::needsCompatibilityProfile ( ) const

◆ openWindow()

void sgct::Window::openWindow ( GLFWwindow * share,
bool isLastWindow )

This function is used to open the window.

Parameters
shareThe context that is shared between windows. May be nullptr
isLastWindowWhether this is the last window. This is required to know as we only want to set the vsync setting once per node

◆ renderFBOTexture()

void sgct::Window::renderFBOTexture ( )

◆ renderScreenQuad()

void sgct::Window::renderScreenQuad ( ) const

◆ resetSwapGroupFrameNumber()

void sgct::Window::resetSwapGroupFrameNumber ( )
static

Force a restore of the shared OpenGL context.

◆ scale()

vec2 sgct::Window::scale ( ) const
Returns
Get the scale value (relation between pixel and point size). Normally this value is 1.f but 2.f on some retina computers

◆ setAutoiconify()

void sgct::Window::setAutoiconify ( bool shouldAutoiconify)

Sets whether a full screen window should automatically iconify when losing focus.

◆ setBarrier()

void sgct::Window::setBarrier ( bool state)
static

◆ setCallDraw2DFunction()

void sgct::Window::setCallDraw2DFunction ( bool state)

Set if the specified Draw2D function pointer should be called for this window.

◆ setCallDraw3DFunction()

void sgct::Window::setCallDraw3DFunction ( bool state)

Set if the specified Draw3D function pointer should be called for this window.

◆ setFixResolution()

void sgct::Window::setFixResolution ( bool state)

Force the framebuffer to a fixed size which may be different from the window size.

◆ setFloating()

void sgct::Window::setFloating ( bool floating)

Set if the window should float (be on top / topmost).

◆ setFramebufferResolution()

void sgct::Window::setFramebufferResolution ( ivec2 resolution)

Sets the framebuffer resolution.

These parameters will only be used if a fixed resolution is used that is different from the window resolution.

Parameters
resolutionThe width and height of the frame buffer in pixels

◆ setFullscreen()

void sgct::Window::setFullscreen ( bool fullscreen)

Set if fullscreen mode should be used.

◆ setHorizFieldOfView()

void sgct::Window::setHorizFieldOfView ( float hFovDeg)

◆ setName()

void sgct::Window::setName ( std::string name)

Name this window.

◆ setRenderWhileHidden()

void sgct::Window::setRenderWhileHidden ( bool state)

Set if window should render while hidden.

Normally a window pauses the rendering if it's hidden.

◆ setStereoMode()

void sgct::Window::setStereoMode ( StereoMode sm)

Set the stereo mode.

Set this mode in your init callback or during runtime in the post-sync-pre-draw callback. GLSL shaders will be recompliled if needed.

◆ setTags()

void sgct::Window::setTags ( std::vector< std::string > tags)

Tag this window.

Tags are seperated by comma.

◆ setTakeScreenshot()

void sgct::Window::setTakeScreenshot ( bool takeScreenshot)

Set if the window should participate in screenshot taking.

◆ setVisible()

void sgct::Window::setVisible ( bool state)

Set the visibility state of this window.

If a window is hidden the rendering for that window will be paused unless it's forced to render while hidden by using setRenderWhileHidden.

◆ setWindowDecoration()

void sgct::Window::setWindowDecoration ( bool state)

Set if window borders should be visible.

◆ setWindowResizable()

void sgct::Window::setWindowResizable ( bool state)

Set if the window should be resizable.

◆ shouldTakeScreenshot()

bool sgct::Window::shouldTakeScreenshot ( ) const

◆ stereoMode()

StereoMode sgct::Window::stereoMode ( ) const
Returns
The stereo mode

◆ swapBuffers()

void sgct::Window::swapBuffers ( bool takeScreenshot)

Swap previous data and current data.

This is done at the end of the render loop.

◆ swapGroupFrameNumber()

unsigned int sgct::Window::swapGroupFrameNumber ( )
static

◆ update()

void sgct::Window::update ( )

◆ updateFrustums()

void sgct::Window::updateFrustums ( float nearClip,
float farClip )

◆ updateResolutions()

void sgct::Window::updateResolutions ( )

◆ viewports()

const std::vector< std::unique_ptr< Viewport > > & sgct::Window::viewports ( ) const

◆ windowHandle()

GLFWwindow * sgct::Window::windowHandle ( ) const
Returns
The pointer to GLFW window

◆ windowSize()

ivec2 sgct::Window::windowSize ( ) const
Returns
Get the window size

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