Screenshot works, but no display?
Screenshot works, but no display?
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?
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?
-
- Posts: 54
- Joined: Thu Oct 25, 2007 1:38 pm
- Location: Montreal, Canada
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) !!!asphodeli wrote:I doubt I need a light nor camera, since I'm using the HelloWorld code.
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:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
IrrExtensions:
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
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
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
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;
}
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 typerogerborg 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.