mirror of
https://github.com/ciphervance/supercell-wx.git
synced 2025-10-30 08:20:05 +00:00
Connect ImGui render to QOpenGLWidgets
This commit is contained in:
parent
3c69ad28c6
commit
dd1b4f27c8
4 changed files with 76 additions and 6 deletions
|
|
@ -13,6 +13,8 @@
|
|||
#include <scwx/util/threads.hpp>
|
||||
#include <scwx/util/time.hpp>
|
||||
|
||||
#include <backends/imgui_impl_opengl3.h>
|
||||
#include <imgui.h>
|
||||
#include <QApplication>
|
||||
#include <QColor>
|
||||
#include <QDebug>
|
||||
|
|
@ -682,10 +684,24 @@ void MapWidget::initializeGL()
|
|||
void MapWidget::paintGL()
|
||||
{
|
||||
p->frameDraws_++;
|
||||
|
||||
// Setup ImGui Frame
|
||||
ImGui::GetIO().DisplaySize = {static_cast<float>(size().width()),
|
||||
static_cast<float>(size().height())};
|
||||
|
||||
// Start ImGui Frame
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGui::NewFrame();
|
||||
|
||||
// Render QMapLibreGL Map
|
||||
p->map_->resize(size());
|
||||
p->map_->setFramebufferObject(defaultFramebufferObject(),
|
||||
size() * pixelRatio());
|
||||
p->map_->render();
|
||||
|
||||
// Render ImGui Frame
|
||||
ImGui::Render();
|
||||
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
|
||||
}
|
||||
|
||||
void MapWidget::mapChanged(QMapLibreGL::Map::MapChange mapChange)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue