OGRECave / ogre-imgui

Now in the main repository as part of Overlay

Home Page:https://github.com/OGRECave/ogre

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Example gives ImGui::NewFrame(): Assertion `(g.IO.DeltaTime > 0.0f ...

andymass opened this issue · comments

Thanks for maintaining OGRE and this binding. I'm new to imgui and having trouble just using the simple Example. I vaguely understand what the error message is saying, but I'm not sure what the proper fix is or if something is wrong with my configuration. I assume the example should work without modification.

System:

archlinux 4.19.45-1-lts
KDE plasma
RenderSystem Name: OpenGL Rendering Subsystem
GPU Vendor: intel
Device Name: Mesa DRI Intel(R) HD Graphics 620 (Kaby Lake GT2) 
Driver Version: 3.0.0.0
community/ogre 1.12.0-1 [installed]
    Scene-oriented, flexible 3D engine written in C++
community/ois 1.5-1 [installed]
    Object Oriented Input System

Steps:

git clone https://github.com/OGRECave/ogre-imgui.git
cd ogre-imgui
git submodule update --init --recursive
mkdir build && cd build
cmake ../
make

Result:

Example: imgui/imgui.cpp:3435: void ImGui::NewFrame(): Assertion `(g.IO.DeltaTime > 0.0f || g.FrameCount == 0) && "Need a positive DeltaTime!"' failed.

Tried:

--- a/Example.cpp
+++ b/Example.cpp
@@ -12,6 +12,9 @@ public:

     bool frameStarted(const Ogre::FrameEvent& evt)
     {
+        if (evt.timeSinceLastFrame == 0.0f)
+            return true;
+
         OgreBites::ApplicationContext::frameStarted(evt);

         Ogre::ImguiManager::getSingleton().newFrame(

This does seem to make the assertion go away, but is this a valid fix? What should be done when timeSinceLastFrame == 0? Note that <= 0.0f did not work, causing Assertion g.FrameScopeActive && "Forgot to call ImGui::NewFrame()?"' failed. Thanks.

probably we should do what ocornut/imgui@3c07ec6 says, which is the commit introducing the assertion

Thanks for the pointer and fast response! That did fix the issue in my case.