[fixed]Something is wrong about videoDriver->removeTextur

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

[fixed]Something is wrong about videoDriver->removeTextur

Post by t0rt0r0 »

Hi ! ;)

I'm looking more in details about cleaning not needed ressources in my game, but i'm experiencing some difficulties with textures :/

I'm using irrlicht 1.5.1 (don't know if it matters but i didn't tried the 1.6) in OpenGL

I've made a sample code that illustrate my problem :

Code: Select all

	irr::IrrlichtDevice* dev = irr::createDevice(irr::video::EDT_OPENGL) ;
		
	irr::video::ITexture* texture = 0 ;
	int test = 0 ;
	bool t = true ;
	
	while (dev->run()) 
	{
		if (dev->isWindowActive())
		{
			dev->getVideoDriver()->beginScene(true, true, irr::video::SColor(255, 0, 255, 0)) ;
			dev->getSceneManager()->drawAll() ;
			dev->getVideoDriver()->endScene() ;
			
			if (++test > 1000)
			{
				if (t) // Add smtg
				{
					printf("ADD\n") ;
				
					dev->getSceneManager()->addCameraSceneNode(0, irr::core::vector3df(0, 0, 0), irr::core::vector3df(1, 0, 0)) ;
					
					texture = dev->getVideoDriver()->getTexture("./test.png") ;
					
					irr::scene::ISceneNode* img	= dev->getSceneManager()->addCubeSceneNode(1, 0, -1, irr::core::vector3df(330, 0, 0), irr::core::vector3df(0, 0, 0), irr::core::vector3df(0, texture->getSize().Height, texture->getSize().Width)) ;
					img->setMaterialTexture(0, texture) ;
					img->getMaterial(0).getTextureMatrix(0).setRotationDegrees(irr::core::vector3d<irr::f32>(0, 180, 0)) ; // flip
					img->setMaterialFlag(irr::video::EMF_LIGHTING, false) ;
					img->setMaterialType(irr::video::EMT_TRANSPARENT_ALPHA_CHANNEL) ;

					t = !t ;	
				}
				else // Remove
				{
					printf("REMOVE\n") ;
					
					dev->getSceneManager()->clear() ; // REMOVE ANYTHING THAT USED THIS TEXTURE OK ?
					dev->getVideoDriver()->removeTexture(texture) ;
					
					t = !t ;	
				}
				
				test = 0 ;	
			}
		}
	}
	
    return 0 ;
}
The first load is ok (we assume that the file exists) but when I need to delete the texture AFTER clearing the scene manager, it crashe.

Don't understand what is happening :/ and the debugger don't help me a lot ^^

So thanks if you can help me ! ;)

PS : as always, sorry for bad english ! :oops:
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Nobody has the same problem ? :(
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

yes, I have the same problem when trying out your code !!! :shock:
but it seems to be a problem with OGL, if you select DX as driver it works as expected !!! :lol:
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Thanks for trying :wink:
I was wondering if it was my video driver, so not !

Are you using 1.6 ?

And if someone that well know the engine came here please tell us if you know something about this issue ;)

Thanks a lot :wink:
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Ok, bug confirmed, though I thought that I already fixed that one some time ago. Will be added to 1.6.1 or so.
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Thanks !

Could you tell us when you'll find the error ?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

It's fixed in SVN now, all versions from 1.5 to trunk.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hybrid wrote:It's fixed in SVN now, all versions from 1.5 to trunk.
is the fix a big deal ???
I mean it would be nice to post the changes for users who don't use the SVN/trunk versions, so they can apply the patch to the release version they are using... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Feel free to browse the SVN, there's a very simple click'n'watch webinterface on the SF page
http://irrlicht.svn.sourceforge.net/vie ... t?view=rev
You have to click back until the pacth comes (it's in CSceneManager.cpp) and click on 'text changed'
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

hybrid wrote:Feel free to browse the SVN, there's a very simple click'n'watch webinterface on the SF page
ahhh, that's nice !!! :)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
t0rt0r0
Posts: 76
Joined: Fri May 22, 2009 11:02 am

Post by t0rt0r0 »

Thanks you so much ;)
Post Reply