I am evaluating the use of some third parties to display my ingame GUI.
One of my potential choices is gameswf, which is able to run and display basic swf flash files using several hardware acceleration layers (in particular, opengl).
How difficult would it be to integrate such 3rd party with Irrlicht so that they use the same opengl context ?
I was thinking about recompiling Irrlicht and the 3dr party lib to make them link with the same opengl library (for example, GLEW).
Has this kind of stuff been done before ?
Since the rendering module of gameswf is quite well decoupled, the other option is to implement a full Irrlicht renderer, which would be great.
After all, there are only 1200 lines of opengl code to implement the whole thing. Still, I guess it would take some time to make it work properly.
Exposing opengl to a 3rd pary lib
It definitely works ! Sincerely, working with light, efficient, well written libraries is something I like (namely Irrlicht, Lua, and now gameswf).
I replaced the SDL-opengl code with glew and it worked like a charm. Once this is done, the rendering loop is basically :
I still can't realize how much time this tiny thing is going to save me.
Thanks !
I replaced the SDL-opengl code with glew and it worked like a charm. Once this is done, the rendering loop is basically :
Code: Select all
glPushAttrib(GL_ALL_ATTRIB_BITS);
glPushMatrix();
// Some GL setup
{
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); // GL_NICEST, GL_FASTEST, GL_DONT_CARE
glMatrixMode(GL_PROJECTION);
glOrtho(-1, 1, 1, -1, -1, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST); // Disable depth testing.
glDrawBuffer(GL_BACK);
}
m_root = m_player->get_root();
m_root->set_display_viewport(0, 0, 800, 600);
m_root->set_background_alpha(0);
m_root->advance(20); // in ms
m_root->display();
glPopMatrix();
glPopAttrib();
Thanks !