Skip to content

Commit

Permalink
Merge pull request hku-ect#344 from sphaero/prepv1
Browse files Browse the repository at this point in the history
Preparing v1 release
  • Loading branch information
ikbenmacje authored Jul 12, 2024
2 parents bcbcfee + c710a7e commit c2f9357
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
23 changes: 4 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ option (WITH_IMGUI_DEMO "Enable ImGUI demo console" ON)
option (WITH_EMBED_PYTHON "Embed the python interpreter, otherwise use system installed" OFF)
option (WITH_OPENVR "Enable OpenVR support" ON)
option (WITH_DMX "Enable DMX support" ON)
option (RPI "Build for the Raspberry PI" OFF)
### END SET OPTIONS

### EXTERNAL LIBS
Expand All @@ -82,17 +83,11 @@ add_subdirectory("ext/rtmidi" EXCLUDE_FROM_ALL)
# include(CheckIncludeFile)
# CHECK_INCLUDE_FILE(/opt/vc/include/bcm_host.h RPI) # doesn't work :S
# Just check if the file is there
if (EXISTS "/opt/vc/include/bcm_host.h")
if (RPI)
message(STATUS "Enabling building for the Raspberry Pi")
set(RPI "ON")
add_definitions(-DIMGUI_IMPL_OPENGL_ES2)
set(WITH_OPENVR "OFF")
endif(EXISTS "/opt/vc/include/bcm_host.h")
if (EXISTS "/usr/include/bcm_host.h")
message(STATUS "Enabling building for the Raspberry Pi on Raspberry Pi OS")
set(RPI4 "ON")
add_definitions(-DIMGUI_IMPL_OPENGL_ES2)
endif(EXISTS "/usr/include/bcm_host.h")
endif(RPI)

# External system libraries through find_package
find_package(libzmq REQUIRED)
Expand Down Expand Up @@ -164,7 +159,7 @@ if(WITH_DMX)
endif(WITH_DMX)

### PROJECT SOURCES
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR}/actors ACTOR_SOURCES)
file (GLOB ACTOR_SOURCES CONFIGURE_DEPENDS actors/*.h actors/*.c actors/*.cpp actors/*.hpp)

# get git version
include(GitVersion)
Expand Down Expand Up @@ -347,16 +342,6 @@ elseif (RPI)
sphactor-static
rtmidi
${Python3_LIBRARIES}
-lasound -ldl -L/opt/vc/lib -lbrcmGLESv2)
target_compile_options(gazebosc PUBLIC -D__LINUX_ALSA__ )
elseif (RPI4)
list(APPEND DIRS "${CMAKE_CURRENT_SOURCE_DIR}/ext/openvr/bin/linuxarm64")
target_link_libraries(gazebosc PUBLIC
SDL2-static
sphactor-static
rtmidi
${OPENVR_LIBRARIES}
${Python3_LIBRARIES}
-lasound -ldl -lGLESv2)
target_compile_options(gazebosc PUBLIC -D__LINUX_ALSA__ )
else()
Expand Down
16 changes: 16 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,22 @@ ImGuiIO& ImGUIInit(SDL_Window* window, SDL_GLContext* gl_context, const char* gl
//io.Fonts->AddFontFromFileTTF("../../misc/fonts/ProggyTiny.ttf", 10.0f);
//ImFont* font = io.Fonts->AddFontFromFileTTF("c:\\Windows\\Fonts\\ArialUni.ttf", 18.0f, NULL, io.Fonts->GetGlyphR>
//IM_ASSERT(font != NULL);
#if defined(IMGUI_IMPL_OPENGL_ES2) // For the RPI
ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* {
GLuint tex;
glGenTextures(1, &tex);
glBindTexture(GL_TEXTURE_2D, tex);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
glGenerateMipmap(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, 0);

return (void*)tex;
};
#else
// ImFileDialog requires you to set the CreateTexture and DeleteTexture
ifd::FileDialog::Instance().CreateTexture = [](uint8_t* data, int w, int h, char fmt) -> void* {
GLuint tex;
Expand All @@ -582,6 +597,7 @@ ImGuiIO& ImGUIInit(SDL_Window* window, SDL_GLContext* gl_context, const char* gl

return (void*)tex;
};
#endif
ifd::FileDialog::Instance().DeleteTexture = [](void* tex) {
GLuint texID = (GLuint)((uintptr_t)tex);
glDeleteTextures(1, &texID);
Expand Down

0 comments on commit c2f9357

Please sign in to comment.