If compiled with "--with-gl-support=GLX --with-platform=GLX", nothing will be rendered (i.e. it will not enter the rendering loop) unless InputReader::capture is called. I'd guess it has something to do with XNextEvent(mDisplay,&event); being called in GLXInput::capture().
I noticed this when I tried to use the debian packages, since they use the GLX platform. Now, I use SDL for input, using my own classes and never touching the Ogre event system. When Ogre is compiled for the SDL platform, there's no problem, since SDL_Init(...) already is called. But there are a number of problems when using ogre compiled for GLX. In order to get the SDL input to work I would need a way to tell SDL to attach to an already created window, but I can't seem to find a way to do that. A call to SDL_SetVideoMode(...) creates a new separate window.
Also, I need to do things differently depending on the platform used, for example not call SDL_Init if SDL is used, but call it if GLX is used. But I could find no method in PlatformManager which tells me what underlying system is used. I could always use getInputReader and dynamically cast the return value until I've found out what kind of class it is, but there must be a better way.
GLX platform doesn't work without InputReader::capture()
- Azatoth
- Gnome
- Posts: 327
- Joined: Sat Jul 10, 2004 6:46 pm
- Location: Sweden
- x 4
- Contact:
-
makob
- Kobold
- Posts: 32
- Joined: Wed Jan 28, 2004 10:09 pm
- Location: Aalborg, Denmark
I think I've bumped into the same problem - I also use the Debian packages and use SDL as the input driver. When I start my Ogre program, the screen simply goes 'black'
I havn't dived into the issues as deeply as you, but I did find out that the renderloop never starts (eventhough i call Root::startRender()).
I don't know if this is related only to fog's Debian packages, or it's an "upstream bug" -- wumpus, you're in charge of the GLX driver, right? Can you confirm this?
Anyhow, with the 1.0.0 release on it's way (yiiiihaaaar!
) I guess a fix for Hastur is out of the question 
Cheers, and keep up the good work,
-Jakob
I don't know if this is related only to fog's Debian packages, or it's an "upstream bug" -- wumpus, you're in charge of the GLX driver, right? Can you confirm this?
Anyhow, with the 1.0.0 release on it's way (yiiiihaaaar!
Cheers, and keep up the good work,
-Jakob
6 times 7 equals 42.
- :wumpus:
- OGRE Retired Team Member

- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
- Azatoth
- Gnome
- Posts: 327
- Joined: Sat Jul 10, 2004 6:46 pm
- Location: Sweden
- x 4
- Contact:
Well, that kinda breaks the platform agnostic nature of Ogre then, if the behaviour is different depending on whether SDL or GLX is used as the platform for the libs.
I don't use any X event handling code, I use SDL event handling. Now, in SDL mode the behaviour is that everything renders independant of whether an InputReader is present or not. If the library used is compiled against GLX this is not true; the behaviour has changed. If you really don't think this is a bug, at least make it so that the other platforms breaks if InputReader::capture() isn't called first.
One of the main benefits of using SDL is not having to care about how event and input is managed on all the different platforms SDL is implemented on. I really don't want to write three different sets of input handling code (SDL, GLX and DIrectX) since this is already taken care of by SDL. And that's why I need to know if there's some way to attach SDL to an already created window (i.e. the one created by GLX). As far as I know, there is no way to do this, but I was hoping that someone with more experience in SDL could help me.
If there is no way to do this, I will have to write three different input managers and at runtime decide which to use. To do that I could either do some dynamic casts and check the pointer, or use some kind of mechanism to query the PlatformManager about the currently running subsystem. I would prefer the latter.
I don't use any X event handling code, I use SDL event handling. Now, in SDL mode the behaviour is that everything renders independant of whether an InputReader is present or not. If the library used is compiled against GLX this is not true; the behaviour has changed. If you really don't think this is a bug, at least make it so that the other platforms breaks if InputReader::capture() isn't called first.
One of the main benefits of using SDL is not having to care about how event and input is managed on all the different platforms SDL is implemented on. I really don't want to write three different sets of input handling code (SDL, GLX and DIrectX) since this is already taken care of by SDL. And that's why I need to know if there's some way to attach SDL to an already created window (i.e. the one created by GLX). As far as I know, there is no way to do this, but I was hoping that someone with more experience in SDL could help me.
If there is no way to do this, I will have to write three different input managers and at runtime decide which to use. To do that I could either do some dynamic casts and check the pointer, or use some kind of mechanism to query the PlatformManager about the currently running subsystem. I would prefer the latter.
- :wumpus:
- OGRE Retired Team Member

- Posts: 3067
- Joined: Tue Feb 10, 2004 12:53 pm
- Location: The Netherlands
- x 1
- Azatoth
- Gnome
- Posts: 327
- Joined: Sat Jul 10, 2004 6:46 pm
- Location: Sweden
- x 4
- Contact:
As I understand it after looking through the code, one cannot set the instance of GLSupport used by OgreGLRenderSystem; that is decided at compilation by what version of OgreGLUtil.h is used.
SDL uses XEvent* internally, but only for windows created by SDL. So a window created by GLX will never recieve any XEvent* calls from SDL (unless there's a way to attach SDL to an already created window).
SDL uses XEvent* internally, but only for windows created by SDL. So a window created by GLX will never recieve any XEvent* calls from SDL (unless there's a way to attach SDL to an already created window).
- Azatoth
- Gnome
- Posts: 327
- Joined: Sat Jul 10, 2004 6:46 pm
- Location: Sweden
- x 4
- Contact:
I was wrong: it's not possible to dynamically cast the InputReader since the headers for the different platforms aren't available.
I've been searching through the code, but I can't see how I can get any information about the underlying platform. Is there no such functionality?
There's a hack in SDL which involves setting the environment variable SDL_WINDOWID to an already existing window. But it is a hack, it doesn't work on many platforms, it should not be used, and most important: it doesn't help with the event handling. So it can't be used.
A better solution to this problem (i.e. not having to write three different event managers) would be if the architecture would allow the platform to be set at run time. As it is now, once you compile for GLX you can't use SDL. Would it be possible to make it so that the instance of GLSupport that is used could be changed at runtime? So that an application which uses SDL could tell Ogre to use an instance of SDLGLSupport instead of the default GLXGLSupport?
I've been searching through the code, but I can't see how I can get any information about the underlying platform. Is there no such functionality?
There's a hack in SDL which involves setting the environment variable SDL_WINDOWID to an already existing window. But it is a hack, it doesn't work on many platforms, it should not be used, and most important: it doesn't help with the event handling. So it can't be used.
A better solution to this problem (i.e. not having to write three different event managers) would be if the architecture would allow the platform to be set at run time. As it is now, once you compile for GLX you can't use SDL. Would it be possible to make it so that the instance of GLSupport that is used could be changed at runtime? So that an application which uses SDL could tell Ogre to use an instance of SDLGLSupport instead of the default GLXGLSupport?