Page 1 of 1

[SOLVED] Problem updating a code. Help please.

Posted: Tue Apr 08, 2014 22:26
by adrnavarro
Hello,

I'm new here. I'm trying to update the code for a game that i found. It all was going fine but i have a problem with the OgreCEGUIRenderer.h.
I'm working on debian Jessie and that OgreCEGUIRenderer.h is not available there. The line of code that is causing trouble right now is the following:

CEGUI::Texture *cTex = static_cast<CEGUI::OgreCEGUIRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture((CEGUI::utf8*)"RttTex");

That's the original line. It was written under Cegui = 0.6.2. I currently have the newest version of CEGUI and OGRE but i cannot download the package libceguiogre-dev.
I tried to change the line to

CEGUI::Texture *cTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(CEGUI::String "RttTex");

But i get this

In member function ‘virtual void CSimulatorWindowHandler::init()’:
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:41: error: expected type-specifier
CEGUI::Texture *cTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(CEGUI::String "RttTex");
^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:41: error: expected ‘>’
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:41: error: expected ‘(’
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:41: error: ‘OgreRenderer’ is not a member of ‘CEGUI’
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:61: error: expected primary-expression before ‘>’ token
CEGUI::Texture *cTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(CEGUI::String "RttTex");
^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:137: error: expected primary-expression before string constant
CEGUI::Texture *cTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(CEGUI::String "RttTex");
^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:146: error: expected ‘)’ before ‘;’ token
CEGUI::Texture *cTex = static_cast<CEGUI::OgreRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture(CEGUI::String "RttTex");
^
The game is named "Project Football" by Ikaro Games. I need to make a couple of little changes but before i need to make it run so i need to update to the newest version of CEGUI.

Re: Problem updating a code. Help please.

Posted: Tue Apr 08, 2014 23:35
by Ident
You posted this in the wrong forum. I moved it into the help forum.
Please read our guidelines before posting.

Which cegui package did you use instead?

Re: Problem updating a code. Help please.

Posted: Wed Apr 09, 2014 02:07
by nicoo
just by curiosity...
adrnavarro wrote:I'm working on debian Jessie and that OgreCEGUIRenderer.h is not available there. The line of code that is causing trouble right now is the following:

CEGUI::Texture *cTex = static_cast<CEGUI::OgreCEGUIRenderer*>(CEGUI::System::getSingleton().getRenderer())->createTexture((CEGUI::utf8*)"RttTex");

That's the original line. It was written under Cegui = 0.6.2. I currently have the newest version of CEGUI and OGRE but i cannot download the package libceguiogre-dev.


why? if you don't have the dev (which is needed to have all ogre includes iirc on debian) how could you compile something with ogre ? did you compiled ogre yourself ?
if you want to know where a file is locate, try:

Code: Select all

locate -i OgreCEGUIRenderer.h

in your console, if locate isn't installed on your system, ask some help on the debian's forum. if locate returns nothing, go in root and try :

Code: Select all

updatedb

then (still in root, just in case...)

Code: Select all

locate -i OgreCEGUIRenderer.h

if you still get nothing, that means this file isn't on your system and you have first to install properly Ogre on your system... Also, if I understand correctly, you try to compile a game made some times ago right? Ogre has may have changed some functions/files names...

Re: Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 04:01
by adrnavarro
Sorry for posting in the wrong place.
Thanks for the info. It is still not working. However i think i found something.
I checked on the ogre forum and the problem with the OgreCEGUIRenderer.h file was solved by updating the code to CEGUI 0.7.
I'm trying to update the code to use cegui 0.7. I got cegui 0.7 by running the command

Code: Select all

