Explicitly disable vsync in OpenGL
It seems to be enabled by default (it was on my Raspberry Pi, anyway)
This commit is contained in:
parent
4a6b04d306
commit
84df1a427b
4 changed files with 11 additions and 0 deletions
|
@ -59,6 +59,8 @@ bool WindowBackend_OpenGL_CreateWindow(const char *window_title, size_t *screen_
|
||||||
if (GLAD_GL_VERSION_3_2)
|
if (GLAD_GL_VERSION_3_2)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
glfwSwapInterval(0); // Disable vsync
|
||||||
|
|
||||||
Backend_PostWindowCreation();
|
Backend_PostWindowCreation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -13,6 +13,11 @@
|
||||||
|
|
||||||
bool WindowBackend_OpenGL_CreateWindow(const char *window_title, size_t *screen_width, size_t *screen_height, bool fullscreen)
|
bool WindowBackend_OpenGL_CreateWindow(const char *window_title, size_t *screen_width, size_t *screen_height, bool fullscreen)
|
||||||
{
|
{
|
||||||
|
#ifdef SDL_GL_SWAP_CONTROL
|
||||||
|
if (SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, 0) < 0) // Disable vsync
|
||||||
|
Backend_PrintError("Couldn't set OpenGL swap interval: %s", SDL_GetError());
|
||||||
|
#endif
|
||||||
|
|
||||||
if (SDL_SetVideoMode(*screen_width, *screen_height, 0, SDL_RESIZABLE | SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0)) != NULL)
|
if (SDL_SetVideoMode(*screen_width, *screen_height, 0, SDL_RESIZABLE | SDL_OPENGL | (fullscreen ? SDL_FULLSCREEN : 0)) != NULL)
|
||||||
{
|
{
|
||||||
SDL_WM_SetCaption(window_title, NULL);
|
SDL_WM_SetCaption(window_title, NULL);
|
||||||
|
|
|
@ -63,6 +63,8 @@ bool WindowBackend_OpenGL_CreateWindow(const char *window_title, size_t *screen_
|
||||||
if (GLAD_GL_VERSION_3_2)
|
if (GLAD_GL_VERSION_3_2)
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
SDL_GL_SetSwapInterval(0); // Disable vsync
|
||||||
|
|
||||||
Backend_PostWindowCreation();
|
Backend_PostWindowCreation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -52,6 +52,8 @@ bool WindowBackend_Software_CreateWindow(const char *window_title, size_t screen
|
||||||
{
|
{
|
||||||
glfwMakeContextCurrent(window);
|
glfwMakeContextCurrent(window);
|
||||||
|
|
||||||
|
glfwSwapInterval(0); // Disable vsync
|
||||||
|
|
||||||
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
Loading…
Add table
Reference in a new issue