From the journal of the Windows Alchemist ...

Problems building or running the engine, queries about how to use features etc.
User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

From the journal of the Windows Alchemist ...

Post by paul424 »

Ogre Version: : 1 13 6 5:
Operating System: :Windows 11:
Render System: :OpenGL3+

Finally I have built the fresh opendungeons-plus binary for Windows. I have for sure all DLL's needed. But to the point : when the binary is RUN I get MessageBox saying that Ogre::Exception has occured at Ogre::createResource() assertion failed : resource name cannot be empty. I understand that. But Why is that ? Why on the Linux it goes fine , while on Windows it tries to create a resource without name , when the game's resources are the same on both systems ?
Would love to debug, but my MSVSC skills too poor .... How do I start the binary in debug mode of this env. ? I have built the project to fresh directory say opendungeons-plus-2026 and when I press the button RUN DEBUG I get some file not found .....

Code: Select all

 ( Unable  to start the program : C:\OpenDungeonsPlus-2026\x64\RelWithDebInfo\ALL_BUILD' Access Denied)

. Please help cause I would love to see the backtrace of the program when the exception occurs.

Last edited by paul424 on Sun Jan 11, 2026 4:52 pm, edited 1 time in total.
rpgplayerrobin
Bugbear
Posts: 803
Joined: Wed Mar 18, 2009 3:03 am
x 462

Re: Windows Alchemy 2

Post by rpgplayerrobin »

In Visual Studio, you must right click on a project and press "Set as Startup Project", and it seems your current startup project is the ALL_BUILD project, which might be incorrect.

Also, Windows and Linux are very different, since uppercase vs lowercase letters of files might work for one but not the other if they are not exact. For example, if you try in C++ to open a file with fopen and the filename is not exact with its upper/lower-case, it might not work on one platform but it might work on the other.

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: Windows Alchemy 2

Post by paul424 »

OKI thanks, I made some progress again and now I am stuck with CEGUI :
this function seeems to try createResource() with empty name :

Code: Select all

void OgreRenderer::constructor_impl(Ogre::RenderTarget& target)
{
    d_pimpl->d_renderSystem = d_pimpl->d_ogreRoot->getRenderSystem();

d_pimpl->d_displaySize.d_width  = target.getWidth();
d_pimpl->d_displaySize.d_height = target.getHeight();

d_pimpl->d_useGLSLCore = ( d_pimpl->d_renderSystem->getName().compare(0, 8, "OpenGL 3") == 0 ) ;

// create default target & rendering root (surface) that uses it
d_pimpl->d_defaultTarget =
    CEGUI_NEW_AO OgreWindowTarget(*this, *d_pimpl->d_renderSystem, target);

#ifdef CEGUI_USE_OGRE_HLMS
    d_pimpl->d_renderTarget = ⌖
#endif

#if OGRE_VERSION >= 0x10800
    #ifdef CEGUI_USE_OGRE_HLMS
        bool isFixedFunctionEnabled = false;
    // Check if built with RT Shader System and if it is: Check if fixed function pipeline is enabled
    #else
        bool isFixedFunctionEnabled = d_pimpl->d_renderSystem->getCapabilities()->hasCapability(Ogre::RSC_FIXED_FUNCTION);

    d_pimpl->d_material = Ogre::MaterialManager::getSingleton().create(
        "__cegui_internal_material__",
        Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    
    Ogre::Pass* pass = d_pimpl->d_material->getTechnique(0)->getPass(0);
    pass->setLightingEnabled(false);
    pass->setDepthCheckEnabled(false);
    pass->setDepthWriteEnabled(false);
    pass->setCullingMode(Ogre::CULL_NONE);
    pass->setFog(true, Ogre::FOG_NONE);
    pass->setVertexColourTracking(Ogre::TVC_DIFFUSE);
    Ogre::TextureUnitState* tus = pass->createTextureUnitState();
    tus->setTextureFiltering(Ogre::TFO_BILINEAR);
    tus->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP);
    tus->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_DIFFUSE);
    tus->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_TEXTURE, Ogre::LBS_DIFFUSE);

    #ifndef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
        if (!isFixedFunctionEnabled)
            CEGUI_THROW(RendererException("RT Shader System not available but trying to render using OpenGL 3.X+ Core."
            "When GLSL shaders are necessary, the RT Shader System component of Ogre is required for rendering CEGUI."));
    #endif
#endif

// Default to using shaders when that is the sane thing to do.
// We check for use of the OpenGL 3+ Renderer in which case we always wanna (because we have to) use shaders
if (!isFixedFunctionEnabled)
    setUsingShaders(true);
#endif

// hook into the rendering process
#if !defined(CEGUI_USE_OGRE_COMPOSITOR2)
    d_pimpl->d_ogreRoot->addFrameListener(&S_frameListener);
#endif

}

First of all MSVSC seems to be totally confused as where is the execution point : it shows at line :

