LeiaSR SDK 720218b2 v1.32.7.6322 2025-02-13T14:55:38Z
Stable
glweaver.h
Go to the documentation of this file.
1
5#pragma once
6
7#include<memory>
9#include "windows.h"
10#include "sr/weaver/Weaver.h"
11
12#ifdef WIN32
13# ifdef COMPILING_DLL_SimulatedRealityOpenGL
14# define DIMENCOSR_API __declspec(dllexport)
15# else
16# define DIMENCOSR_API __declspec(dllimport)
17# endif
18#else
19# define DIMENCOSR_API
20#endif
21
22// GL types
23typedef unsigned int GLuint;
24typedef int GLsizei;
25typedef unsigned int GLenum;
26
27namespace SR {
34 protected:
35 class Impl;
41#pragma warning(suppress: 4251)
42 std::unique_ptr<Impl> pimpl;
43 public:
46
55
61 void setInputFrameBuffer(GLuint frameBufferID, GLuint renderedTextureID);
62
67 void setWindowHandle(HWND handle);
68
72 void setContrast(float contrast);
73
77 float getContrast() const;
78
84 void setShaderSRGBConversion(bool read, bool write);
85
90
95
99 void setCrosstalkStaticFactor(float factor);
100
105
109 void setCrosstalkDynamicFactor(float factor);
110
115
121 [[deprecated("Use the canWeave(...) functions that accept parameters")]]
122 bool canWeave();
123
131 bool canWeave(unsigned int width, unsigned int height);
132
142 bool canWeave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset);
143
151 void weave(unsigned int width, unsigned int height);
152
162 void weave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset);
163
167 void enableLateLatching(bool enable);
168
173 };
174
176 public:
187 [[deprecated("use the constructor of GLWeaver directly")]]
188 static GLWeaver* create(SR::SRContext& context, unsigned int width, unsigned int height);
189
197 [[deprecated("For best performance use the PredictingGLWeaver interface")]]
198 GLWeaver(SR::SRContext& context, unsigned int width, unsigned int height);
199
208 GLWeaver(SR::SRContext& context, unsigned int width, unsigned int height, GLenum bufferFormat);
209
214 };
215
217 public:
226 [[deprecated("Use non-deprecated constructors")]]
227 PredictingGLWeaver(SR::SRContext& context, unsigned int width, unsigned int height);
228
237 PredictingGLWeaver(SR::SRContext& context, unsigned int width, unsigned int height, HWND window);
238
248 PredictingGLWeaver(SR::SRContext& context, unsigned int width, unsigned int height, GLenum bufferFormat, HWND window);
249
254
266 void setLatency(uint64_t latency);
267
276 uint64_t getLatency();
277
290 void setLatencyInFrames(uint64_t latencyInFrames);
291
292 };
293}
294
295#undef DIMENCOSR_API
enum DIMENCOSR_API WeaverACTMode
Definition: WeaverTypes.h:29
class to be used to add Weaving to OpenGL based SR applications
Definition: glweaver.h:33
GLuint getFrameBuffer()
Returns the buffer that will be used to create a weaved imaged. This buffer expects a side-by-side im...
WeaverACTMode getACTMode() const
Gets the anti-crosstalk mode.
void setACTMode(WeaverACTMode mode)
Sets the anti-crosstalk mode.
void enableLateLatching(bool enable)
Enables late latching. Note that late latching requires applications to call weave() once per frame,...
bool canWeave(unsigned int width, unsigned int height)
Used to determine if software weaving is possible for certain size and visibility to the currently bo...
void weave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset)
Can be called to render a weaved image of a certain size to the currently bound framebuffer.
void setContrast(float contrast)
Sets the weaving contrast.
bool canWeave()
Used to determine if software weaving is possible on this device.
void setInputFrameBuffer(GLuint frameBufferID, GLuint renderedTextureID)
Sets the buffer that will be used to create a weaved image.
void setShaderSRGBConversion(bool read, bool write)
Sets whether to apply shader sRGB<->Linear color space conversions to the input framebuffer during we...
void setWindowHandle(HWND handle)
Sets the window handle of the application window. If the weaver was created using a deprecated constr...
void weave(unsigned int width, unsigned int height)
Can be called to render a weaved image of a certain size to the currently bound framebuffer.
bool canWeave(unsigned int width, unsigned int height, unsigned int xOffset, unsigned int yOffset)
Used to determine if software weaving is possible for certain size and visibility to the currently bo...
float getCrosstalkDynamicFactor() const
Gets the anti-crosstalk dynamic factor.
std::unique_ptr< Impl > pimpl
Definition: glweaver.h:35
void setCrosstalkStaticFactor(float factor)
Sets the anti-crosstalk factor.
void setCrosstalkDynamicFactor(float factor)
Sets the anti-crosstalk dynamic factor.
float getCrosstalkStaticFactor() const
Gets the anti-crosstalk factor.
float getContrast() const
Gets the current weaving contrast.
bool isLateLatchingEnabled() const
Determines if late latching is enabled.
Definition: glweaver.h:175
GLWeaver(SR::SRContext &context, unsigned int width, unsigned int height, GLenum bufferFormat)
Constructs a class to be used for weaving an input image of a certain size.
static GLWeaver * create(SR::SRContext &context, unsigned int width, unsigned int height)
Constructs a class to be used for weaving an input image of a certain size.
~GLWeaver()
Handles proper destruction of all weaver related classes and buffers.
GLWeaver(SR::SRContext &context, unsigned int width, unsigned int height)
Constructs a class to be used for weaving an input image of a certain size.
Definition: glweaver.h:216
~PredictingGLWeaver()
Handles proper destruction of all weaver related classes and buffers.
PredictingGLWeaver(SR::SRContext &context, unsigned int width, unsigned int height)
Constructs a class to be used for weaving an input image of a certain size.
uint64_t getLatency()
Get the latency that is used by the weaver. If setLatency has been called, the value set by that func...
void setLatency(uint64_t latency)
Set the latency to match the expected duration of the full rendering pipeline.
PredictingGLWeaver(SR::SRContext &context, unsigned int width, unsigned int height, HWND window)
Constructs a class to be used for weaving an input image of a certain size.
void setLatencyInFrames(uint64_t latencyInFrames)
Set the latency to match the expected duration of the full rendering pipeline in number of frames....
PredictingGLWeaver(SR::SRContext &context, unsigned int width, unsigned int height, GLenum bufferFormat, HWND window)
Constructs a class to be used for weaving an input image of a certain size.
Maintains WorldObject and Sense objects during the application lifetime.
Definition: srcontext.h:75
#define DIMENCOSR_API
Definition: glweaver.h:19
unsigned int GLenum
Definition: glweaver.h:25
int GLsizei
Definition: glweaver.h:24
unsigned int GLuint
Definition: glweaver.h:23
Namespace containing all C++ Simulated Reality classes.
Definition: srconfiguration.h:20