Screenshot works, but no display?

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
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Screenshot works, but no display?

Post 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?
Danny Gilbert
Posts: 54
Joined: Thu Oct 25, 2007 1:38 pm
Location: Montreal, Canada

Post by Danny Gilbert »

Do you have a light in your scene ?

You also need a camera.
:)
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post 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... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post 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.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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;
}
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

You need to apply textures to MD2 models, they don't do it themselves ;)
Image Image Image
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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
asphodeli
Posts: 36
Joined: Thu Jul 24, 2008 12:46 am
Location: Singapore

Post 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.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Well, that sounds like good news. Hope you can fix this problem easily :)
Post Reply