Various changes

- add release build
- control framerate
- fix bug that caused camera to shake
- enable double-buffering and VSync
This commit is contained in:
var
2026-04-26 22:15:58 -05:00
parent 58289aa6b2
commit 839a9dd5c2
5 changed files with 35 additions and 3 deletions

View File

@@ -216,11 +216,15 @@ bool Render_Init(GameState *gs)
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
gs->window = SDL_CreateWindow("Sandbox", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1920, 1080, SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE);;
gs->glContext = SDL_GL_CreateContext(gs->window);
printf("Created OpenGL window.\n");
if (SDL_GL_SetSwapInterval(1) == 0) printf("Enabled VSync.\n");
else printf("Failed to enable VSync. SDL Error: %s\n", SDL_GetError());
glewInit();
gs->shaderProgramId = LoadShaders("./res/glsl/vertex.glsl", "./res/glsl/fragment.glsl");
gs->modelShaderProgramId = LoadShaders("./res/glsl/model_vertex.glsl", "./res/glsl/fragment.glsl");