trying to improve imshow code
continuous-integration/drone/push Build encountered an error Details

master
Yorick GEOFFRE 3 years ago
parent ddaca8978e
commit 24fa169f3f

@ -626,6 +626,7 @@ CMakeFiles/prog.dir/main.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
/home/kanken/code/AHRS_core/src/pipeline/members/uiDrawerNode.hpp
/home/kanken/code/AHRS_core/src/model/controllers/ui/uiController.hpp
/home/kanken/code/AHRS_core/src/model/hardware/psvr/_psvr.hpp
@ -1261,6 +1262,7 @@ CMakeFiles/prog.dir/topLevelManager.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
/home/kanken/code/AHRS_core/src/pipeline/members/uiDrawerNode.hpp
/home/kanken/code/AHRS_core/src/model/controllers/ui/uiController.hpp
/home/kanken/code/AHRS_core/src/model/hardware/psvr/_psvr.hpp

@ -625,6 +625,7 @@ CMakeFiles/prog.dir/main.cpp.o: main.cpp \
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h \
threadweaver/debugging.hpp \
pipeline/members/uiDrawerNode.hpp \
model/controllers/ui/uiController.hpp \
model/hardware/psvr/_psvr.hpp \
@ -1259,6 +1260,7 @@ CMakeFiles/prog.dir/topLevelManager.cpp.o: topLevelManager.cpp \
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h \
threadweaver/debugging.hpp \
pipeline/members/uiDrawerNode.hpp \
model/controllers/ui/uiController.hpp \
model/hardware/psvr/_psvr.hpp \

@ -323,6 +323,8 @@ model/windows/CMakeFiles/windows.dir/window.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
/usr/include/c++/11/iostream
model/windows/CMakeFiles/windows.dir/windowManager.cpp.o
/home/kanken/code/AHRS_core/src/model/windows/windowManager.cpp
@ -647,6 +649,8 @@ model/windows/CMakeFiles/windows.dir/windowManager.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
/usr/include/c++/11/iostream
/usr/include/c++/11/thread
/usr/include/c++/11/bits/std_thread.h
/usr/include/c++/11/bits/this_thread_sleep.h

@ -321,7 +321,9 @@ model/windows/CMakeFiles/windows.dir/window.cpp.o: model/windows/window.cpp \
/usr/include/GL/gl.h \
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h
/usr/include/GL/glu.h \
threadweaver/debugging.hpp \
/usr/include/c++/11/iostream
model/windows/CMakeFiles/windows.dir/windowManager.cpp.o: model/windows/windowManager.cpp \
/usr/include/stdc-predef.h \
@ -645,6 +647,8 @@ model/windows/CMakeFiles/windows.dir/windowManager.cpp.o: model/windows/windowMa
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h \
threadweaver/debugging.hpp \
/usr/include/c++/11/iostream \
/usr/include/c++/11/thread \
/usr/include/c++/11/bits/std_thread.h \
/usr/include/c++/11/bits/this_thread_sleep.h
@ -652,6 +656,8 @@ model/windows/CMakeFiles/windows.dir/windowManager.cpp.o: model/windows/windowMa
model/windows/windowManager.cpp:
threadweaver/debugging.hpp:
/usr/include/GL/glu.h:
/usr/include/KHR/khrplatform.h:
@ -1246,6 +1252,8 @@ model/windows/window.cpp:
/usr/include/x86_64-linux-gnu/bits/fp-logb.h:
/usr/include/c++/11/iostream:
/usr/include/c++/11/bits/node_handle.h:
/usr/include/x86_64-linux-gnu/bits/fp-fast.h:

