Page 1 of 1

Screenshot works, but no display?

Posted: Wed Oct 29, 2008 9:43 am
by asphodeli
Hi all,

I have a strange problem while custom compiling Irrlicht using SDL device. I am unable to get a display (black screen), but taking a screenshot works fine. does anyone know how to solve this problem?

Posted: Wed Oct 29, 2008 11:03 am
by Danny Gilbert
Do you have a light in your scene ?

You also need a camera.
:)

Posted: Wed Oct 29, 2008 11:16 am
by asphodeli
Danny Gilbert wrote:Do you have a light in your scene ?

You also need a camera.
:)
I doubt I need a light nor camera, since I'm using the HelloWorld code.

Posted: Wed Oct 29, 2008 11:34 am
by Acki
asphodeli wrote:I doubt I need a light nor camera, since I'm using the HelloWorld code.
of course you need a camera, maybe not a light if you turned lighting off, but in any cases you'll need a camera (how do you see without eyes) !!! :lol:
also without a camera you hardly get a screenshot made...

you gave too little information to help you...
show us the code you're using... ;)

Posted: Wed Oct 29, 2008 12:30 pm
by rogerborg
Bah, all libSDL downloads seem to be sporked at the moment, so I can't test this. Any information that you can provide (Irrlicht version, SDL version, any changes other than uncommenting _IRR_USE_SDL_DEVICE_) would be much appreciated.

Posted: Wed Oct 29, 2008 12:35 pm
by asphodeli
Using Irrlicht 1.4.2, libSDL v1.2.9, Main.cpp:

Code: Select all

#include <common.h>
#include <stdio.h>
#include <irrlicht.h>
//#include <pspdebug.h>

using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;

PSP_MODULE_INFO("Irrlicht", 0, 1, 1);
//Cause 640k ought to be enough for everybody?
PSP_HEAP_SIZE_KB(-640);
//VFPU?
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);

int main()
{
	setupPSP();

	IrrlichtDevice *device = 0;

	device = createDevice( video::EDT_SOFTWARE, dimension2d<irr::s32>(480, 272),16,false,false,false);

	IVideoDriver* driver = device->getVideoDriver();
	ISceneManager* smgr = device->getSceneManager();
	IGUIEnvironment* guienv = device->getGUIEnvironment();

	guienv->addStaticText(L"Hello World! This is the Irrlicht Software renderer!", rect<irr::s32>(10,10,260,22), true);

//	IAnimatedMesh* mesh = smgr->getMesh("sydney.md2");

//	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );

//	if (node)
//	{
		//node->setMaterialFlag(EMF_LIGHTING, false);
		//node->setMD2Animation ( scene::EMAT_STAND );
		//node->setMaterialTexture( 0, driver->getTexture("sydney.bmp") );
//	}

	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0));

	while(device->run())
	{
		driver->beginScene(true, true, SColor(255,255,255,255));
        //driver->draw2DRectangle(SColor(255,0,255,0),rect<irr::s32>(-480,-272,480,272));

		smgr->drawAll();
		guienv->drawAll();

        //printf("FPS: %d\n",driver->getFPS());
            irr::video::IImage* image = 0;
            image = driver->createScreenShot();

            if (image)
               {
                  //construct a filename, consisting of local time and file extension
                  irr::c8 filename[64];
                  snprintf(filename, 64, "host0:/screenshot_%u.png", device->getTimer()->getRealTime());
                  //write screenshot to file
                  if (driver->writeImageToFile(image, filename))
                     device->getLogger()->log(L"Screenshot taken.");
                  else
                     device->getLogger()->log(L"Failed to take screenshot!");
                  image->drop();
               }

		driver->endScene();
	}

	device->drop();

	return 0;
}

Posted: Wed Oct 29, 2008 12:42 pm
by asphodeli
rogerborg wrote:Bah, all libSDL downloads seem to be sporked at the moment, so I can't test this. Any information that you can provide (Irrlicht version, SDL version, any changes other than uncommenting _IRR_USE_SDL_DEVICE_) would be much appreciated.
IrrCompileConfig.h changes were minimal - besides enabling SDL, OpenGL was disabled. Trivial changes to source as well, though it isn't much - disabling sysconf calls in getSystemMemory() (or something like that), and changing #include <memory.h> to <memory>, explicitly declaring irr::s32 because of conflichts with an existing data type

Posted: Thu Oct 30, 2008 4:35 am
by asphodeli
Have changed to trunk rev 1662 in the hopes that it is working, still no deal. Screenshot attached - somehow the background of the text is rendered as transparent through the purple background of the SceneManager.

Image

Posted: Thu Oct 30, 2008 8:17 am
by hybrid
Maybe no one tried the SDL device with SW rendering, yet, or it's a problem with default values and big endianess. I've added some color format settings to the present method, maybe it's working better now.
Also moving this to bug forum as it seems to be a problem with the device implementation.

Posted: Fri Oct 31, 2008 1:19 am
by asphodeli
Still the same problem with rev 1663. Will test SDL SW rendering with Linux + SDL 1.2.13 if there's time. Meshes load fine (albeit without textures) after disabling hardware FPU though (no transparent "Hole").

Image

Posted: Fri Oct 31, 2008 8:11 am
by JP
You need to apply textures to MD2 models, they don't do it themselves ;)

Posted: Fri Oct 31, 2008 12:28 pm
by asphodeli
JP wrote:You need to apply textures to MD2 models, they don't do it themselves ;)
I would have tried that out, but loading texture will cause a hardware exception

Posted: Fri Nov 07, 2008 2:15 am
by asphodeli
SDL port for PSP has a double-buffering bug, hence the blank screen. With the latest trunk, joystick and buttons are working under SDL, will do testing for the bugfixed SDL port.

Posted: Fri Nov 07, 2008 8:08 am
by hybrid
Well, that sounds like good news. Hope you can fix this problem easily :)