|
|
|
@ -939,6 +939,7 @@ namespace olc |
|
|
|
|
virtual olc::rcode DestroyDevice() = 0; |
|
|
|
|
virtual void DisplayFrame() = 0; |
|
|
|
|
virtual void PrepareDrawing() = 0; |
|
|
|
|
virtual void SetVSync(const bool vSyncEnabled) = 0; |
|
|
|
|
virtual void PrepareRender(int width,int height) = 0; |
|
|
|
|
virtual void SetDecalMode(const olc::DecalMode& mode) = 0; |
|
|
|
|
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) = 0; |
|
|
|
@ -5074,6 +5075,7 @@ namespace olc |
|
|
|
|
virtual olc::rcode DestroyDevice() { return olc::rcode::OK; } |
|
|
|
|
virtual void DisplayFrame() {} |
|
|
|
|
virtual void PrepareDrawing() {} |
|
|
|
|
virtual void SetVSync(const bool vSyncEnabled) {} |
|
|
|
|
virtual void PrepareRender(int width,int height) {}; |
|
|
|
|
virtual void SetDecalMode(const olc::DecalMode& mode) {} |
|
|
|
|
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) {} |
|
|
|
@ -5370,6 +5372,26 @@ namespace olc |
|
|
|
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetVSync(const bool vSyncEnabled){ |
|
|
|
|
#if defined(OLC_PLATFORM_WINAPI) |
|
|
|
|
if (locSwapInterval) locSwapInterval(vSyncEnabled?1:0); |
|
|
|
|
bSync = vSyncEnabled; |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_X11) |
|
|
|
|
locSwapInterval(olc_Display, *olc_Window, vSyncEnabled?1:0); |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
|
locSwapInterval(olc_Display, vSyncEnabled?1:0); |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_GLUT) |
|
|
|
|
#if defined(__APPLE__) |
|
|
|
|
GLint sync = vSyncEnabled?1:0; |
|
|
|
|
CGLContextObj ctx = CGLGetCurrentContext(); |
|
|
|
|
if (ctx) CGLSetParameter(ctx, kCGLCPSwapInterval, &sync); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetDecalMode(const olc::DecalMode& mode) |
|
|
|
|
{ |
|
|
|
|
if (mode != nDecalMode) |
|
|
|
@ -5967,6 +5989,26 @@ namespace olc |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void SetVSync(const bool vSyncEnabled){ |
|
|
|
|
#if defined(OLC_PLATFORM_WINAPI) |
|
|
|
|
if (locSwapInterval) locSwapInterval(vSyncEnabled?1:0); |
|
|
|
|
bSync = vSyncEnabled; |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_X11) |
|
|
|
|
locSwapInterval(olc_Display, *olc_Window, vSyncEnabled?1:0); |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_EMSCRIPTEN) |
|
|
|
|
locSwapInterval(olc_Display, vSyncEnabled?1:0); |
|
|
|
|
#endif |
|
|
|
|
#if defined(OLC_PLATFORM_GLUT) |
|
|
|
|
#if defined(__APPLE__) |
|
|
|
|
GLint sync = vSyncEnabled?1:0; |
|
|
|
|
CGLContextObj ctx = CGLGetCurrentContext(); |
|
|
|
|
if (ctx) CGLSetParameter(ctx, kCGLCPSwapInterval, &sync); |
|
|
|
|
#endif |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void PrepareRender(int width,int height)override{ |
|
|
|
|
GLint sizeUniformLoc = locGetUniformLocation(m_nQuadShader, "size"); |
|
|
|
|
locUniform2f(sizeUniformLoc,width,height); |
|
|
|
|