Code: Select all

        d_pimpl->d_material = Ogre::MaterialManager::getSingleton().create(
            "__cegui_internal_material__",
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

but all code block from #if OGRE_VERSION >= 0x10800 to #endif is in pale gray , suggesting the preprocessor code didn't provide this code piece...
and one more thing : how do I know what;s the OGRE_VERSION under debugging session and other preprocessor constants ? As usual the Windows way of Hoover mouse or CLICK philosophy does not succeed --- it simply shows nothing....

rpgplayerrobin
Bugbear
Posts: 803
Joined: Wed Mar 18, 2009 3:03 am
x 462

Re: Windows Alchemy 2

Post by rpgplayerrobin »

It is hard to say what causes it to crash there, but my guess is that the OgreRenderer::constructor_impl is called from a NULL pointer or that Ogre::MaterialManager::getSingleton() is using a NULL pointer before you use ".create".
Because it showing up as an empty string makes no sense, since it even uses a constant string that is non-empty in your code.

The preprocessors can sometimes show up as incorrect in Visual Studio, but if you debug and it goes into a code, even if it is grayed out because of the preprocessor thingy, it does execute that code. It is just that it shows up as gray visually (incorrectly).

It is sometimes hard to know what value a preprocessor has, for example the ogre version.
Sometimes you can press F12 on it after you have selected it to find it, and sometimes you must if it yourself.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 339
Joined: Fri May 23, 2025 5:04 pm
x 24

Re: Windows Alchemy 2

Post by slapin »

It is easy to check if preprocessor works correctly. Just add line

Code: Select all

#error wtf

into the condition you check (the "grayed" block) and try compiling. if it prints "error: wtf" and compilation stops, the block is used,
if it goes on and not prints that thing - it is not.

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: Windows Alchemy 2

Post by paul424 »

OKi, thanks for all the help in here. I have a running binary by now, except one has to fix the way it finds the maps' files in the main menu..... ( resolve the proper path for it..).

So my next question is : where do I find some cooperative www site or webservice , which would take in my binary for Windows 10/11, so my effort does not go wasted ?

I thought about MajorGeeks.com -- they leave my forum's post without an answer or sourceforge.org --- did anyone had something to deal with them ?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: Windows Alchemy 2

Post by paroj »

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: From the journal of the Windows Alchemist ...

Post by paul424 »

Now it almost works , except the GUI sometimes crashes. the GUI logic seems flawed , when I work with buttons ( clicking it ) there is 50% chance randomly that the application wil crash. That makes some probable that the game would crash after first click into 'Single Player' menu entry or one can as well go through all menus to the actual gameplay. Any idea why is that , apart that something wrong going with CEGUI ? ChatGPT suggests it has to be deletion of some menu widget plus later call from the subsriber code for that widget ..... ANY CEGUI expert on board ? Even the claims of ChatGPT are true, how it is so that it works on Linux just fine ?
EDIT : THIS happens only when the binaries are run by OS not by debugger.

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: From the journal of the Windows Alchemist ...

Post by paul424 »

I just have switched from the STBI to FreeImage codec, cause I thought that the infamous malloc and delete[] mismatch at first was the issue ( as shown by the code sanitizer on Linux... ) .
To my sorrow the GUI bug seems to prevail !

rpgplayerrobin
Bugbear
Posts: 803
Joined: Wed Mar 18, 2009 3:03 am
x 462

Re: From the journal of the Windows Alchemist ...

Post by rpgplayerrobin »

You basically have a bug that only happens on release, and not on debug, correct?

That does happen sometimes to me as well, but most of the time you can still debug it by using a release-debug build.

The only difference between a release-debug build and a normal release build are these settings in Visual Studio, so try them and recompile and then run using F5 to debug it in release:
C/C++ -> Optimization -> Optimization -> Disabled
Linker -> Debugging -> Generate Debug Info -> Yes

More info about it here:
https://learn.microsoft.com/en-us/cpp/b ... w=msvc-170

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: From the journal of the Windows Alchemist ...

Post by paul424 »

I've followed your advice and have setup MSVSC to desired state.
However the described Heisenbug remains as it was !
What tools I have at hand under Windows to resolve this ? I have heard about about code sanitizers like ASAN (?), but to use it properly here I would have to rebuild entire boost library for what I have little time...

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: From the journal of the Windows Alchemist ...

Post by paul424 »

There were other "warnings" from address sanitizer as well on Linux, which I ignored. That was a mistake. As Chatgpt suggests that would only make more place for more UB. So I roll up my sleeves and mend those "warnings" ....

User avatar
paul424
Gnome
Posts: 396
Joined: Thu May 24, 2012 7:16 pm
x 22

Re: From the journal of the Windows Alchemist ...

Post by paul424 »

On the other hand , after searching I found that memory leaks does not cause undefined behaviour , it make only your memory run out faster !
I need to rebuild my game with the older CEGUI anyway, and here's the question : I noticed that building my game takes over 7 minutes, while on Linux with make -j40 it's 40-50 seconds! ( I already enabled parallel builds for MSVSC ) . SO what are your patents to have faster builds on Windows ?