GLAD loading and SDL initialization
Next: logger
This commit is contained in:
@@ -1,17 +1,49 @@
|
|||||||
#include <iostream>
|
#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
|
#if _WIN32
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#else
|
#else
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
#include <glm/gtc/type_ptr.hpp>
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
std::cout << "----- OpenGL Playground -----" << std::endl;
|
std::cout << "----- OpenGL Playground -----" << std::endl;
|
||||||
std::cout << "-------- Version 1.0 --------" << std::endl;
|
std::cout << "-------- Version 1.0 --------" << std::endl;
|
||||||
std::cout << "----- ©Benjamin Kyd 2019 ----" << 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user