Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/app/opengl/window.cpp
| /* SPDX-License-Identifier: Apache-2.0 | /* SPDX-License-Identifier: Apache-2.0 | ||||
| * Copyright 2011-2022 Blender Foundation */ | * Copyright 2011-2022 Blender Foundation */ | ||||
| #include <stdio.h> | #include <stdio.h> | ||||
| #include <stdlib.h> | #include <stdlib.h> | ||||
| #include "app/opengl/window.h" | #include "app/opengl/window.h" | ||||
| #include "util/string.h" | #include "util/string.h" | ||||
| #include "util/thread.h" | #include "util/thread.h" | ||||
| #include "util/time.h" | #include "util/time.h" | ||||
| #include "util/version.h" | #include "util/version.h" | ||||
| #include <GL/glew.h> | |||||
| #include <SDL.h> | #include <SDL.h> | ||||
| #include <epoxy/gl.h> | |||||
| CCL_NAMESPACE_BEGIN | CCL_NAMESPACE_BEGIN | ||||
| /* structs */ | /* structs */ | ||||
| struct Window { | struct Window { | ||||
| WindowInitFunc initf = nullptr; | WindowInitFunc initf = nullptr; | ||||
| WindowExitFunc exitf = nullptr; | WindowExitFunc exitf = nullptr; | ||||
| ▲ Show 20 Lines • Show All 265 Lines • ▼ Show 20 Lines | void window_main_loop(const char *title, | ||||
| if (V.window == nullptr) { | if (V.window == nullptr) { | ||||
| fprintf(stderr, "Failed to create window: %s\n", SDL_GetError()); | fprintf(stderr, "Failed to create window: %s\n", SDL_GetError()); | ||||
| return; | return; | ||||
| } | } | ||||
| SDL_RaiseWindow(V.window); | SDL_RaiseWindow(V.window); | ||||
| V.gl_context = SDL_GL_CreateContext(V.window); | V.gl_context = SDL_GL_CreateContext(V.window); | ||||
| glewInit(); | |||||
| SDL_GL_MakeCurrent(V.window, nullptr); | SDL_GL_MakeCurrent(V.window, nullptr); | ||||
| window_reshape(width, height); | window_reshape(width, height); | ||||
| window_display(); | window_display(); | ||||
| while (true) { | while (true) { | ||||
| bool quit = false; | bool quit = false; | ||||
| SDL_Event event; | SDL_Event event; | ||||
| ▲ Show 20 Lines • Show All 47 Lines • Show Last 20 Lines | |||||