CEGUI 0.7 and Irrlicht 1.6

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
DtD
Just popping in
Just popping in
Posts: 14
Joined: Fri Oct 09, 2009 18:54
Location: Kansas, United States
Contact:

CEGUI 0.7 and Irrlicht 1.6

Postby DtD » Fri Oct 09, 2009 19:12

Hey, I'm new to CEGUI and am trying to compile it with Irrlicht 1.6 using MSVS on Windows.

When I try to compile most things go good but I get several errors like this:

Code: Select all

Error   2   error C2039: 'c16' : is not a member of 'irr'   c:\dev\tower_defense2\development2\cegui-0.7.0\cegui\include\renderermodules\irrlicht\ceguiirrlichtmemoryfile.h   61


What I am assuming is that 0.7 was made before Irrlicht 1.6 was finalized (judging by release dates) and something changed in the irr::io::IReadFile to make getFileName return "const io::path&" instead of "const irr::core::string<irr::c16>&" and they removed c16.

The following seems to fixes the problems (Once I get pcre so I can actually compile I can confirm it works)

In CEGUIIrrlichtMemeoryFile.h
replace

Code: Select all

const irr::core::string<irr::c16>& getFileName() const;

with

Code: Select all

const irr::io::path& getFileName() const;


replace

Code: Select all

irr::core::string<irr::c16> d_filename;

with

Code: Select all

irr::io::path d_filename;


And in CEGUIIrrlichtMemoryFile.cpp
replace

Code: Select all

const irr::core::string<irr::c16>& IrrlichtMemoryFile::getFileName() const

with

Code: Select all

const irr::io::path& IrrlichtMemoryFile::getFileName() const


This GUI system looks awesome and I hope to be using it a lot in the future!

~DtD

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby CrazyEddie » Sat Oct 10, 2009 08:20

Hi,

Thanks for the heads up that 1.6 support is broken; I'd seen the release had been made, but did not have a chance to test. These issues will be fixed later on today :)

[Edit]
With regards to PCRE, if you're using VS 7.1, 8 (SP1), or 9, I point you in the direction of our precompiled dependency packs (linked to in the release announcement posts).

CE.

User avatar
DtD
Just popping in
Just popping in
Posts: 14
Joined: Fri Oct 09, 2009 18:54
Location: Kansas, United States
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby DtD » Sat Oct 10, 2009 16:00

Thank you very much for your reply,
Yeah, I ended up getting the dependency package. I got CEGUI to compile but I get a ton of "libcmtd.lib(dbgheap.obj) : error LNK2005: __CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR90D.dll)" type errors. Other topics on the forums haven't been able to solve it. Still looking into things.

Ooops, I was compiling CEGUI with Debug and the Samples with Debug_Static. That seems to have fixed that. Then I got a link error consistent with using a Irrlicht Static Lib without _IRR_STATIC_LIB_ defined. So I defined that now the CEGUISampleHelper project gets a ton of thoose libcmtd.lib errors as well as one from irrlicht's lib:

"irrlicht.lib(Irrlicht.obj) : error LNK2005: _DllMain@12 already defined in MSVCRTD.lib(dllmain.obj)"
There is also: "LINK : fatal error LNK1104: cannot open file 'd3dx9.lib'" at the very button.

I'm gonna keep trying to fix it, but if you notice something let me know!

~DtD
PS> CEGUISampleHelper compiled successfully before I fixed the debug, debug static switchout thing.

User avatar
DtD
Just popping in
Just popping in
Posts: 14
Joined: Fri Oct 09, 2009 18:54
Location: Kansas, United States
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby DtD » Sat Oct 10, 2009 16:15

Ok, I switched out my self-compiled Static Irrlicht for the Dynamic Vanilla one and I cleaned the solution and it compiled everything.
Except it seems I compiled CEGUI without FreeType, so none of the samples run. DOH >.<
Hopefully it was the clean that fixed it, not the dynamic Irrlicht because I'd like to make everything static eventually.

Awesome, recompiled with FreeType and it seems to be 99% working. It was using OpenGL with Irrlicht by default, but I don't have OpenGL drivers so I recompiled again with DX9, and it looks good.

