Compare commits

..

No commits in common. "acffb63d7cc5d712ebe8836e058b37a5762e380c" and "b8c92689118d837e1d6be71e01a7c527ba181c1e" have entirely different histories.

5 changed files with 20 additions and 67 deletions

View file

@ -54,12 +54,7 @@ elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(LINKER_OPTIMIZED_OPTIONS ${LINKER_OPTIMIZED_OPTIONS} -fdevirtualize-at-ltrans)
endif ()
add_library(${PROJECT_NAME} SHARED
src/window.cpp
src/context_window.cpp
src/opengl_context.cpp
include/opengl_context.hpp
)
add_library(${PROJECT_NAME} SHARED src/window.cpp src/context_window.cpp)
target_precompile_headers(${PROJECT_NAME} PUBLIC include/window.hpp include/basic_data.hpp include/context_window.hpp)
target_include_directories(${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@ -97,13 +92,7 @@ configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/windowGlfwGlLibTargets
)
install(FILES
include/window.hpp
include/basic_data.hpp
include/context_window.hpp
include/opengl_context.hpp
DESTINATION include/windowGlfwGlLib
)
install(FILES include/window.hpp include/basic_data.hpp DESTINATION include/windowGlfwGlLib)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/windowGlfwGlLibTargetsConfig.cmake"

View file

@ -1,16 +0,0 @@
//
// Created by postaron on 05/01/2026.
//
#ifndef WINDOWGLFWGLLIB_OPENGL_CONTEXT_HPP
#define WINDOWGLFWGLLIB_OPENGL_CONTEXT_HPP
namespace gui {
class Window;
}
namespace opengl {
[[nodiscard]] bool init_glew(const gui::Window &win) noexcept;
}
#endif //WINDOWGLFWGLLIB_OPENGL_CONTEXT_HPP

View file

@ -16,8 +16,6 @@ namespace gui {
public:
using modulesType = std::unordered_map<std::string, data::BasicData *>;
using windowPtr = GLFWwindow *;
static constexpr int default_width{ 1280 };
static constexpr int default_height{ 720 };
private:
static void key_callback(GLFWwindow *window, int key, int scancode, int action, int mods);
@ -34,6 +32,8 @@ namespace gui {
modulesType modules;
bool valid{ false };
explicit Window(const bool debugOpengl,
const GLFWframebuffersizefun framebufferCallback,
GLFWwindow *shared,
@ -76,7 +76,7 @@ namespace gui {
void color_10_bits() noexcept;
[[nodiscard]] bool check_color_depth(int color_depth) noexcept;
bool check_color_depth(int color_depth) noexcept;
void opengl_debug() noexcept;
}

View file

@ -1,33 +0,0 @@
//
// Created by postaron on 05/01/2026.
//
#include <GL/glew.h>
#if defined( _WIN32 )
#include <GL/wglew.h>
#endif
#include "opengl_context.hpp"
#include <iostream>
#include "window.hpp"
bool opengl::init_glew(const gui::Window &win) noexcept {
win.get_context();
if (const GLenum error = glewInit(); error != GLEW_OK) {
if (const auto error_callback = glfwSetErrorCallback(nullptr); error_callback != nullptr) {
error_callback(0, reinterpret_cast<const char *>(glewGetErrorString(error)));
glfwSetErrorCallback(error_callback);
} else {
std::cerr << "Error initializing glew: "
<< reinterpret_cast<const char *>(glewGetErrorString(error))
<< std::endl;
}
return false;
}
return true;
}

View file

@ -19,10 +19,23 @@ namespace gui {
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, debugOpengl ? GLFW_TRUE : GLFW_FALSE);
wwindow = std::unique_ptr<GLFWwindow, decltype(&glfwDestroyWindow)>(
glfwCreateWindow(1280, 720, "Billy Sheet tracker", nullptr, shared),
glfwCreateWindow(720, 1280, "Billy Sheet tracker", nullptr, shared),
glfwDestroyWindow);
if (!wwindow) {
valid = false;
return;
}
glfwMakeContextCurrent(wwindow.get());
glewExperimental = true;
if (const GLenum error = glewInit(); error != GLEW_OK) {
valid = false;
if (const auto error_callback = glfwSetErrorCallback(nullptr); error_callback != nullptr) {
error_callback(0, reinterpret_cast<const char *>(glewGetErrorString(error)));
glfwSetErrorCallback(error_callback);
}
return;
}
valid = true;
glfwSetFramebufferSizeCallback(wwindow.get(),
framebufferCallback != nullptr ? framebufferCallback : internalFramebufferCallback);