@ -1,5 +1,24 @@
#include "window.hpp"
void glDrawTextureCallback(void* userdata)
{
cv::ogl::Texture2D* texObj = static_cast<cv::ogl::Texture2D*>(userdata);
cv::ogl::render(*texObj);
}
Window::Window(std::string windowName){
this->myWindow = windowName;
}
void Window::glInit(){
cv::namedWindow(this->myWindow, cv::WINDOW_OPENGL);
setWindowProperty(this->myWindow, cv::WND_PROP_FULLSCREEN, cv::WINDOW_FULLSCREEN);
cv::setOpenGlContext(this->myWindow);
cv::moveWindow(this->myWindow, DEFAULT_UI_OFFSET_X + 960, DEFAULT_UI_OFFSET_Y);
cv::setOpenGlContext(this->myWindow);
cv::setOpenGlDrawCallback(this->myWindow, glDrawTextureCallback, &this->drawTexture);
}
void Window::draw(){
try{
drawAccess.lock();
@ -12,7 +31,7 @@ void Window::draw(){
#ifdef OGLWIN
drawTexture.copyFrom(drawBuffer);
cv::imshow(this->myWindow, this->drawTexture);
cv::updateWindow(this->myWindow);
#else
cv::imshow(this->myWindow, drawBuffer);
#endif
@ -20,5 +39,6 @@ void Window::draw(){
}
catch(...){
drawAccess.unlock();
std::cout << "Caught draw window thread exception" << std::endl;
}
}

@ -10,10 +10,12 @@
class Window
{
public:
Window(std::string windowName);
cv::UMat drawSurface; // Current frame
cv::ogl::Texture2D drawTexture = cv::ogl::Texture2D();
int id;
std::mutex drawAccess;
std::string myWindow;
void draw();
void glInit();
};

@ -3,16 +3,18 @@
// initializes the ui manager, following default values
WindowManager::WindowManager()
{
try{
uiShouldRun = false;
for (int i = 0; i < DEFAULT_UI_WINDOW_AMOUNT; i++)
{
Window *newWindow = new Window();
newWindow->myWindow = "project- UI" + std::to_string(i);
Window *newWindow;
std::string name = "project- UI" + std::to_string(i);
#ifndef OGLWIN
cv::namedWindow(newWindow->myWindow); //if we're in opengl mode, the window needs to be created in the same thread as the execution, not here
cv::namedWindow(name); //if we're in opengl mode, the window needs to be created in the same thread as the execution, not here
cv::moveWindow(name, DEFAULT_UI_OFFSET_X + i * 960, DEFAULT_UI_OFFSET_Y);
cv::resizeWindow(name, DEFAULT_UI_SIZE_X, DEFAULT_UI_SIZE_Y);
#endif
cv::moveWindow(newWindow->myWindow, DEFAULT_UI_OFFSET_X + i * 960, DEFAULT_UI_OFFSET_Y);
cv::resizeWindow(newWindow->myWindow, DEFAULT_UI_SIZE_X, DEFAULT_UI_SIZE_Y);
newWindow = new Window(name);
//cout << "window: " << newWindow->myWindow << " created at " << DEFAULT_UI_OFFSET_X + i * 960 << " , " << DEFAULT_UI_OFFSET_Y << endl;
@ -21,6 +23,10 @@
managedUIs.push_back(newWindow); // add new ui in the ui map, mapped to the window's name
}
uiShouldRun = true;
}
catch(std::exception& e){
std::cerr << "\033[1;31m caught windowManager::WindowManager thread exception: " << e.what() <<" \033[0m" << std::endl;
}
}
void WindowManager::cleanup()

@ -1308,6 +1308,7 @@ pipeline/CMakeFiles/pipelineLib.dir/members/displayOutputNode.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
pipeline/CMakeFiles/pipelineLib.dir/members/subNodes/fpsCounter.cpp.o
/home/kanken/code/AHRS_core/src/pipeline/members/subNodes/fpsCounter.cpp
@ -4647,6 +4648,7 @@ pipeline/CMakeFiles/pipelineLib.dir/pipeline.cpp.o
/usr/include/GL/glext.h
/usr/include/KHR/khrplatform.h
/usr/include/GL/glu.h
/home/kanken/code/AHRS_core/src/threadweaver/debugging.hpp
/home/kanken/code/AHRS_core/src/pipeline/members/uiDrawerNode.hpp
/home/kanken/code/AHRS_core/src/model/controllers/ui/uiController.hpp
/home/kanken/code/AHRS_core/src/model/hardware/psvr/_psvr.hpp

@ -1304,7 +1304,8 @@ pipeline/CMakeFiles/pipelineLib.dir/members/displayOutputNode.cpp.o: pipeline/me
/usr/include/GL/gl.h \
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h
/usr/include/GL/glu.h \
threadweaver/debugging.hpp
pipeline/CMakeFiles/pipelineLib.dir/members/subNodes/fpsCounter.cpp.o: pipeline/members/subNodes/fpsCounter.cpp \
/usr/include/stdc-predef.h \
@ -4637,6 +4638,7 @@ pipeline/CMakeFiles/pipelineLib.dir/pipeline.cpp.o: pipeline/pipeline.cpp \
/usr/include/GL/glext.h \
/usr/include/KHR/khrplatform.h \
/usr/include/GL/glu.h \
threadweaver/debugging.hpp \
pipeline/members/uiDrawerNode.hpp \
model/controllers/ui/uiController.hpp \
model/hardware/psvr/_psvr.hpp \

@ -16,10 +16,7 @@ void DisplayOutputNode::processFrame()
{
#ifdef OGLWIN
DEBUG_LOG("DisplayOutputNode on thread " << localThread->get_id() << " is creating its opengl UI");
cv::namedWindow(_managed->myWindow, cv::WINDOW_OPENGL);
setWindowProperty(_managed->myWindow, cv::WND_PROP_FULLSCREEN, cv::WINDOW_FULLSCREEN);
cv::setOpenGlContext(_managed->myWindow);
cv::moveWindow(_managed->myWindow, DEFAULT_UI_OFFSET_X + 960, DEFAULT_UI_OFFSET_Y);
_managed->glInit();
DEBUG_LOG("DisplayOutputNode on thread " << localThread->get_id() << " is done creating its opengl UI");
#endif
inited = true;

Binary file not shown.
Loading…
Cancel
Save