Open
Description
Version/Branch of Dear ImGui:
Lastest
Back-ends:
imgui_impl_glfw3.cpp + imgui_impl_opengl2.cpp
Compiler, OS:
Arch GCC CodeBlocks
Full config/build information:
No response
Details:
The ImGui Window doesn't respond at all
I'm trying to fix this like for 2 hours I even used chatgpt to fix the issue but nothing work
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
#include <iostream>
#include <GL/glew.h>
#include <GL/gl.h>
#include <GLFW/glfw3.h>
#include "imgui/imgui.h"
#include "imgui/imgui_impl_glfw.h"
#include "imgui/imgui_impl_opengl2.h"
using namespace std;
int main()
{
// Initialize GLFW
if (!glfwInit()) {
cout << "Failed to initialize GLFW!" << endl;
return -1;
}
// Set OpenGL version to 2.x
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
// Create GLFW window
GLFWwindow* window = glfwCreateWindow(800, 600, "LightMX", nullptr, nullptr);
if (!window) {
cout << "Failed to create GLFW window!" << endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
// Initialize GLEW (must be done after creating the context)
glewInit();
// Initialize ImGui
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL2_Init();
// Input callback setup
glfwSetKeyCallback(window, ImGui_ImplGlfw_KeyCallback);
glfwSetMouseButtonCallback(window, ImGui_ImplGlfw_MouseButtonCallback);
glfwSetCursorPosCallback(window, ImGui_ImplGlfw_CursorPosCallback);
glfwSetScrollCallback(window, ImGui_ImplGlfw_ScrollCallback);
while (!glfwWindowShouldClose(window)) {
// Poll events
glfwPollEvents();
// Start new ImGui frame
ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
// Render ImGui UI
ImGui::Begin("Hello, ImGui!");
ImGui::Text("This is ImGui rendered with OpenGL 2.x");
if (ImGui::Button("Exit")) {
glfwSetWindowShouldClose(window, GLFW_TRUE);
}
ImGui::End();
// Clear OpenGL screen
glClearColor(0.45f, 0.55f, 0.60f, 1.00f);
glClear(GL_COLOR_BUFFER_BIT);
// Render ImGui
ImGui::Render();
ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
// Swap buffers
glfwSwapBuffers(window);
}
// Cleanup
ImGui_ImplOpenGL2_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
glfwTerminate();
return0;
}
heres the full code