Also, it seems I found a bug. In Sample_TextDemo if you type something in the multiline (EG: "0169") and then backspace it deletes the 9 and jumps over the 6. Then the cursor is between 1 and 6 instead of at the end.

~DtD
BTW> In case you were wondering, I don't have OpenGL drivers because ATI stoppped supporting my graphics card and thier old Vista drivers do not work in Win7.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby CrazyEddie » Sat Oct 10, 2009 18:08

Hi,

The whole static / dynamic thing is a PITA, and depending on the exact code you're using things are dealt with differently. I'll save you the long version, but basically:

- Releases up to and including 0.7.0 used the wrong c/c++ runtime setting for static builds (the /MD and /MDd options instead of /MT and /MTd).
- The 0.7.x dependency packs contain a single version of the dependency libs, also built with the /MD and /MDd options.
- The CEGUI situation was fixed in the v0-7 branch a couple of weeks ago, though required matching dependency binaries, which were made available yesterday (the 0.7.x-r1 versions).

So basically, it's required to ensure that all components are built with the same runtime setting. For the current v0-7 code and future releases, this will be /MD and /MDd for dynamic builds and /MT and /MTd for static builds (since these are the most likely configurations people will be using). Failure to do this will create many linking issues, and also subsequent runtime issues if (or when) memory gets released across module boundaries.

I'll look into the editbox thing tomorrow :)

CE.

User avatar
DtD
Just popping in
Just popping in
Posts: 14
Joined: Fri Oct 09, 2009 18:54
Location: Kansas, United States
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby DtD » Sat Oct 17, 2009 18:42

Ah, ok. Thanks, I will look into that!

I am also going to look into getting CEGUI to use IrrXML (Built in to Irrlicht, but can be used stand-alone) for XML phrasing, and maybe getting it to use Irrlicht's image loader. The only dependency left over would be PCRE which I honestly don't need anyway except for the spinner widgets.

Have you thought instead of using regex for the spinner widget that it might be easier to just check the input as it comes in if all the character(s) are numbers or a decimal? Regex just seems like overkill for something like that.

~DtD

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby CrazyEddie » Sat Oct 17, 2009 19:36

With regards to image loading, so long as you're setting things up correctly this will already be using Irrlicht for the loading - if the log is reporting anything else as the ImageCodec (such as SILLY), then you're not initialising the system in such a way that it will use the integrated Irrlicht image codec. You can either create that yourself via a static call on the IrrluchtRenderer and pass it to the System::create function, or for most purposes can get the system to do it for you by way of the IrrlichtRenderer::bootstrapSystem function. Though note there is an outstanding bug as regards to the cleanup of the Irrlicht and Ogre integrated codecs when linking statically (will be fixed tomorrow).

With regards to the spinner and the use of regex, this is solely because the spinner is not a 'whole new widget' - but rather an Editbox instance with a couple of buttons stuck on the end. With 0.7.0, I've put in place the beginnings of the required mechanism to replace PCRE with other alternatives (so a lightweight, custom alternative would be possible), though this facility is not exposed to the user at this point in time.

CE.

User avatar
DtD
Just popping in
Just popping in
Posts: 14
Joined: Fri Oct 09, 2009 18:54
Location: Kansas, United States
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby DtD » Thu Nov 05, 2009 18:15

Thank you very much for your help! I tried compiling CEGUI without SILLY, but without it there are linker errors:

Code: Select all

------ Build started: Project: Archetype, Configuration: Debug Win32 ------
Linking...
CEGUIBase_Static_d.lib(CEGUISystem.obj) : error LNK2019: unresolved external symbol _createImageCodec referenced in function "private: void __thiscall CEGUI::System::setupImageCodec(class CEGUI::String const &)" (?setupImageCodec@System@CEGUI@@AAEXABVString@2@@Z)
CEGUIBase_Static_d.lib(CEGUISystem.obj) : error LNK2019: unresolved external symbol _destroyImageCodec referenced in function "private: void __thiscall CEGUI::System::cleanupImageCodec(void)" (?cleanupImageCodec@System@CEGUI@@AAEXXZ)
Dev\DtDTowerDefense2.exe : fatal error LNK1120: 2 unresolved externals

