mirror of
https://github.com/gnif/LookingGlass.git
synced 2025-10-18 13:28:09 +00:00
[client] imgui: added imgui to the client and OpenGL/EGL renderers
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
project(renderer_Opengl LANGUAGES C)
|
||||
project(renderer_Opengl LANGUAGES C CXX)
|
||||
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
|
||||
@@ -8,12 +8,17 @@ pkg_check_modules(RENDERER_OPENGL_PKGCONFIG REQUIRED
|
||||
|
||||
add_library(renderer_OpenGL STATIC
|
||||
opengl.c
|
||||
${PROJECT_TOP}/repos/cimgui/imgui/backends/imgui_impl_opengl2.cpp
|
||||
)
|
||||
|
||||
target_compile_definitions(renderer_OpenGL PRIVATE CIMGUI_DEFINE_ENUMS_AND_STRUCTS=1)
|
||||
|
||||
target_link_libraries(renderer_OpenGL
|
||||
${RENDERER_OPENGL_PKGCONFIG_LIBRARIES}
|
||||
lg_common
|
||||
fonts
|
||||
|
||||
cimgui
|
||||
)
|
||||
|
||||
target_include_directories(renderer_OpenGL
|
||||
|
@@ -29,6 +29,9 @@
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
|
||||
#include "cimgui.h"
|
||||
#include "generator/output/cimgui_impl.h"
|
||||
|
||||
#include "common/debug.h"
|
||||
#include "common/option.h"
|
||||
#include "common/framebuffer.h"
|
||||
@@ -272,6 +275,8 @@ void opengl_deinitialize(void * opaque)
|
||||
|
||||
if (this->renderStarted)
|
||||
{
|
||||
ImGui_ImplOpenGL2_Shutdown();
|
||||
|
||||
glDeleteLists(this->texList , BUFFER_COUNT);
|
||||
glDeleteLists(this->mouseList, 1);
|
||||
glDeleteLists(this->fpsList , 1);
|
||||
@@ -581,6 +586,13 @@ bool opengl_render_startup(void * opaque)
|
||||
this->hasTextures = true;
|
||||
|
||||
app_glSetSwapInterval(this->opt.vsync ? 1 : 0);
|
||||
|
||||
if (!ImGui_ImplOpenGL2_Init())
|
||||
{
|
||||
DEBUG_ERROR("Failed to initialize ImGui");
|
||||
return false;
|
||||
}
|
||||
|
||||
this->renderStarted = true;
|
||||
return true;
|
||||
}
|
||||
@@ -690,6 +702,12 @@ bool opengl_render(void * opaque, LG_RendererRotate rotate)
|
||||
break;
|
||||
}
|
||||
|
||||
if (app_renderImGui())
|
||||
{
|
||||
ImGui_ImplOpenGL2_NewFrame();
|
||||
ImGui_ImplOpenGL2_RenderDrawData(igGetDrawData());
|
||||
}
|
||||
|
||||
if (this->opt.preventBuffer)
|
||||
{
|
||||
app_glSwapBuffers();
|
||||
|
Reference in New Issue
Block a user