SDL2 + Irrlicht

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
stefany
Posts: 58
Joined: Wed Dec 07, 2011 10:50 am

SDL2 + Irrlicht

Post by stefany »

Hi, i am having problems with SDL2 under linux. In windows 8.1 runs perfectly. But i can only integrate SDL2 and irrlicht in Debian when irrlicht is compiled in debug mode.

In release mode i get

Code: Select all

 
Major opcode of failed request:  154 (GLX)  
Minor opcode of failed request:  31 (X_GLXCreateWindow)   
Serial number of failed request:  26  
Current serial number in output stream:  30
 
And the program ends.

And in debug mode, i get an error, but all works:

Code: Select all

 
X Error: GLXBadWindow
From call : unknown
 
My integration code with SDL is basically this:

Code: Select all

 
 int flags = SDL_WINDOW_OPENGL | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_BORDERLESS;
    if(mUserConfig && mUserConfig->video.fullScreen)
        flags = SDL_WINDOW_FULLSCREEN;
 
    mSDLWindow = SDL_CreateWindow("SE",
                                  SDL_WINDOWPOS_CENTERED,
                                  SDL_WINDOWPOS_CENTERED,
                                  (mUserConfig != nullptr) ? mUserConfig->video.size.Width : 500,
                                  (mUserConfig != nullptr) ? mUserConfig->video.size.Height : 500,
                                  flags);
 
 
    if(mSDLWindow) {
        //SDL_GLContext context =  SDL_GL_CreateContext(mSDLWindow);
        irr::SIrrlichtCreationParameters creationParams;
        creationParams.DriverType = irr::video::EDT_OPENGL;
        creationParams.Fullscreen = false;
        creationParams.AntiAlias = true;
        creationParams.Bits = 32;
        creationParams.Vsync = (mUserConfig) ? mUserConfig->video.vsync : true;
 
        SDL_SysWMinfo info;
        SDL_VERSION(&info.version);
    if(SDL_GetWindowWMInfo(mSDLWindow, &info))
    {
#ifdef _IRR_WINDOWS_
      creationParams.WindowId = reinterpret_cast<void *>(info.info.win.window);
#else
      creationParams.IgnoreInput=true;
      creationParams.WindowId = reinterpret_cast<void *>(info.info.x11.window);
#endif
      mIrrDevice = irr::createDeviceEx(creationParams);
    }
    else
      SE_END_PROGRAM("SDL failed to get the driver dependient windows information")
    }
 
Have a nice day!
Destructavator
Posts: 40
Joined: Sat Feb 06, 2010 9:00 pm
Location: Ohio, USA

Re: SDL2 + Irrlicht

Post by Destructavator »

Not sure how helpful this is, but as I understand it a desktop window (that one might want to create an OpenGL context within, and from glancing at your code it looks like you are going for OpenGL) is very different between Linux and Microsoft Windows OS. The methods for creating an OpenGL context are not the same. MS Windows, by itself, has very spartan support for OpenGL (other than a simple, rinky-dink software-driven support) that doesn't go past version 1.1 IIRC and needs "extensions" for hardware-accelarated OpenGL and modern features. I've looked at SDL2 code recently, and they have a customized version of the extension header file "glext.h" which is re-named with a "SDL_" prefix (The official header can be downloaded freely from the OpenGL website). SDL2 has a system which can intelligently auto-detect if the official glext.h header is used or not, and adjust itself to use or not use its own internal version. This might be part of why on Windows 8.1 the system can adjust and make itself work OK.

As for Linux, I'm just starting to get into how OpenGL is done on that platform, I know it doesn't use the same header files at all (the glext.h or the wiggle extension header that windows needs) and I haven't looked at how SDL2 does it yet, but the only thing I can *guess* here is that perhaps in debug mode your code on Debian is doing extra checks / corrections that it might not do otherwise, perhaps correcting for some issue which will still need to be fixed to do what you want.

Again, I don't know if any of that helps, perhaps you can sift through that and pick out a snippet of something useful that might help you. My own knowledge of programming on Linux is not the best, something I'm still trying to develop myself.

Hopefully someone here who knows Linux better than I do can give a better and more clear answer.
- - - -
"Destructavator" Dave: Developer of OS GPL VST "ScorchCrafter" Audio Plug-ins, contributer to UFO AI, Day Job: Guitar Luthier (Customize musical instruments, repainting w/ custom artwork, graphics, logos, decals, etc.)
FloatyBoaty
Posts: 32
Joined: Thu Aug 21, 2014 11:39 pm

Re: SDL2 + Irrlicht

Post by FloatyBoaty »

I just finished an SDL2 driver port, but assets do not load on Android.
However, according to SDL, they exist...
Any help?

Here's the diff:
http://pastebin.com/0qTTxDaA
FloatyBoaty
Posts: 32
Joined: Thu Aug 21, 2014 11:39 pm

Re: SDL2 + Irrlicht

Post by FloatyBoaty »

it was the ogles shader path....

http://pastebin.com/0qTTxDaA
Post Reply