It works with the SILLY codec compiled in though.

I got the new version of CEGUI along with the new dependency package and everything looks good. Also, in OpenGL with Irrlicht I get blurry windows:
In OpenGL
In DirectX
I don't know if I mentioned this before, but I did not have OpenGL drivers on my system when I was first trying CEGUI, but I do now so I don't think that'd be the problem. Also, I should note that the examples work fine in OpenGL on my laptop. I made sure all the ATI enhancements were off on my desktop.

My log: (From desktop)

Code: Select all

05/11/2009 12:30:20 (Std)    ---- Version 0.7.1 (Build: Nov  5 2009 Static Debug Microsoft Windows MSVC++ 9.0 32 bit) ----
05/11/2009 12:30:20 (Std)    ---- Renderer module is: CEGUI::IrrlichtRenderer - Official Irrlicht based 2nd generation renderer module.  RenderTarget support is enabled. ----
05/11/2009 12:30:20 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
05/11/2009 12:30:20 (Std)    ---- Image Codec module is: IrrlichtImageCodec - Integrated ImageCodec using the Irrlicht engine. ----
05/11/2009 12:30:20 (Std)    ---- Scripting module is: None ----

The whole log is here

My desktop:

Code: Select all

AMD Athlon 64 3200+ 2.0 GHz (Single Core)
3 GB of RAM
ATI Radeon X1600, 256MB (dxdiag in windows 7 reports 1662 MB VRAM, but I am pretty sure it is wrong.)

My laptop:

Code: Select all

Intel Core 2 Duo T7500 2.2GHz (Dual Core)
3 GB of RAM
Mobile Intel 965 Express Chipset Family, 358 MB


Also, this isn't so important, but CEGUI does not seem to like the Burning's Video Render in Irrlicht:

Code: Select all

missing shader: gl_src_alpha gl_one_minus_src_alpha
(Just shows a black screen, atleast in Demo7, FlaggardDemo, and FontDemo)

~DtD

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: CEGUI 0.7 and Irrlicht 1.6

Postby agamemnus » Sun Mar 14, 2010 04:48

I tried to set up CEGUI with Irrlicht today. My program hangs and then crashes. I run the start function after I run the irrlicht start function. (otherwise I just get a segfault)

I used these eight win32 lib and dll files:
CEGUIBase.dll /lib
CEGUIExpatParser.dll /lib
CEGUIFalagardWRBase.dll / lib
CEGUIIrrlichtRenderer.dll /lib

My header, and one called function that hangs and then crashes:

Code: Select all

#include "irrlichtwrapper.h"
#include "cegui\include\CEGUI.h"
#include "cegui\include\RendererModules\Irrlicht\CEGUIIrrlichtRenderer.h"
#include "cegui\include\falagard\CEGUIFalagard_xmlHandler.h"
#include "cegui\include\XMLParserModules\ExpatParser\CEGUIExpatParserModule.h"

extern IrrlichtDevice *device;
extern IVideoDriver* driver;
extern ISceneManager* smgr;
extern IGUIEnvironment* guienv;

extern "C" {


void DLL_EXPORT CEGUIStart ( void ) {
 // CEGUI::IrrlichtRenderer &CEGUIrenderer =
 // CEGUI::IrrlichtRenderer::bootstrapSystem(*device);
 // return (void *)&CEGUIrenderer;
 // CEGUI::IrrlichtRenderer& myRenderer =
  CEGUI::IrrlichtRenderer::create( *device );
 // CEGUI::System::create( myRenderer );
 // return 0;
}


}



The MSVC+ 2008 Express Edition compile command:
/OUT:"Debug/IrrlichtWrapper.dll" /INCREMENTAL /NOLOGO /DLL /MANIFEST /MANIFESTFILE:"Debug\IrrlichtWrapper.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEF:".\IrrlichtWrapper.def" /DEBUG /PDB:"c:\se\oldstuff\IrrlichtWrapper\IrrlichtWrapper_source\Debug\IrrlichtWrapper.pdb" /SUBSYSTEM:WINDOWS /DYNAMICBASE:NO /IMPLIB:"Debug/IrrlichtWrapper.lib" /MACHINE:X86 /ERRORREPORT:PROMPT .\irrlicht-1.7\lib\Win32-visualstudio\irrlicht.lib .\cegui\CEGUIBase.lib .\cegui\CEGUIIrrlichtRenderer.lib .\cegui\CEGUIFalagardWRBase.lib .\cegui\CEGUIExpatParser.lib

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby CrazyEddie » Sun Mar 14, 2010 17:06

