But in fullscreen mode, the rendering of the other stuff stops somehow.
Here's a minimal compilable example to demonstrate the problem.
Run it and press the left mouse button to draw a line. Then change to fullscreen mode and do again.
Code: Select all
#include <irrlicht.h>
class EventReceiver : public irr::IEventReceiver
{
public:
EventReceiver(irr::IrrlichtDevice* device) :
device(device), mouseButton(false)
{
}
bool OnEvent(const irr::SEvent& event)
{
switch(event.EventType)
{
case irr::EET_MOUSE_INPUT_EVENT:
{
switch (event.MouseInput.Event)
{
case irr::EMIE_LMOUSE_PRESSED_DOWN: mouseButton = true; return true;
case irr::EMIE_LMOUSE_LEFT_UP: mouseButton = false; return true;
default: return false;
}
}
break;
case irr::EET_KEY_INPUT_EVENT:
{
if (!event.KeyInput.PressedDown)
{
switch (event.KeyInput.Key)
{
case irr::KEY_ESCAPE: device->closeDevice(); return true;
default: return false;
}
}
else return false;
}
break;
default: return false;
}
}
bool isMouseButtonPressed() const { return mouseButton; }
private:
irr::IrrlichtDevice* device;
bool mouseButton;
};
static void drawRay(irr::video::IVideoDriver* driver, const irr::core::vector3df& start, const irr::core::vector3df& end)
{
irr::video::SMaterial mat;
mat.Lighting = false;
driver->beginScene(false, false, irr::video::SColor());
driver->setMaterial(mat);
driver->setTransform(irr::video::ETS_WORLD, irr::core::matrix4());
driver->draw3DLine(start, end, irr::video::SColor(255, 0, 0 , 255));
driver->endScene();
}
int main()
{
/*
* Testcase for my problem.
*
* Press left mouse button to draw a line via driver->draw3DLine()
*
* All works fine in windowed mode, but in fullscreen mode, the rendering of the sphere somehow stops.
*/
irr::IrrlichtDevice* device = 0;
device = irr::createDevice(irr::video::EDT_OPENGL, irr::core::dimension2di(800, 600), 16, false);
if (device == 0) return 1;
EventReceiver receiver(device);
device->setEventReceiver(&receiver);
irr::video::IVideoDriver* driver = device->getVideoDriver();
irr::scene::ISceneManager* smgr = device->getSceneManager();
irr::scene::ISceneNode* node = smgr->addSphereSceneNode();
irr::scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(irr::core::vector3df(0,0,30), 20.0f);
node->addAnimator(anim);
anim->drop();
smgr->addCameraSceneNode();
while(device->run())
{
if (device->isWindowActive())
{
if (receiver.isMouseButtonPressed())
drawRay(driver, node->getAbsolutePosition(), irr::core::vector3df(0.0f, 0.0f, 30.0f));
driver->beginScene(true, true, irr::video::SColor(255, 255, 255, 255));
smgr->drawAll();
driver->endScene();
}
}
device->drop();
return 0;
}