i am tring to bind Urho3D to Qt widgets and it works.
i created Qt Mainwindow with two widgets the center widgets is the window used by Urho3d rendering and the second is just a list widgets.
for Urho3d widgets i use the Hello example which display only a text.
the problem I have i that when resizing window the Urho3d widgets flickert and i don’t know why?
any idea which can case this?
the following code is what i use to initialized the render
int URHO3DWidget::Run() {
MainWindow->createDockWindows();
VariantMap engineParameters;
engineParameters[Urho3D::EP_FRAME_LIMITER] = false;
engineParameters[Urho3D::EP_RESOURCE_PATHS] = "CoreData;Data";
engineParameters[Urho3D::EP_LOG_NAME] = "URHO3DWidget.log";
engineParameters[Urho3D::EP_EXTERNAL_WINDOW] = (void*)(MainWindow->centralWidget()->winId());
engineParameters[Urho3D::EP_WINDOW_RESIZABLE] = true;
engineParameters[Urho3D::EP_FULL_SCREEN] = false;
if (!engine->Initialize(engineParameters))
return -1;
QTimer timer;
connect(&timer, SIGNAL(timeout()), this, SLOT(OnTimeout()));
timer.start(0);
ResourceCache* cache = GetSubsystem<ResourceCache>();
// Construct new Text object
SharedPtr<Text> helloText(new Text(context_));
// Set String to display
helloText->SetText("Hello World from Urho3D!");
// Set font and text color
helloText->SetFont(cache->GetResource<Font>("Fonts/Anonymous Pro.ttf"), 30);
helloText->SetColor(Color(0.0f, 1.0f, 0.0f));
// Align Text center-screen
helloText->SetHorizontalAlignment(HA_CENTER);
helloText->SetVerticalAlignment(VA_CENTER);
// Add Text instance to the UI root element
GetSubsystem<UI>()->GetRoot()->AddChild(helloText);
QSize s(800, 600);
MainWindow->setMinimumSize(s);
MainWindow->show();
return QApplication::exec();
}
the timer function do the following
void URHO3DWidget::OnTimeout()
{
if (engine && !engine->IsExiting()) {
engine->RunFrame();
}
}