Is backface culling turned on by default??

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Guest

Is backface culling turned on by default??

Post by Guest »

Just a quick question, is backface culling turned on by default for all code paths?? Thats it, thankx.
keless
Posts: 805
Joined: Mon Dec 15, 2003 10:37 pm
Location: Los Angeles, California, USA

Post by keless »

90% sure
a screen cap is worth 0x100000 DWORDS
Guest

Post by Guest »

Thank you, one more question. Is there a way I can make a call and find out which code path i am rendering with. So I know if I am using OpenGL, DirectX etc etc.??. Thank you again.
Guest
Posts: 35
Joined: Mon Feb 02, 2004 7:17 pm
Location: Russia, Saint-Petersburg

Post by Guest »

Actually there is no such a direct call (as far as I know) but you can find it out indirectly.

1st Way: When you start Irrlicht you call createDevice function where the first parameter is the driverType (DX, GL, Soft, of Null). The engine tries to create device ONLY of the type you specified. So if you've specified DX8 then engine will work in DX mode or won't work at all.
You can check out if it works by getting result of getVideoDriver function.

As an example you can get this:

Code: Select all

IrrlichtDevice* device = createDevice(EDT_DIRECTX8, dimension2d<s32>(640, 480), 16);

IVideoDriver* video;
if (device)
{
  video = device->getVideoDriver();

if (video)
{
// ok. It's DX8 mode
}
else
{
// do what you like, e.g. try to work in GL mode:
  if (device)
    device->drop();
  device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 16);
  // check device and video again... etc.
}
2nd Way: you can specify "error listener" (event reciever). If something goes wrong (abywhere) engine alerts you. In this case it will be a ELL_ERROR alert (see, e.g., CIrrDeviceWin32.cpp line 324).

So you can handle this as following:

Code: Select all

class CErrorListener : public IEventReceiver
{
public:
bool OnEvent(SEvent event)
{
  if (event.EventType == EET_LOG_TEXT_EVENT)
  {
    if (event.LogEvent.Level == ELL_ERROR)
    {
      // check event.LogEvent.text here
      return true;
    }
  }
  return false;
}
};

// in creating device just specify this class object as listener
CErrorListener listener;
IrrlichtDevice* device = createDevice(EDT_DIRECTX8, dimension2d<s32>(640, 480), 16,  false, false, &listener);
so, hope that's enough... :)
Post Reply