From fb2bafb215ae6f5e51de73ca9c77c3f2bf02bf9b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 23 Aug 2023 13:12:28 +0800 Subject: [PATCH] image display, two columns --- main.cpp | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 739f12c..6fc7acd 100644 --- a/main.cpp +++ b/main.cpp @@ -10,7 +10,7 @@ int main(int, char**) return 1; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0); - GLFWwindow* window = glfwCreateWindow(1280, 720, "microsa", nullptr, nullptr); + GLFWwindow* window = glfwCreateWindow(1900, 720, "microsa", nullptr, nullptr); if (window == nullptr) { glfwTerminate(); return 1; @@ -18,29 +18,71 @@ int main(int, char**) glfwMakeContextCurrent(window); glfwSwapInterval(1); + IMGUI_CHECKVERSION(); ImGui::CreateContext(); - ImGuiIO& io = ImGui::GetIO(); (void)io; + ImGuiIO& io = ImGui::GetIO(); io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; ImGui::StyleColorsDark(); ImGui_ImplGlfw_InitForOpenGL(window, true); ImGui_ImplOpenGL3_Init("#version 130"); - ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); - while (!glfwWindowShouldClose(window)) { + int waterfall_width = 1600; + int waterfall_height = 700; + unsigned int waterfall_data[1600*700]; + GLuint waterfall; + glGenTextures(1, &waterfall); + glBindTexture(GL_TEXTURE_2D, waterfall); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + int t = 0; + bool exit = false; + while (!exit && !glfwWindowShouldClose(window)) { glfwPollEvents(); + glClearColor(0.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + + t++; + for(int y=0;y