- Keyboarder
- Posts: 21
- Joined:
Re: c++ initialization
We are trying to make NoesisGui wrapper for Qt now and got into a problem.
The test wrapper is being built upon Qt OpenGL example code: https://doc.qt.io/qt-5/qtgui-openglwindow-example.html.
The app runs with very high CPU usage and crashes when closing. Do you have any suggestions on how to overcome this problem?
The test wrapper is being built upon Qt OpenGL example code: https://doc.qt.io/qt-5/qtgui-openglwindow-example.html.
The app runs with very high CPU usage and crashes when closing. Do you have any suggestions on how to overcome this problem?
Code: Select all
// NoesisGUI v1.3.0b4
// main.cpp
QGuiApplication a(argc, argv);
Noesis::GUI::Init(...);
QNoesisWindow w;
w.show();
a.exec();
//QNoesisWIndow.h
class QNoesisWindow : public OpenGLWindow ...
// QNoesisWIndow.cpp
QNoesisWindow::~QNoesisWindow() // Problem
{
m_view.Reset(); // Crashes or does not finish with high CPU usage
Noesis::GUI::Shutdown();
}
QNoesisWindow::QNoesisWindow(QWindow* parent): OpenGLWindow(parent), m_frame(0)
{
setAnimating(true);
Noesis::GUI::SetResourceProvider("Data");
m_root = Noesis::GUI::LoadXaml<Noesis::UserControl>("test.xaml");
m_view = Noesis::GUI::CreateView(m_root.GetPtr());
m_view->SetAntialiasingMode(Noesis::Gui::AntialiasingMode_PPAA);
m_view->SetSize(this->width(), this->height());
}
void QNoesisWindow::initialize()
{
Noesis::Core::Ptr<GLRenderDevice> device = *new GLRenderDevice();
Noesis::Core::Ptr<Noesis::VGContext> context = Noesis::GUI::CreateVGContext(device.GetPtr(), Noesis::VGOptions());
m_view->GetRenderer()->Init(context.GetPtr());
.....
}
void QNoesisWindow::render()
{
m_view->Update(m_frame / screen()->refreshRate());
Noesis::IRenderer* renderer = m_view->GetRenderer();
renderer->UpdateRenderTree();
if (renderer->NeedsOffscreen()) {
renderer->RenderOffscreen();
}
glColorMask(true, true, true, true);
glClearStencil(0);
glClear(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
const qreal retinaScale = devicePixelRatio();
glViewport(0, 0, width() * retinaScale, height() * retinaScale);
renderer->Render(); // high CPU usage (qt runs it in main thread)
m_frame++;
}
Re: c++ initialization
Can we please move to a new thread?
Also I need more information about the crash. Is the rendering output correct?
Also I need more information about the crash. Is the rendering output correct?
Who is online
Users browsing this forum: Ahrefs [Bot] and 2 guests