This may qualify as a bug in either of the two involved libraries, but it very well could easily just be me doing something wrong so I figured it should probably go in Advanced Help and be moved if it turns out to be a bug in Irrlicht itself. There's also the fact that it might be a bug in an unrelated library, which would mean this belongs here versus the Irrlicht bug reports thread.
I'm using Irrlicht for a project and I'm trying to delegate Irrlicht to just being a renderer and so I've brought in Allegro to handle mouse/keyboard input which requires an Allegro display to be active, so I'm using the Irrlicht createDeviceEx method to initialize Irrlicht with the XID of the created Allegro window as such:
Code: Select all
#include <iostream>
#include <irrlicht/irrlicht.h>
#include <allegro5/allegro.h>
#include <allegro5/allegro_x.h>
int main(int argc, char* argv[])
{
// Init Allegro & create a display
al_init();
ALLEGRO_DISPLAY* allegroDisplay = al_create_display(640, 480);
if (!allegroDisplay)
{
std::cout << "Failed to create Allegro Display" << std::endl;
return -1;
}
al_set_window_title(allegroDisplay, "Allegro/Irrlicht Test");
// Setup the creation parameters
irr::SIrrlichtCreationParameters creationParameters;
creationParameters.DriverType = irr::video::EDT_OPENGL; // If this is EDT_BURNINGSIDEO or EDT_SOFTWARE, it behaves as expected.
creationParameters.WindowId = reinterpret_cast<void*>(al_get_x_window_id(allegroDisplay));
// Init Irrlicht
irr::IrrlichtDevice* irrlicht = irr::createDeviceEx(creationParameters);
irr::scene::ISceneManager* scene = irrlicht->getSceneManager();
irr::video::IVideoDriver* video = irrlicht->getVideoDriver();
// Setup a scene so we can see if it actually renders
scene->addCameraSceneNode();
irr::scene::ISceneNode* cube = scene->addCubeSceneNode();
cube->setMaterialFlag(irr::video::EMF_LIGHTING, false);
cube->setPosition(irr::core::vector3df(0, 0, 50));
// Roll out a basic draw loop
while (irrlicht->run())
{
video->beginScene();
scene->drawAll();
video->endScene();
}
return 0;
}
And this is literally all it does when called: https://github.com/liballeg/allegro5/bl ... dow.c#L396 which simply returns the XID of the window.
The problem? The application exits when you try to initialize Irrlicht with an OpenGL video driver using an Allegro window with the following error:
Code: Select all
Linux 4.0.5-gentoo-tye #15 SMP Tue Aug 25 00:34:19 EDT 2015 x86_64
X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 153 (GLX)
Minor opcode of failed request: 31 (X_GLXCreateWindow)
Serial number of failed request: 22
Current serial number in output stream: 23

I'm not entirely sure why it isn't working with OpenGL, so I was hoping someone would be able to speculate on the issue at least.
Here is relevant system information:
Code: Select all
ragora@tye ~ $ uname -r
4.0.5-gentoo-tye
ragora@tye ~ $ gcc --version
gcc (Gentoo 4.8.4 p1.6, pie-0.6.1) 4.8.4
ragora@tye ~ $ glxinfo | grep version
server glx version string: 1.4
client glx version string: 1.4
GLX version: 1.4
OpenGL core profile version string: 4.4.0 NVIDIA 352.30
OpenGL core profile shading language version string: 4.40 NVIDIA via Cg compiler
OpenGL version string: 4.5.0 NVIDIA 352.30
OpenGL shading language version string: 4.50 NVIDIA
OpenGL ES profile version string: OpenGL ES 3.1 NVIDIA 352.30
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.10
GL_EXT_shader_implicit_conversions, GL_EXT_shader_integer_mix,
Edit
It looks like it has to do with the GL context; which I can't seem to tell Irrlicht to use an existing one on Linux (I can have Allegro create a GL context for the window it initializes) because this is raised by createDeviceEx itself, and by the Win32 Example, it looks like the GL binding is done post createDeviceEx (at least it is on Windows), so I'm not completely sure how I should be doing this otherwise.