What does 'it crashes' mean? As programmers we generally need more information to go on than that.

From the little information given it seems you're linking the release version libs to a debug build. As I mentioned (twice, I think) in IRC last evening, you must ensure you link the debug versions (with the _d suffix) for the debug configuration of the project - this is absolutely essential, otherwise the C/C++ runtime used will not match.

CE.

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: CEGUI 0.7 and Irrlicht 1.6

Postby agamemnus » Sun Mar 14, 2010 17:11

I switched to debug dlls and here is the error I get:

"Run-Time Check Failure #0: The value of ESP was not properly saved across a function call. This is usually the result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."

I should note I am using the latest irrlicht, 1.7.1.

Edit: Here's the current compile command:

/Od /I ".\irrlicht-1.7\include" /I ".\irrlicht-1.7\source\Irrlicht" /I ".\cegui\include" /D "WIN32" /D "_WINDOWS" /D "_DEBUG" /D "_USRDLL" /D "_VC80_UPGRADE=0x0710" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /Gm /EHsc /RTCu /MDd /Fo"Debug\\" /Fd"Debug\vc90.pdb" /W3 /nologo /c /Wp64 /TP /errorReport:prompt
Last edited by agamemnus on Sun Mar 14, 2010 20:40, edited 1 time in total.

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: CEGUI 0.7 and Irrlicht 1.6

Postby agamemnus » Sun Mar 14, 2010 20:25

I didn't see your previous message, but I answered it. (I have ESP) :D

Using all debug, no-go.

Actually I'm extremely depressed right now that it crashes.

Very, very depressed... :cry:

More info:

* I am using MSVC 2008 Express Edition.
* I traced the crash to this function inside ceguiirrlichtrenderer.cpp:

Code: Select all

//----------------------------------------------------------------------------//
IrrlichtRenderer::IrrlichtRenderer(irr::IrrlichtDevice& device) :
    d_device(device),
    d_driver(d_device.getVideoDriver()),
    d_displaySize(static_cast<float>(d_driver->getScreenSize().Width),
                  static_cast<float>(d_driver->getScreenSize().Height)),
    d_displayDPI(96, 96),
    d_defaultTarget(new IrrlichtWindowTarget(*this, *d_driver)),
    d_defaultRoot(new RenderingRoot(*d_defaultTarget)),
    d_maxTextureSize(2048),
    d_eventPusher(new IrrlichtEventPusher(d_device.getCursorControl())),
    d_supportsNSquareTextures(d_driver->queryFeature(irr::video::EVDF_TEXTURE_NSQUARE)),
    d_supportsNPOTTextures(d_driver->queryFeature(irr::video::EVDF_TEXTURE_NPOT))
{       // <-------- here
    if (d_driver->queryFeature(video::EVDF_RENDER_TO_TARGET))
        d_rendererID += String("  RenderTarget support is enabled.");
    else
        d_rendererID += String("  RenderTarget support is unavailable :(");
}


Device initialization code:

Code: Select all

