Indeed, I'm getting a format of D3DFMT_X8R8G8B8, which doesn't promise to deliver an alpha, and the values are 0.
SVN 1641 adds a check for that format and the presented alpha in the first pixel, and if necessary, forces each pixel's alpha to 255 (ouch). Suggestions for a better solution would be gratefully received.
The other issue is that the D3D9 screenshot process is excruciatingly slow, and this fix certainly won't help.
Heh, it looks like Burning screenshots are spannered as well. The alpha on the background is fine, but it appears to be 0 for any rendered pixels. That'll need looking at independently.
Test app follows. Verification that this fixes it for D3D8 and D3D9 would be much appreciated. Thanks for the report and investigation.
Code: Select all
#include "irrlicht.h"
using namespace irr;
using namespace core;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
#ifdef _IRR_WINDOWS_
#pragma comment(lib, "Irrlicht.lib")
#pragma comment(linker, "/subsystem:windows /ENTRY:mainCRTStartup")
#endif
bool runTestWithDriver(E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice( driverType, dimension2d<s32>(640, 480));
if (!device)
return false;
IVideoDriver* driver = device->getVideoDriver();
ISceneManager * smgr = device->getSceneManager();
IAnimatedMeshSceneNode * node = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../../media/dwarf.x"));
node->setMaterialFlag(EMF_LIGHTING, false);
smgr->addCameraSceneNode(0, vector3df(0, 20, -30));
driver->beginScene(true, true, SColor(255,100,101,140));
smgr->drawAll();
driver->endScene();
IImage * screenshot = driver->createScreenShot();
bool result = true;
if(screenshot)
{
stringc filename(driver->getName());
filename += ".png";
result = driver->writeImageToFile(screenshot, filename.c_str());
screenshot->drop();
stringc openFile("\"");
openFile += filename;
openFile += "\"";
(void)system(openFile.c_str());
}
device->drop();
return result;
}
int main()
{
bool passed = true;
passed &= runTestWithDriver(EDT_NULL);
passed &= runTestWithDriver(EDT_SOFTWARE);
passed &= runTestWithDriver(EDT_BURNINGSVIDEO);
passed &= runTestWithDriver(EDT_OPENGL);
passed &= runTestWithDriver(EDT_DIRECT3D8);
passed &= runTestWithDriver(EDT_DIRECT3D9);
return passed ? 0 : 1;
}