|
|
@ -25,7 +25,7 @@ int main(int, char**) |
|
|
|
// Setup SDL
|
|
|
|
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMEPAD) != 0) |
|
|
|
{ |
|
|
|
printf("Error: %s\n", SDL_GetError()); |
|
|
|
printf("Error: SDL_Init(): %s\n", SDL_GetError()); |
|
|
|
return -1; |
|
|
|
} |
|
|
|
|
|
|
@ -60,11 +60,18 @@ int main(int, char**) |
|
|
|
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); |
|
|
|
SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); |
|
|
|
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); |
|
|
|
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE); |
|
|
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL3+OpenGL3 example", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, window_flags); |
|
|
|
SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_HIDDEN); |
|
|
|
SDL_Window* window = SDL_CreateWindow("Dear ImGui SDL3+OpenGL3 example", 1280, 720, window_flags); |
|
|
|
if (window == NULL) |
|
|
|
{ |
|
|
|
printf("Error: SDL_CreateWindow(): %s\n", SDL_GetError()); |
|
|
|
return -1; |
|
|
|
} |
|
|
|
SDL_SetWindowPosition(window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); |
|
|
|
SDL_GLContext gl_context = SDL_GL_CreateContext(window); |
|
|
|
SDL_GL_MakeCurrent(window, gl_context); |
|
|
|
SDL_GL_SetSwapInterval(1); // Enable vsync
|
|
|
|
SDL_ShowWindow(window); |
|
|
|
|
|
|
|
// Setup Dear ImGui context
|
|
|
|
IMGUI_CHECKVERSION(); |
|
|
|