GLAD loading and SDL initialization

Next: logger
This commit is contained in:
Benjamin Kyd
2019-02-16 16:51:21 +00:00
parent bc6fb3d0de
commit 7fe8f5d3a4

View File

@@ -1,17 +1,49 @@
#include <iostream>
#include <glad/glad.h>
// SDL includes different on windows
// the way i have it set up so i gotta
// do it like this unfortunately
#if _WIN32
#include <SDL.h>
#else
#include <SDL2/SDL.h>
#endif
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/type_ptr.hpp>
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);
}