bool DLL_EXPORT IrrStart(
                              int iDevice,
                              int iWidth,
                              int iHeight,
                              unsigned int iBPP,
                              bool boFullscreen,
                              bool boShadows,
                              bool boCaptureEvents,
                              bool vsync )
{
    bool boInitStatus = false;
    E_DRIVER_TYPE iDeviceTypes[] = {
            EDT_NULL, EDT_SOFTWARE, EDT_SOFTWARE, EDT_OPENGL, EDT_DIRECT3D8, EDT_DIRECT3D9 };

    // create an irrlicht device object the root of all irrlicht functionality
    // if it is successfully created
   if ( device = createDevice(
            iDeviceTypes[iDevice],
            dimension2d<u32>( iWidth, iHeight),
            iBPP,
         boFullscreen,
         boShadows,
         vsync,
         boCaptureEvents ? &receiver : 0 ))
    {

        /* Get a pointer to the video driver, the SceneManager and the
        graphical user interface environment */
        // if we can successfully create these objects
        if (( driver = device->getVideoDriver()) &&
                ( smgr = device->getSceneManager()) &&
                ( guienv = device->getGUIEnvironment()))
      {
         // the system has started up correctly
            boInitStatus = true;

         // dont pass events to the GUI
         receiver.passToGUI = false;

         // apply an unlight material to the scene so that drawing functions display in set color
         SMaterial unlitMaterial;
         unlitMaterial.Lighting = false;
         driver->setMaterial(unlitMaterial);
      }
    }
    return boInitStatus;
}

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: CEGUI 0.7 and Irrlicht 1.6

Postby agamemnus » Mon Mar 15, 2010 06:01

Ok. Ok. I tried compiling cegui.

I have 5 errors when I try compiling the irrlicht renderer!!

Code: Select all

..\..\..\..\cegui\src\RendererModules\Irrlicht\CEGUIIrrlichtTextureTarget.cpp(124) : error C2664: 'irr::video::IVideoDriver::addRenderTargetTexture' : cannot convert parameter 1 from 'const irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'


..\..\..\..\cegui\src\RendererModules\Irrlicht\CEGUIIrrlichtTexture.cpp(131) : error C2664: 'irr::video::ITexture *irr::video::IVideoDriver::addTexture(const irr::core::dimension2d<T> &,const irr::io::path &,irr::video::ECOLOR_FORMAT)' : cannot convert parameter 1 from 'const irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'

..\..\..\..\cegui\src\RendererModules\Irrlicht\CEGUIIrrlichtTexture.cpp(225) : error C2664: 'irr::video::ITexture *irr::video::IVideoDriver::addTexture(const irr::core::dimension2d<T> &,const irr::io::path &,irr::video::ECOLOR_FORMAT)' : cannot convert parameter 1 from 'const irr::core::dimension2d<T>' to 'const irr::core::dimension2d<T> &'

./../../../cegui/include/RendererModules/Irrlicht/CEGUIIrrlichtMemoryFile.h(75) : error C2555: 'CEGUI::IrrlichtMemoryFile::getFileName': overriding virtual function return type differs and is not covariant from 'irr::io::IReadFile::getFileName'

../../../../cegui/include/RendererModules/Irrlicht/CEGUIIrrlichtMemoryFile.h(75) : error C2555: 'CEGUI::IrrlichtMemoryFile::getFileName': overriding virtual function return type differs and is not covariant from 'irr::io::IReadFile::getFileName'

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: CEGUI 0.7 and Irrlicht 1.6

Postby CrazyEddie » Mon Mar 15, 2010 10:08

The particular assertion you're getting indicates one of two main possibilities. First, is that there is some conflict between calling conventions being used for some function, and second, is something is corrupting the stack somewhere.

Generally, if the assertion gets raised at the same point every time in every run, then it might indicate that it's a calling convention issues - but does not rule out stack corruption from elsewhere. If the assertion is raised at different times, and perhaps at random points in the code, then this is more indicative of stack corruption and we could be confident in ruling out calling convention issues.

Given the point where you indicate the assertion gets raised, I would say it could be a calling convention issues as regards to the Irrlicht lib. Can't be 100% sure though, these things are always somewhat difficult to diagnose and debug across the Internets.

With regards to the later compile issues, this is likely because the Irrlicht SDK version specified in the config.lua file is set incorrectly - probably at 14, whereas it should be set to 16.

HTH

CE.

agamemnus
Just can't stay away
Just can't stay away
Posts: 185
Joined: Sun Mar 14, 2010 04:21

Re: CEGUI 0.7 and Irrlicht 1.6

Postby agamemnus » Mon Mar 15, 2010 18:16

With those changes to the lua script, I was able to compile "CEGUIBase" and "CEGUIIrrlichtRenderer" lib/dll files with Irrlicht 1.7.1 with MSVC++ 2008 EE.

They have a different file size from the SDK version.

The function with the bootstrap code now runs with no error. Thank you. :P


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests