Does Irrlicht support createDeviceEx on Linux?
-
Crivens
Does Irrlicht support createDeviceEx on Linux?
Does Irrlicht support createDeviceEx on Linux? Or is that TBD?
-
Crivens
I can't post a samlpe right now, since I'm not on my home computer. But I am using CreateDeviceEx just like CreateDevice; just set all of the members of your SIrrlichtCreationParameters struct to the appropriate values, and replace the one latter function call with the former.
Does CreateDevice cause the same problem or not?
Does CreateDevice cause the same problem or not?
-
Fred
Code: Select all
#include <irrlicht.h>
using namespace irr;
#include <ClanLib/core.h>
#include <ClanLib/gl.h>
#include <ClanLib/application.h>
#include <ClanLib/display.h>
class GLApp : public CL_ClanApplication
{
public:
virtual int main(int, char **)
{
// Create a console window for text-output if not available
CL_ConsoleWindow console("Console");
console.redirect_stdio();
try
{
CL_SetupCore setup_core;
CL_SetupGL setup_gl;
CL_SetupDisplay setup_display;
int width = 800;
int height = 600;
CL_OpenGLWindow window("ClanLib OpenGL Demo", width, height);
CL_OpenGLState gl_state(window.get_gc());
gl_state.set_active();
// Connect the Window close event
CL_Slot slot_quit = window.sig_window_close().connect(this, &GLApp::on_window_close);
quit = false;
irr::SIrrlichtCreationParameters param;
param.DriverType = video::EDT_OPENGL;
param.Bits = 32;
param.Fullscreen = false;
param.Stencilbuffer = true;
param.WindowSize = irr::core::dimension2d<s32>(800,600);
irr::IrrlichtDevice* device = irr::createDeviceEx(param);
if (device == 0)
{
return 0;
}
irr::scene::ISceneManager* smgr = device->getSceneManager();
video::IVideoDriver* driver = device->getVideoDriver();
scene::ICameraSceneNode* cam = smgr->addCameraSceneNode();
cam->setTarget(core::vector3df(0,0,0));
scene::ISceneNodeAnimator* anim = smgr->createFlyCircleAnimator(core::vector3df(0,10,0), 30.0f);
cam->addAnimator(anim);
anim->drop();
scene::ISceneNode* cube = smgr->addTestSceneNode(25);
cube->setMaterialTexture(0, driver->getTexture("media/rockwall.bmp"));
smgr->addSkyBoxSceneNode(
driver->getTexture("media/irrlicht2_up.jpg"),
driver->getTexture("media/irrlicht2_dn.jpg"),
driver->getTexture("media/irrlicht2_lf.jpg"),
driver->getTexture("media/irrlicht2_rt.jpg"),
driver->getTexture("media/irrlicht2_ft.jpg"),
driver->getTexture("media/irrlicht2_bk.jpg"));
while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE) && !quit)
{
driver->beginScene(true, true, 0);
smgr->drawAll();
driver->endScene();
CL_Display::flip();
CL_System::keep_alive();
gl_state.set_active();
}
}
catch (CL_Error err)
{
std::cout << "Exception caught: " << err.message.c_str() << std::endl;
// Display console close message and wait for a key
console.display_close_message();
}
return 0;
}
private:
void on_window_close()
{
quit = true;
}
bool quit;
} app;
-
eudemon(logged out)
Hmm... I know nothing about ClanLib, so your problem could be there. I think irrlicht has problems using a window other than it's own for drawing.
Something else, which almost certainly isn't the problem, but would probably be good to change: A return of 0 from main is generally considered to be the signal for a successful execution of the program. If the program fails, it is traditional to have main return a 1 (Under *nix there are even more numbers, to represent different execution errors). Not very important though, just a matter of style.
Other than that, I don't know. Your problem probably lies in using ClanLib to create the window, but without more knowledge of that library, I can't be certain.
Something else, which almost certainly isn't the problem, but would probably be good to change: A return of 0 from main is generally considered to be the signal for a successful execution of the program. If the program fails, it is traditional to have main return a 1 (Under *nix there are even more numbers, to represent different execution errors). Not very important though, just a matter of style.
Code: Select all
irr::IrrlichtDevice* device = irr::createDeviceEx(param);
if (device == 0)
{
[u]return 1;[/u]
}
-
Guest