Commit 71de39bd55dbf3999d58d06624c3362225032d31
Commits[COMMIT BEGIN]commit 71de39bd55dbf3999d58d06624c3362225032d31 Author: 0x4248 <[email protected]> Date: Sat Jan 3 23:22:59 2026 +0000 OpenGL: [WIP] Add red animate demo Signed-off-by: 0x4248 <[email protected]> diff --git a/lab/opengl/CMakeLists.txt b/lab/opengl/CMakeLists.txt index 0eb6e18..bbd19e5 100644 --- a/lab/opengl/CMakeLists.txt +++ b/lab/opengl/CMakeLists.txt @@ -12,6 +12,6 @@ include_directories(${CMAKE_SOURCE_DIR}/../../ext/glfw/include) find_package(OpenGL REQUIRED) -add_executable(OpenGLHelloWorld src/main.cpp) +add_executable(OpenGLHelloWorld src/demos/redanim.cpp) target_link_libraries(OpenGLHelloWorld PRIVATE glfw OpenGL::GL) diff --git a/lab/opengl/src/main.cpp b/lab/opengl/src/demos/red.cpp similarity index 100% rename from lab/opengl/src/main.cpp rename to lab/opengl/src/demos/red.cpp diff --git a/lab/opengl/src/demos/redanim.cpp b/lab/opengl/src/demos/redanim.cpp new file mode 100644 index 0000000..c3cc837 --- /dev/null +++ b/lab/opengl/src/demos/redanim.cpp @@ -0,0 +1,31 @@ +#include <GLFW/glfw3.h> +#include <iostream> + +int main() { + if (!glfwInit()) { + std::cerr << "Failed to initialize GLFW" << std::endl; + return -1; + } + + GLFWwindow *window = + glfwCreateWindow(800, 600, "Hello OpenGL", nullptr, nullptr); + if (!window) { + std::cerr << "Failed to create GLFW window" << std::endl; + glfwTerminate(); + return -1; + } + + glfwMakeContextCurrent(window); + int x = 0; + while (!glfwWindowShouldClose(window)) { + glClearColor(x / 255.0f, 0.0f, 0.0f, 1.0f); // Animated red screen + glClear(GL_COLOR_BUFFER_BIT); + + glfwSwapBuffers(window); + glfwPollEvents(); + x = (x + 1) % 256; + } + + glfwTerminate(); + return 0; +}[COMMIT END](C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.