apt-get install libcegui-mk2-dev
(I tried to get the cegui 0.8.3 from the site and compile it but it did not work, so i'm using the 0.7 from debian repository)

With that lib downloaded i got an CEGUIOgreRenderer.h in /usr/include/CEGUI/RenderersModule/Ogre/ (thats why locate -i OgreCEGUIRenderer never found the file i needed). I thought that using that one i should be able to create the CEGUI::OgreTexture as shown in the example

http://cegui.org.uk/wiki/Rendering_to_texture_%28RTT%29_in_CEGUI

So i tried to include the CEGUIOgreRenderer.h like this #include <CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h> but then i get this

Code: Select all

g++ -I/usr/include/CEGUI -I../src/bullet -I/usr/include/lua5.1 -I/usr/include/OGRE -I/usr/include/OGRE/GLX -O2 -pipe -fomit-frame-pointer -c -fmessage-length=0 -fexceptions -fident -MMD -MP -MF"src/singlePlayer/wh/CSimulatorWindowHandler.d" -MT"src/singlePlayer/wh/CSimulatorWindowHandler.d" -o"src/singlePlayer/wh/CSimulatorWindowHandler.o" "../src/singlePlayer/wh/CSimulatorWindowHandler.cpp"
In file included from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:28:0,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:57:7: error: using typedef-name ‘Ogre::TexturePtr’ after ‘class’
 class TexturePtr;
          ^
In file included from /usr/include/OGRE/Ogre.h:31:0,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:27,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/OGRE/OgrePrerequisites.h:319:32: note: ‘Ogre::TexturePtr’ has a previous declaration here
     typedef SharedPtr<Texture> TexturePtr;
                                               ^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp: In member function ‘virtual void CSimulatorWindowHandler::init()’:
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:249:127: error: no matching function for call to ‘CEGUI::OgreRenderer::OgreRenderer(CEGUI::Texture&)’
     CEGUI::OgreTexture *cTex = static_cast<CEGUI::OgreRenderer>((CEGUI::System::getSingleton().getRenderer())->createTexture());
                                                                                                                                                                                                    ^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:249:127: note: candidates are:
In file included from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:28:0,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:283:5: note: CEGUI::OgreRenderer::OgreRenderer(Ogre::RenderTarget&)
     OgreRenderer(Ogre::RenderTarget& target);
     ^
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:283:5: note:   no known conversion for argument 1 from ‘CEGUI::Texture’ to ‘Ogre::RenderTarget&’
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:281:5: note: CEGUI::OgreRenderer::OgreRenderer()
     OgreRenderer();
     ^
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:281:5: note:   candidate expects 0 arguments, 1 provided
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:71:28: note: CEGUI::OgreRenderer::OgreRenderer(const CEGUI::OgreRenderer&)
 class OGRE_GUIRENDERER_API OgreRenderer : public Renderer
                                                       ^
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:71:28: note:   no known conversion for argument 1 from ‘CEGUI::Texture’ to ‘const CEGUI::OgreRenderer&’
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:133: error: no matching function for call to ‘CEGUI::ImagesetManager::create(CEGUI::String, CEGUI::OgreTexture&, CEGUI::XMLResourceExistsAction)’
     CEGUI::Imageset imageSet = CEGUI::ImagesetManager::getSingleton().create((CEGUI::String)"RttImageset", *cTex, CEGUI::XREA_RETURN);
                                                                                                                                                                                                                        ^
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:251:133: note: candidates are:
In file included from /usr/include/CEGUI/CEGUI.h:56:0,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:25,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/CEGUI/CEGUIImagesetManager.h:91:15: note: CEGUI::Imageset& CEGUI::ImagesetManager::create(const CEGUI::String&, CEGUI::Texture&, CEGUI::XMLResourceExistsAction)
     Imageset& create(const String& name, Texture& texture,
                      ^
/usr/include/CEGUI/CEGUIImagesetManager.h:91:15: note:   no known conversion for argument 2 from ‘CEGUI::OgreTexture’ to ‘CEGUI::Texture&’
In file included from /usr/include/CEGUI/CEGUIFontManager.h:32:0,
                 from /usr/include/CEGUI/CEGUI.h:52,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:25,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/CEGUI/CEGUINamedXMLResourceManager.h:225:4: note: T& CEGUI::NamedXMLResourceManager<T, U>::create(const CEGUI::String&, const CEGUI::String&, CEGUI::XMLResourceExistsAction) [with T = CEGUI::Imageset; U = CEGUI::Imageset_xmlHandler]
 T& NamedXMLResourceManager<T, U>::create(const String& xml_filename,
      ^
/usr/include/CEGUI/CEGUINamedXMLResourceManager.h:225:4: note:   no known conversion for argument 2 from ‘CEGUI::OgreTexture’ to ‘const CEGUI::String&’
../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:255:18: error: invalid use of incomplete type ‘class CEGUI::OgreTexture’
  CEGUI::Size(cTex->getSize()),
                             ^
In file included from ../src/singlePlayer/wh/CSimulatorWindowHandler.h:28:0,
                 from ../src/singlePlayer/wh/CSimulatorWindowHandler.cpp:21:
/usr/include/CEGUI/RendererModules/Ogre/CEGUIOgreRenderer.h:64:7: error: forward declaration of ‘class CEGUI::OgreTexture’
 class OgreTexture;
          ^
make: *** [src/singlePlayer/wh/CSimulatorWindowHandler.o] Error 1


But if i do not include that file then it says that OgreTexture is not a member of CEGUI nor is OgreRenderer.

Re: Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 09:48
by Ident
You use Ogre 1.9?

Re: Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 14:01
by adrnavarro
Yes, i got it from debian repository this way

Code: Select all

apt-get install libogre-1.9-dev


But i think i found were was the problem. I did not update the include ogre.h line. It was #include<Ogre.h> but it should be #include<OGRE/Ogre.h>. It changed. I'm going to try with that and if it continues i'll be back. :D

Re: Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 16:05
by Ident
If you use Ogre 1.9 then try our CEGUI v0-8 stable branch. There was something with textureptr we recently fixed and didnt have a release for yet.

Re: Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 17:07
by nicoo
Ident wrote:If you use Ogre 1.9 then try our CEGUI v0-8 stable branch. There was something with textureptr we recently fixed and didnt have a release for yet.

I check in the packages of debian... the most recent version of cegui is 0.7.6... I used to be an user of Debian four or five years ago, I swap to archlinux because of several reasons, one of them was the delay of the updates with debian...

if debian doesn't have the 0.83 in his repo, well two options :
1) compil cegui yourself
2) change for another distro

for 1) if some cegui dependencies use some newer version than debian has in their repo, you will have some funny time... but whatever the distro you are using, sometime you have no other choice... do you know how to use cmake ? cegui has a very good cmake menu, if you download the stable release source (go with tar.gz it's better for linux)
in command line to decompress :

Code: Select all

tar -xvf cegui-0.8.3.tar.gz

then go in the directory and type

Code: Select all

ccmake .

you should see a menu (ncurse style)
select the image codec, renderer (your is ogre), xml parser, etc. more info here
then hit "c" to configure, and if no error, hit "g" to generate. if no error you are ready to compile with make. Sadly make can failed because of different version of dependencies, so report any error here.

Re: [SOLVED] Problem updating a code. Help please.

Posted: Thu Apr 10, 2014 18:50
by adrnavarro
for 1) if some cegui dependencies use some newer version than debian has in their repo, you will have some funny time... but whatever the distro you are using, sometime you have no other choice... do you know how to use cmake ? cegui has a very good cmake menu, if you download the stable release source (go with tar.gz it's better for linux)
in command line to decompress :


Yes, i tried to compile it but i failed. For the moment cegui 0.7.6 is good enough. So i will leave it that way. The problem i was having was mainly because of the #include <Ogre.h> command. I don't know why it didn't tell that there was no such file, but that was the problem, it was not the correct ogre.h file. I just changed it to #include<OGRE/Ogre.h> and problem solved. Now the problem i'm having is that some functions were removed and i need to replace them, right now i'm struggling with getRenderCache. If any one know a quick way to replace it with getGeometryBuffer or something else i would appreciate the help. I'm new so i'm reading a lot and it takes some time to learn al that, so any help to make it faster would be welcome. Thanks.