Files
Osmium/Osmium.cpp

102 lines
1.7 KiB
C++
Raw Normal View History

2025-07-15 03:08:42 +03:00
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
2025-07-15 19:43:51 +03:00
#include <imgui.h>
#include <imgui_impl_glfw.h>
#include <imgui_impl_opengl3.h>
2025-07-15 03:08:42 +03:00
int main(int argc, char **argv) {
std::cout << "Hello working!" << std::endl;
2025-07-15 19:43:51 +03:00
2025-07-15 03:08:42 +03:00
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
2025-07-15 19:43:51 +03:00
glfwWindowHint(GLFW_DECORATED, GLFW_FALSE);
2025-07-15 03:08:42 +03:00
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
2025-07-15 19:43:51 +03:00
//make the window
2025-07-15 03:08:42 +03:00
GLFWwindow *window = glfwCreateWindow(640, 480, "OpenGL Demo", NULL, NULL);
if (!window) {
std::cout << "Failed to create GLFW window." << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
//d
2025-07-15 19:43:51 +03:00
//load graphics
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cerr << "Failed to initialize OpenGL loader!" << std::endl;
return -1;
}
glViewport(0, 0, 640, 480);
//d
2025-07-15 19:43:51 +03:00
//now make ImGui
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 130");
///im a dumbass
///d
2025-07-15 19:43:51 +03:00
2025-07-15 03:08:42 +03:00
2025-07-15 19:43:51 +03:00
2025-07-15 03:08:42 +03:00
//program
2025-07-15 03:08:42 +03:00
while (!glfwWindowShouldClose(window)) {
glClearColor(1.0f,.5f,.2f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
2025-07-15 03:08:42 +03:00
glfwPollEvents();
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
ImGui::BeginMainMenuBar();
if (ImGui::BeginMenu("File")) {
ImGui::MenuItem("Exit");
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
ImGui::Begin("Editor");
ImGui::Text("Hello from editor");
ImGui::End();
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
glfwSwapBuffers(window);
2025-07-15 03:08:42 +03:00
}
glfwDestroyWindow(window);
glfwTerminate();
return 0;
}