9#ifndef __SGCT__WINDOW__H__
10#define __SGCT__WINDOW__H__
12#include <sgct/sgctexports.h>
30#include <Processing.NDI.Lib.h>
31#include <Processing.NDI.Send.h>
32#include <Processing.NDI.Structs.h>
44namespace config {
struct Window; }
56 AnaglyphRedCyanWimmer,
60 VerticalInterlacedInverted,
150 const std::vector<std::unique_ptr<Viewport>>&
viewports()
const;
193 const std::string&
name()
const;
306 enum class TextureType { Color, Depth, Normal, Position };
314 void createTextures();
315 void generateTexture(
unsigned int&
id, TextureType type);
329 bool useRightEyeTexture()
const;
359 void blitWindowViewport(
const Window& prevWindow,
const Viewport& viewport,
363 std::vector<std::string> _tags;
366 bool _hideMouseCursor;
367 bool _takeScreenshot;
369 bool _hasCallDraw2DFunction;
370 bool _hasCallDraw3DFunction;
372 bool _shouldAutoiconify;
374 bool _shouldRenderWhileHidden;
380 int8_t _blitWindowId;
381 uint8_t _monitorIndex;
387 bool _isIconified =
false;
388 StereoMode _stereoMode;
389 std::optional<ivec2> _windowPos;
391 ivec2 _framebufferRes;
393 std::optional<ivec2> _pendingWindowSize;
394 bool _windowResChanged =
false;
395 bool _hasFocus =
false;
396 bool _useFixResolution =
false;
397 bool _hasAnyMasks =
false;
398 std::optional<ivec2> _pendingFramebufferRes;
399 GLFWwindow* _windowHandle =
nullptr;
400 float _aspectRatio = 1.f;
413 NDIlib_send_instance_t handle =
nullptr;
414 NDIlib_video_frame_v2_t videoFrame;
417 unsigned int pingPongPbo[3] = { 0, 0, 0 };
418 int currentFrame = 0;
422 const unsigned int _internalColorFormat;
423 const unsigned int _colorDataType;
424 const int _bytesPerColor = 4;
427 unsigned int leftEye = 0;
428 unsigned int rightEye = 0;
429 unsigned int depth = 0;
430 unsigned int intermediate = 0;
431 unsigned int normals = 0;
432 unsigned int positions = 0;
433 } _frameBufferTextures;
435 std::unique_ptr<ScreenCapture> _screenCaptureLeftOrMono;
436 std::unique_ptr<ScreenCapture> _screenCaptureRight;
439 unsigned int _vao = 0;
440 unsigned int _vbo = 0;
442 ShaderProgram _fboQuad;
443 ShaderProgram _overlay;
444 ShaderProgram _stereo;
447 ShaderProgram shader;
451 std::optional<FXAAShader> _fxaa;
453 std::vector<std::unique_ptr<Viewport>> _viewports;
454 std::unique_ptr<OffScreenBuffer> _finalFBO;
456 static GLFWwindow* _sharedHandle;
457 static bool _useSwapGroups;
458 static bool _isBarrierActive;
463 std::filesystem::path path;
This class holds and manages viewportdata and calculates frustums.
Definition viewport.h:29
bool needsCompatibilityProfile() const
static void initNvidiaSwapGroups()
Init Nvidia swap groups if supported by hardware.
void setHorizFieldOfView(float hFovDeg)
static bool isBarrierActive()
void renderScreenQuad() const
void swapBuffers(bool takeScreenshot)
Swap previous data and current data.
GLFWwindow * windowHandle() const
void setCallDraw3DFunction(bool state)
Set if the specified Draw3D function pointer should be called for this window.
void setWindowDecoration(bool state)
Set if window borders should be visible.
StereoMode
Different stereo modes used for rendering.
Definition window.h:51
float aspectRatio() const
unsigned int frameBufferTextureEye(Eye eye) const
void setName(std::string name)
Name this window.
static void resetSwapGroupFrameNumber()
Force a restore of the shared OpenGL context.
Window(const config::Window &window)
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).
const std::vector< std::unique_ptr< Viewport > > & viewports() const
void makeOpenGLContextCurrent()
void initializeContextSpecific()
void setTags(std::vector< std::string > tags)
Tag this window.
bool isWindowResized() const
void setFixResolution(bool state)
Force the framebuffer to a fixed size which may be different from the window size.
void updateFrustums(float nearClip, float farClip)
void openWindow(GLFWwindow *share, bool isLastWindow)
This function is used to open the window.
const std::string & name() const
void setStereoMode(StereoMode sm)
Set the stereo mode.
void setTakeScreenshot(bool takeScreenshot)
Set if the window should participate in screenshot taking.
void addViewport(std::unique_ptr< Viewport > vpPtr)
static void setBarrier(bool state)
void setRenderWhileHidden(bool state)
Set if window should render while hidden.
ivec2 framebufferResolution() const
Get the dimensions of the final FBO.
void setWindowResizable(bool state)
Set if the window should be resizable.
bool isOpenXREnabled() const
void initialize()
Initialize window buffers such as textures, FBOs, VAOs, VBOs and PBOs.
void setFramebufferResolution(ivec2 resolution)
Sets the framebuffer resolution.
StereoMode stereoMode() const
bool hasTag(std::string_view tag) const
static void makeSharedContextCurrent()
static unsigned int swapGroupFrameNumber()
bool isRenderingWhileHidden() const
void setCallDraw2DFunction(bool state)
Set if the specified Draw2D function pointer should be called for this window.
float horizFieldOfViewDegrees() const
Get FOV of viewport[0].
void setFullscreen(bool fullscreen)
Set if fullscreen mode should be used.
bool shouldTakeScreenshot() const
void setVisible(bool state)
Set the visibility state of this window.
static bool isUsingSwapGroups()
bool isFixResolution() const
SPOUTLIBRARY * SPOUTHANDLE
Definition cubemap.h:27
Eye
Definition definitions.h:18
config::Window createScalableConfiguration(const config::Window::Scalable &scalable, const config::Window &window)
FrustumMode
Definition definitions.h:23