|
@ -41,6 +41,12 @@ int main(int, char**) |
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); |
|
|
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2); |
|
|
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); |
|
|
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); |
|
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); |
|
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL2+OpenGL example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); |
|
|
|
|
|
if (window == nullptr) |
|
|
|
|
|
{ |
|
|
|
|
|
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError()); |
|
|
|
|
|
return -1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window); |
|
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window); |
|
|
SDL_GL_MakeCurrent(window, gl_context); |
|
|
SDL_GL_MakeCurrent(window, gl_context); |
|
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
|
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
|
|