Does Irrlicht support createDeviceEx on Linux?

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.
Crivens

Does Irrlicht support createDeviceEx on Linux?

Post by Crivens »

Does Irrlicht support createDeviceEx on Linux? Or is that TBD?
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

Going by the source (CIrrDeviceLinux.cpp), this function is implemented. It ignores a few of the members of the SIrrlichtCreationParameters struct. eg Vsync, AntiAlias and WindowId.
Crivens

Post by Crivens »

I tried it with the OpenGL driver, but it just creates another window for itself.
Crivens

Post by Crivens »

Has anyone used it on Linux?
Crivens

Post by Crivens »

I always get two windows.
Crivens

Post by Crivens »

Any word from Niko?
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

Do you mean it's not using the window you pass in WindowId? If so, re-read my previous message.
Crivens

Post by Crivens »

I can get it so it doesn't create a new window, by not passing a window ID or setting a driver type (NULL), but it doesn't draw anything.
eudemon
Posts: 14
Joined: Mon Jul 04, 2005 2:48 am

Post by eudemon »

Strange, I use CreateDeviceEx under linux and it works fine. Maybe you could post some code from where you call the function? That would help.
Crivens

Post by Crivens »

I'll see if I can get a sample tonight. Do you have an example you could post?
eudemon
Posts: 14
Joined: Mon Jul 04, 2005 2:48 am

Post by eudemon »

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?
Crivens

Post by Crivens »

For what it's worth, I'm trying to use Irrlicht with Clanlib (http://www.clanlib.org).
Fred

Post by 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;
This gives me one window, but nothing is drawn.
eudemon(logged out)

Post by 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.

Code: Select all

irr::IrrlichtDevice* device = irr::createDeviceEx(param);
           
if (device == 0)
{
      [u]return 1;[/u]
}
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.
Guest

Post by Guest »

Thanks - maybe Niko can say whether this works under Linux or not. It certainly works under Windows, but maybe not Linux.
Post Reply