driver->removeTexture

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
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

driver->removeTexture

Post by m3ltd0wn »

possible a bug in the 1.7 branch

my code :
this is the event receiver ...

Code: Select all

case EGET_COMBO_BOX_CHANGED:
				//body elements
				if (id == 500)
				{
					s32 pos = ((IGUIComboBox*)event.GUIEvent.Caller)->getSelected();
					switch (pos)
					{
						case 0:
							{
								car->removePartModel(front_bumper_node);
								car->loadFrontBumper("data/models/mk1golf/f_bumper_1.3ds");
								car->loadModelTexture(front_bumper_node,"data/textures/mk1golf/stoc_bumpers.jpg");
							}
							break;
						case 1:
							{
								
								car->removePartModel(front_bumper_node);
								car->loadFrontBumper("data/models/mk1golf/f_bumper_5.3ds");
								car->loadModelTexture(front_bumper_node,"data/textures/mk1golf/colors/red/bumpers.jpg");
							}
							break;
						case 2:
							{
								
								car->removePartModel(front_bumper_node);
								car->loadFrontBumper("data/models/mk1golf/f_bumper_3.3ds");
								car->loadModelTexture(front_bumper_node,"data/textures/mk1golf/colors/red/bumpers.jpg");
							}
							break;
i call this when i want to remove an existing model and add another in it's place, i also clear the texture so i can load another one:

Code: Select all

//remove a part model of the car: node to remove
		void removePartModel(IAnimatedMeshSceneNode* nodeToRemove)
		{
			//effect->removeShadowFromNode(nodeToRemove);
			driver->removeTexture(nodeToRemove->getMaterial(0).getTexture(0));
			nodeToRemove->removeAll();
			nodeToRemove->remove();
			
		}
Image
here is the error, it crashes only if i uncomment driver->removeTexture ... else it works but everytime i add a model and texture it fills lots of memory with the textures :D
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Are you absolutely sure that your texture is not used elsewhere? Check which node is currently being rendered, this would tell you from where the texture wants to be drawn. Also check the texture pointer before and after the remove/addTexture call and note the values. This would also hint whether the new or the old texture is being drawn. And finally, test the same tool with OpenGL, maybe it's a driver specific problem
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

same error in open gl, with irrlicht 1.6 i didn't get the error and the textures were deleted from memory just fine :D
i'll check the pointers as you've sayed to be sure :D
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

by the way my car assembler looks like this:

Code: Select all

namespace veedub
{
	class carModel
	{
	public:
		
		//load the carChassis 3d model: path to 3d model, parent node, position, rotation
		void loadCarChassis(path filenameModel, ISceneNode* parent = vw_node, vector3df pos = vector3df(0,0,0), vector3df rot = vector3df(0,0,0))
		{
			car_chassis = smgr->getMesh(filenameModel);
			car_chassis_node = smgr->addAnimatedMeshSceneNode(car_chassis, parent, -1, pos, rot);
		}

		//load the carBody 3d model: path to 3d model, parent node, position, rotation
		void loadCarBody(path filenameModel, ISceneNode* parent = vw_node, vector3df pos = vector3df(0,0,0), vector3df rot = vector3df(0,0,0))
		{
			car_body = smgr->getMesh(filenameModel);
			car_body_node = smgr->addAnimatedMeshSceneNode( car_body, parent, -1, pos, rot);
		}

		//load the hood 3d model: path to 3d model, parent node, position, rotation
		void loadHood(path filenameModel, ISceneNode* parent = vw_node, vector3df pos = vector3df(0,0,0), vector3df rot = vector3df(0,0,0))
		{
			hood = smgr->getMesh(filenameModel);
			hood_node = smgr->addAnimatedMeshSceneNode(hood, parent, -1, pos, rot);		
		}

		//load the grille 3d model: path to 3d model, parent node, position, rotation
		void loadGrille(path filenameModel, ISceneNode* parent = vw_node, vector3df pos = vector3df(0,0,0), vector3df rot = vector3df(0,0,0))
		{
			front_grille = smgr->getMesh(filenameModel);
			front_grille_node = smgr->addAnimatedMeshSceneNode(front_grille, parent, -1, pos, rot);
		}
and in event receiver:

Code: Select all

if(checkbox_mk1golf->isChecked())
							{
								//load models
								car->initParentNodes();
								car->loadCarBody("data/models/mk1golf/car_body.3ds");
								car->loadCarChassis("data/models/mk1golf/chassis.3ds");
								car->loadHood("data/models/mk1golf/hood.3ds");
								car->loadGrille("data/models/mk1golf/2L_F_grille.3ds");
								car->loadGrilleEdge("data/models/mk1golf/grille_edge.3ds");
								car->loadAntenna("data/models/mk1golf/antenna.3ds");
								car->loadBrakeDiscs("data/models/mk1golf/brake_discs.3ds");
								car->loadCalipers("data/models/mk1golf/calipers.3ds");
								car->loadControlArms("data/models/mk1golf/control_arms.3ds");
								car->loadEmblem("data/models/mk1golf/emblem.3ds");
								car->loadExhaust("data/models/mk1golf/exhaust_0.3ds");
								car->loadFenders("data/models/mk1golf/fenders_1.3ds");
								
								car->loadFrontBumper("data/models/mk1golf/f_bumper_1.3ds");
								car->loadRearBumper("data/models/mk1golf/r_bumper_1.3ds");

								car->loadFrontLights("data/models/mk1golf/2F_lights.3ds",
									"data/models/mk1golf/2F_lights_glass.3ds");
								car->loadGTIBadge("data/models/mk1golf/gti_badge.3ds");
								car->loadGTILip("data/models/mk1golf/gti_lip.3ds");
								car->loadShockAbsorbers("data/models/mk1golf/shock_absorbers.3ds");
								car->loadSprings("data/models/mk1golf/springs.3ds");
								car->loadSteeringWheel("data/models/mk1golf/steering_wheel.3ds");
								car->loadTailLights("data/models/mk1golf/tail_lights.3ds", 
									"data/models/mk1golf/tail_lights_glass.3ds");
								car->loadVWBadge("data/models/mk1golf/vw_badge.3ds");
								car->loadWhipers("data/models/mk1golf/whipers.3ds");
								car->loadWindows("data/models/mk1golf/wind_shield.3ds", 
									"data/models/mk1golf/windows.3ds");
								car->loadDoorHandlers("data/models/mk1golf/door_handlers.3ds");
								car->loadRails("data/models/mk1golf/rails.3ds");
								car->loadSideMirrors("data/models/mk1golf/mirrors_body.3ds", 
									"data/models/mk1golf/mirrors_glass.3ds");
								car->loadWindowsEdges("data/models/mk1golf/window_edges.3ds");
								car->loadFuelCap("data/models/mk1golf/fuel_cap.3ds");

								car->loadWheels("data/models/wheels/ats_classic/ATSC_F_L.3ds",
									"data/models/wheels/ats_classic/ATSC_F_R.3ds",
									"data/models/wheels/ats_classic/ATSC_R_L.3ds",
									"data/models/wheels/ats_classic/ATSC_R_R.3ds");
								
								//workaround
								car->loadSideSkirts("data/models/mk1golf/side_skirt_1.3ds");
								car->partIsVisible(side_skirt_node, false);
								car->loadSpoilers("data/models/mk1golf/spoiler_1.3ds");
								car->partIsVisible(spoiler_node,false);


								car->loadModelTexture(car_body_node,"data/textures/mk1golf/colors/red/chassis3.jpg");
								car->loadModelTexture(car_chassis_node,"data/textures/mk1golf/colors/red/chassis.jpg");
								car->loadModelTexture(fenders_node,"data/textures/mk1golf/colors/red/fenders.jpg");
								car->loadModelTexture(hood_node,"data/textures/mk1golf/colors/red/hood.jpg");
								
								
								car->loadModelTexture(antenna_node,"data/textures/mk1golf/antenna_chrome.jpg");
								car->loadModelTexture(front_bumper_node,"data/textures/mk1golf/chrome_bumpers.jpg");
								car->loadModelTexture(rear_bumper_node,"data/textures/mk1golf/chrome_bumpers.jpg");
								car->loadModelTexture(gti_lip_node,"data/textures/mk1golf/gti_lip.jpg");
								car->loadModelTexture(grille_edge_node,"data/textures/mk1golf/grille_edge.jpg");
								car->loadModelTexture(whipers_node,"data/textures/mk1golf/whipers.jpg");
								car->loadModelTexture(front_grille_node,"data/textures/mk1golf/grille.jpg");
								car->loadModelTexture(exhaust_node,"data/textures/mk1golf/exhaust.jpg");
								car->loadModelTexture(windows_node,"data/textures/mk1golf/windows/windows_glass.jpg",0,EMT_TRANSPARENT_ADD_COLOR);
								car->loadModelTexture(wind_shield_node,"data/textures/mk1golf/windows/windshield_glass.jpg",0,EMT_TRANSPARENT_ADD_COLOR);
								car->loadModelTexture(front_lights_glass_node,"data/textures/mk1golf/front_lights/stoc/front_light_glass.jpg",0,EMT_TRANSPARENT_ADD_COLOR);
								car->loadModelTexture(front_lights_node,"data/textures/mk1golf/front_lights/stoc/front_light_body.jpg",0,EMT_SOLID, EMF_LIGHTING, true);
								car->loadModelTexture(tail_lights_glass_node,"data/textures/mk1golf/tail_lights/taillights.jpg");
								car->loadModelTexture(windows_edges_node,"data/textures/mk1golf/windows_edges.jpg");
								car->loadModelTexture(door_handlers_node,"data/textures/mk1golf/door_handlers.jpg");
								car->loadModelTexture(side_mirrors_node,"data/textures/mk1golf/side_mirrors.jpg");
								car->loadModelTexture(side_mirrors_glass_node,"data/textures/mk1golf/side_mirrors_glass.jpg");
								car->loadModelTexture(luggage_rails_node,"data/textures/mk1golf/rails.jpg");
								car->loadModelTexture(control_arms_node,"data/textures/mk1golf/control_arms.jpg");
								car->loadModelTexture(shock_absorbers_node,"data/textures/mk1golf/shocks.jpg");
								car->loadModelTexture(steering_wheel_node,"data/textures/mk1golf/steering_wheel.jpg");
								car->loadModelTexture(springs_node,"data/textures/mk1golf/springs.jpg");
								car->loadModelTexture(emblem_node,"data/textures/mk1golf/emblems/emblem.jpg");
								car->loadModelTexture(brake_discs_node,"data/textures/mk1golf/brake_discs/brakedisc.jpg");
								car->loadModelTexture(calipers_node,"data/textures/mk1golf/calipers/calipers.jpg");
								car->loadModelTexture(fuel_cap_node,"data/texture/mk1golf/fuel_cap.jpg");
								car->loadModelTexture(vw_badge_node,"data/textures/mk1golf/badges.jpg");
								car->loadModelTexture(gti_badge_node,"data/textures/mk1golf/badges.jpg");
m3ltd0wn
Posts: 107
Joined: Wed Dec 12, 2007 8:32 am
Location: Romania

reply

Post by m3ltd0wn »

ok i think whats wrong, need to use different texture names for some of my meshes, if i use same texture for two meshes i get a crash, strange that my code was working flawlessly with irrlicht 1.6 and only with 1.7 i've got this crash, but nevermind, i'll rename some of my textures so it won't crash again

10x hybrid for opening my eyes :D
Post Reply