iOS ES2 Problems and Constant Joystick Axis Movement

Just wondering if anybody ran into this. I’ve converted dim3 to use ES2 (instead of 1.) My desktop compiles also use ES2, just in emulation (they only use shaders, they pass everything as attributes, they create and handle all their own matrixes and projections, etc.) dim3 works fine on the desktop. In iOS, other than the major reworking on my code, the only startup change was changing the ES headers and adding:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0);

Now, I know it’s getting an ES2 context because the shaders compile and anything that wasn’t ES1 fails. The program runs fine, but NEVER displays a single frame. Not even something as simple as setting the clear color, clearing, and then swaping the window.

I grabbed the latest SDL2 (to make sure my patch wasn’t interfering) and did both the method where I control the loop AND the new animation callback method. Still, nothing. Again, it’s not crashed, it just doesn’t seem to be swaping to the screen.

Is there some SDL flag I’m missing?

While experimenting, I noticed something worse that’s been going on for a while … you get constant joystick events! (i.e., SDL_JOYAXISMOTION). I don’t know enough about the code to guess, but there’s something going on here that needs to be fixed. Also, in the current trunk right now, you don’t get ANY other event! No touch events come through! So there is something really bizarre going on.

[>] Brian

Just a shot in the dark but be aware that if you ever use glBindFramebuffer you must glGetIntegerv(GL_FRAMEBUFFER_BINDING, &sysfbo) so that you can restore it to the window’s fbo later, because on
non-desktop OSes the fbo for the window is often not 0 (even the iOS simulator uses 0 for this but the real hardware does not).On 07/22/2012 01:39 PM, Brian Barnes wrote:

Just wondering if anybody ran into this. I’ve converted dim3 to use ES2 (instead of 1.) My desktop compiles also use ES2, just in emulation (they only use shaders, they pass everything as
attributes, they create and handle all their own matrixes and projections, etc.) dim3 works fine on the desktop. In iOS, other than the major reworking on my code, the only startup change was
changing the ES headers and adding:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0);

Now, I know it’s getting an ES2 context because the shaders compile and anything that wasn’t ES1 fails. The program runs fine, but NEVER displays a single frame. Not even something as simple as
setting the clear color, clearing, and then swaping the window.

I grabbed the latest SDL2 (to make sure my patch wasn’t interfering) and did both the method where I control the loop AND the new animation callback method. Still, nothing. Again, it’s not crashed,
it just doesn’t seem to be swaping to the screen.

Is there some SDL flag I’m missing?

While experimenting, I noticed something worse that’s been going on for a while … you get constant joystick events! (i.e., SDL_JOYAXISMOTION). I don’t know enough about the code to guess, but
there’s something going on here that needs to be fixed. Also, in the current trunk right now, you don’t get ANY other event! No touch events come through! So there is something really bizarre going on.

[>] Brian


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


LordHavoc
Author of DarkPlaces Quake1 engine - http://icculus.org/twilight/darkplaces
Co-designer of Nexuiz - http://alientrap.org/nexuiz
"War does not prove who is right, it proves who is left." - Unknown
"Any sufficiently advanced technology is indistinguishable from a rigged demo." - James Klass
"A game is a series of interesting choices." - Sid Meier

2012/7/22 Brian Barnes

Just wondering if anybody ran into this. I’ve converted dim3 to use ES2
(instead of 1.) My desktop compiles also use ES2, just in emulation (they
only use shaders, they pass everything as attributes, they create and
handle all their own matrixes and projections, etc.) dim3 works fine on
the desktop. In iOS, other than the major reworking on my code, the only
startup change was changing the ES headers and adding:

SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION,2);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION,0);

Now, I know it’s getting an ES2 context because the shaders compile and
anything that wasn’t ES1 fails. The program runs fine, but NEVER displays
a single frame. Not even something as simple as setting the clear color,
clearing, and then swaping the window.

I grabbed the latest SDL2 (to make sure my patch wasn’t interfering) and
did both the method where I control the loop AND the new animation callback
method. Still, nothing. Again, it’s not crashed, it just doesn’t seem to
be swaping to the screen.

Is there some SDL flag I’m missing?

While experimenting, I noticed something worse that’s been going on for a
while … you get constant joystick events! (i.e., SDL_JOYAXISMOTION). I
don’t know enough about the code to guess, but there’s something going on
here that needs to be fixed. Also, in the current trunk right now, you
don’t get ANY other event! No touch events come through! So there is
something really bizarre going on.

[>] Brian

I use the latest from HG in my engine and the ES2 backend is working fine
for me on iOS and Android…I suppose it’s obvious, but I assume you double
checked you are calling SDL_RenderPresent, right? Also, is there a chance
you may have called SDL_SetRenderTarget and forgot to reset it afterwards?–
Gabriel.

Forest Hale wrote:

Just a shot in the dark but be aware that if you ever use glBindFramebuffer you must glGetIntegerv(GL_FRAMEBUFFER_BINDING, &sysfbo)
so that you can restore it to the window’s fbo later, because on non-desktop OSes the fbo for the window is often not 0
(even the iOS simulator uses 0 for this but the real hardware does not).

Bingo. Thanks Forest, why this didn’t show up before was because the back rendering wasn’t support when running under ES 1, so all that code was skipped. It would have taken me a while
to determine what this problem was.

[>] Brian

That’s surprising. Those naughty mobile platforms… Is this documented
anywhere or do you have a link to more info I can check out? The OpenGLES
docs imply that 0 should be used for the default framebuffer.

Jonny D

Jonathan Dearborn wrote:

That’s surprising. Those naughty mobile platforms… Is this documented
anywhere or do you have a link to more info I can check out? The OpenGLES
docs imply that 0 should be used for the default framebuffer.

After looking more into this, it’s probably really the OpenGLES docs
that are wrong, as they assume there isn’t another important bound
buffer. In the iOS world, everything you draw is drawn to a back
framebuffer and than swapped to the screen when finished, so you always
need to get and restore.

Forest saved me a couple hours of digging to find that one!

I don’t know who originally put together the uikit stuff, but the
constant joystick movement stuff remains. Which brings up another
(maybe) SDL 2.0 “before release” thing: is it good to have the
acceleration movement set to the joystick? I don’t see joysticks coming
to iOS anytime soon, but should it be it’s own separate event type?

[>] Brian

That’s a good point. It makes me think that maybe joystick should not be
the default event type for odd peripherals and inputs. There could be a
more generic one that we toss accelerometer and future data into.