I'm trying to make a big sphere that should be transparent (seeing inside it)
This is the code I'm using, but obviously it doesn't work
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
int main(int argc, char *argv[])
{
IrrlichtDevice *device = createDevice(video::EDT_DIRECT3D9, dimension2d<s32>(320, 240), 24, false, true, false, 0);
if (!device)
return 1;
device->setWindowCaption(L"Balls TEST");
IVideoDriver* driver = device->getVideoDriver();
ISceneManager* smgr = device->getSceneManager();
IGUIEnvironment* guienv = device->getGUIEnvironment();
driver->setTextureCreationFlag(video::ETCF_ALWAYS_32_BIT, true);
smgr->addLightSceneNode(0, vector3df(0, 0, -60));
IMeshSceneNode *bowl = smgr->addSphereSceneNode(10, 32);
if (bowl)
{
bowl->setMaterialFlag(EMF_LIGHTING, true);
bowl->setMaterialFlag(EMF_BACK_FACE_CULLING, true);
bowl->setMaterialTexture(0, driver->getTexture("white.png"));
bowl->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
}
IMeshSceneNode *b1 = smgr->addSphereSceneNode(2, 16);
if (b1)
{
b1->setMaterialFlag(EMF_LIGHTING, false);
b1->setMaterialTexture(0, driver->getTexture("red.png"));
bowl->setMaterialType(video::EMT_SOLID);
}
smgr->addCameraSceneNodeFPS(0, 100, 0.05);
while (device->run())
{
driver->beginScene(true, true, SColor(255, 0, 0, 0));
smgr->drawAll();
guienv->drawAll();
driver->endScene();
}
device->drop();
return 0;
}