Porting from 1.8 to 1.9

Problems building or running the engine, queries about how to use features etc.
Post Reply
Hachimaki
Gnoblar
Posts: 3
Joined: Wed Aug 24, 2016 9:03 am

Porting from 1.8 to 1.9

Post by Hachimaki »

Hi guys,

I am porting some old code I did not write to newer versions of Ogre but I am experiencing some problems. The main issue I have so far is how to replace this two calls that do not compile in Ogre 1.9 while they are fine in 1.8.

Code: Select all

Ogre::TexturePtr rtt_texture = ...; // some texture is defined here
Ogre::GLuint id = static_cast<Ogre::GLTexturePtr>(rtt_texture)->getGLID();
Ogre::GLenum target = static_cast<Ogre::GLTexturePtr>(rtt_texture)->getGLTextureTarget();
Looking in the forum I found out a possible solution:

Code: Select all

Ogre::TexturePtr rtt_texture = ...; // some texture is defined here
Ogre::GLTexturePtr gl_tex = rtt_texture.static_cast<Ogre::GLTexturePtr>();
Ogre::GLuint id = gl_tex->getGLID();
Ogre::GLenum target = gl_tex->getGLTextureTarget();
However this code does not compile as well? Is there any other way I can cast a TexturePtr to a GLTexurerPtr. I need this functionality to map the textures to cuda memory and these two calls are crucial for me.

Thanks for help guys.
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5296
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1278
Contact:

Re: Porting from 1.8 to 1.9

Post by dark_sylinc »

There is something wrong with:

Code: Select all

rtt_texture.static_cast<Ogre::GLTexturePtr>();
It should be either (I don't remember, I always have to look an example as well):

Code: Select all

rtt_texture.staticCast<Ogre::GLTexturePtr>(); //or...
rtt_texture.staticCast<Ogre::GLTexture>();
Notice the lack of under_score and the Uppercase letter.
Hachimaki
Gnoblar
Posts: 3
Joined: Wed Aug 24, 2016 9:03 am

Re: Porting from 1.8 to 1.9

Post by Hachimaki »

Yes, sorry for the typo in the name of the function, I meant exactly the the function you suggested. I replaced the cast as you suggested from GLTexturePtr to GLTexture and it works. Why I should cast a shared pointer to the pointed object is still not clear to me but I will figure it out.

Thanks :)
Post Reply