textures missing if I don't draw gui objects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
SuperElectric
Posts: 19
Joined: Fri May 13, 2005 7:20 am
Location: New York, NY

textures missing if I don't draw gui objects

Post by SuperElectric »

When I don't draw any gui objects (namely, some on-screen text), my textures render incorrectly, as below:


Image

Note that some textures, like the skybox and leaves, do appear correctly. Anyway, below is what it's supposed to look like. I got this by adding on-screen text (near the middle-left of the screen).


Image

As a cheap workaround I tried placing the text off-screen. This didn't fool Irrlicht; it still de-textured the scene. I also tried putting the text partially off-screen. If only the text box is peeking into the screen but not the lettering, it still de-textures the scene. If there are any letters on-screen, though, the scene renders fine.

Also, it seems like the first frame renders correctly whether or not I have on-screen text. It's every subsequent frame that gets messed up without the text.

Can anybody guess as to what's going on, or suggest sanity-checks I could try that'd yield more info?

For reference, my render loop looks like this:

Code: Select all

	gui::IGUIStaticText* onScreenText = device_->getGUIEnvironment()->addStaticText(	L"Press 'W' to change wireframe mode", core::rect<s32>(-10,465,200,475), true);
	onScreenText->setOverrideColor(video::SColor(100,255,255,255));
	driver->setViewPort(core::rect<s32>(0,0,(s32)WINDOW_XRES, (s32)WINDOW_YRES));

	// the run loop
	while( device_->run() ){ // while the window is open
		
		// begin scene with a color and depth buffer.
		driver->beginScene(true, true, SColor(0,200,200,200)); 

		smgr->setActiveCamera(&robot_->getMonoCamera());	
		smgr->drawAll();
		device_->getGUIEnvironment()->drawAll();
				
		// display frames per second in window title
		int fps = device_->getVideoDriver()->getFPS();

		if (lastFps != fps)
		{
			std::wostringstream oss;
			oss<<L"Irrlicht LAGR demo ["<<device_->getVideoDriver()->getName()<<L"] FPS: "<<fps;
			device_->setWindowCaption(oss.str().c_str());
			lastFps = fps;
		}
		
		device_->getVideoDriver()->endScene();
		
	}
The de-texturing happens either when I comment out the first three lines (that add the on-screen text), or the line that says

Code: Select all

device_->getGUIEnvironment()->drawAll();
which draws the text.

Thanks,
-- Matt
Myth
Posts: 81
Joined: Wed Apr 13, 2005 5:48 pm

Post by Myth »

Strange, well you can put a space character to the screen?
Without border.

replacing
gui::IGUIStaticText* onScreenText = device_->getGUIEnvironment()->addStaticText( L"Press 'W' to change wireframe mode", core::rect<s32>(-10,465,200,475), true);

by:
gui::IGUIStaticText* onScreenText = device_->getGUIEnvironment()->addStaticText( L" ", core::rect<s32>(-10,465,200,475), false);

It's a very cheap work a round, it should be better to just fix this bug.
Try switching mipmapping of and on etc.
JOIN MY (100mbs 2x 3GHZ CPU) IRRLICHT FORUMS
http://irrlicht.halo4you.com/forums/
For all your programming quesitons and irrlicht ones!.

My fan site: http://www.halo-center.com
Post Reply