Page 1 of 1

Mouse cursor never rendered

Posted: Mon Dec 16, 2019 19:13
by armedturret
While trying to implement CEGUI in my OpenGl and SDL based render engine, I came across the problem that the mouse cursor wouldn't render. I am testing on x64 build with a shared lib. I was able to get the inputs and the TaharezLookOverview.layout to work completely minus the aforementioned cursor.

Here is my GUI file that initializes everything:

Code: Select all

void GUI::setDefaultDirectory(std::string directory)
{
   //set a resource provider for loading CEGUI files
   CEGUI::DefaultResourceProvider* rp = static_cast<CEGUI::DefaultResourceProvider*>(CEGUI::System::getSingleton().getResourceProvider());

   //define all the default values
   rp->setResourceGroupDirectory("schemes", directory + "schemes/");
   rp->setResourceGroupDirectory("imagesets", directory + "imagesets/");
   rp->setResourceGroupDirectory("fonts", directory + "fonts/");
   rp->setResourceGroupDirectory("layouts", directory + "layouts/");
   rp->setResourceGroupDirectory("looknfeels", directory + "looknfeel/");
   rp->setResourceGroupDirectory("lua_scripts", directory + "lua_scripts/");

   //apply them to respective subsystems
   CEGUI::ImageManager::setImagesetDefaultResourceGroup("imagesets");
   CEGUI::Font::setDefaultResourceGroup("fonts");
   CEGUI::Scheme::setDefaultResourceGroup("schemes");
   CEGUI::WidgetLookManager::setDefaultResourceGroup("looknfeels");
   CEGUI::WindowManager::setDefaultResourceGroup("layouts");
   CEGUI::ScriptModule::setDefaultResourceGroup("lua_scripts");
}

void GUI::destroy()
{
   CEGUI::System::destroy();
   CEGUI::OpenGL3Renderer::destroy(*m_renderer);
}

void GUI::init()
{
   //init CEGUI
   m_renderer = &CEGUI::OpenGL3Renderer::bootstrapSystem();
}


I have a render loop for my program:

Code: Select all

m_currentScreen->render();

glBindTexture(GL_TEXTURE0, 0);
glUseProgram(0);
glActiveTexture(GL_TEXTURE0);
//render GUI
CEGUI::System::getSingleton().renderAllGUIContexts();
m_window.swapBuffers();


And here is where I set up what gui I want to display:

Code: Select all

GUI::getInstance().setDefaultDirectory("./resources/gui/");
//load a default scheme
CEGUI::SchemeManager::getSingleton().createFromFile("TaharezLook.scheme");
CEGUI::SchemeManager::getSingleton().createFromFile("Generic.scheme");
CEGUI::FontManager::getSingleton().createFromFile("DejaVuSans-10.font");
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultFont("DejaVuSans-10");
//set a default mouse
CEGUI::System::getSingleton().getDefaultGUIContext().getMouseCursor().setDefaultImage("TaharezLook/MouseArrow");
CEGUI::System::getSingleton().getDefaultGUIContext().setDefaultTooltipType("TaharezLook/Tooltip");

CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
CEGUI::Window* myRoot = wmgr.loadLayoutFromFile("TaharezLookOverview.layout");
CEGUI::System::getSingleton().getDefaultGUIContext().setRootWindow(myRoot);


I have remembered to do all the required input injection including the pulse every frame here:

Code: Select all

float time = (float)(SDL_GetTicks() - m_lastUpdate) / 1000.0f;
context.injectTimePulse(time);
CEGUI::System::getSingleton().injectTimePulse(time);

m_lastUpdate = SDL_GetTicks();


Any help would be greatly appreciated as to how the cursor is not rendering in any way.

Here is the log info as well:

Code: Select all

16/12/2019 14:10:56 (Std)    ---- Version: 0.8.7 (Build: Dec 13 2019 Debug Microsoft Windows MSVC++ Unknown MSVC++ version 64 bit) ----
16/12/2019 14:10:56 (Std)    ---- Renderer module is: CEGUI::OpenGL3Renderer - Official OpenGL 3.2 core based renderer module.  TextureTarget support enabled via FBO OGL 3.2 core implementation. ----
16/12/2019 14:10:56 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
16/12/2019 14:10:56 (Std)    ---- Image Codec module is: SILLYImageCodec - Official SILLY based image codec ----
16/12/2019 14:10:56 (Std)    ---- Scripting module is: None ----

Re: Mouse cursor never rendered

Posted: Mon Dec 16, 2019 19:14
by armedturret
Oh, I forgot to mention that I used an OpenGL debugger to test if the mouse was hidden and found there was no attempt anywhere to render it.

Re: Mouse cursor never rendered

Posted: Thu Dec 26, 2019 00:26
by Ident
Sorry for the late response:

Do you inject the mouse position?

Does it work in the sample browser?

Have you tried looking at the application templates (might only exist on default branch afaik) for comparison? This might help