From 7fe8f5d3a4cf1c2abd562a2e11860b09d7aff2ed Mon Sep 17 00:00:00 2001 From: Benjamin Kyd Date: Sat, 16 Feb 2019 16:51:21 +0000 Subject: [PATCH] GLAD loading and SDL initialization Next: logger --- OpenGL/playground/src/main.cpp | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/OpenGL/playground/src/main.cpp b/OpenGL/playground/src/main.cpp index 0171511..9ca8c01 100644 --- a/OpenGL/playground/src/main.cpp +++ b/OpenGL/playground/src/main.cpp @@ -1,17 +1,49 @@ #include +#include + +// SDL includes different on windows +// the way i have it set up so i gotta +// do it like this unfortunately #if _WIN32 #include #else #include #endif - +#include +#include +#include int main(int argc, char** argv) { std::cout << "----- OpenGL Playground -----" << std::endl; std::cout << "-------- Version 1.0 --------" << std::endl; std::cout << "----- ©Benjamin Kyd 2019 ----" << std::endl; + SDL_Window* window = nullptr; + SDL_GLContext glContext; + bool isWindowClosed = true; + + SDL_Init(SDL_INIT_EVERYTHING); + + SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); + SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE, 32); + SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); + + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); + + window = SDL_CreateWindow("GL CUBE", + SDL_WINDOWPOS_CENTERED, + SDL_WINDOWPOS_CENTERED, + 500, 500, + SDL_WINDOW_OPENGL); + glContext = SDL_GL_CreateContext(window); + SDL_GL_SetSwapInterval(0); + + gladLoadGLLoader(SDL_GL_GetProcAddress); }