SDLActivity on Android. A few questions

Hi!
I am now testing SDLActivuty on my device and I want ask a few questions.

  1. As I have read, SDLActivity class first of all is needed to call native SDL functions?
  2. Am I right: all SDL functions we should do only in main thread?
  3. Can I change the size of SDLSurface?
  4. Can I use SDL functions not in the function which was declared as SDL main, but from my own native code, just with including SDL.h?

Sorry, may be my questions are not specific enough or confusing, but I am new to SDL. Thanks! [Rolling Eyes]

Hi,

  1. yes
  2. no, you can use SDL from any thread (but make sure to read the
    documentation)
  3. no idea, I prefer to use OpenGL ES directly
  4. yes you can

2014/1/20 bukka.wh <bukka.wh at gmail.com>> Hi!

I am now testing SDLActivuty on my device and I want ask a few questions.

  1. As I have read, SDLActivity class first of all is needed to call native
    SDL functions?
  2. Am I right: all SDL functions we should do only in main thread?
  3. Can I change the size of SDLSurface?
  4. Can I use SDL functions not in the function which was declared as SDL
    main, but from my own native code, just with including SDL.h?

Sorry, may be my questions are not specific enough or confusing, but I am
new to SDL. Thanks! [image: Rolling Eyes]


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

  1. If you mean changing the resolution that your game runs at, then no. Not with the code provided (at least not that I discovered). I hacked the provided SDLActivity quite a bit to get that working (You can’t seem to do that with a AbsoluteLayout… and changing it to Relative breaks a few other things). If anyone’s interested, I might be able to clean up my hacks a little and provide them.

Stefanos A., thank You very much. I am going to learn more about OpenGL ES functions to render my video frames!
dbrady, thank You very much too. Yes, I am interested in Your solution and I will be very glad to take a look on it!

2014/1/21 dbrady

  1. If you mean changing the resolution that your game runs at, then no.
    Not with the code provided (at least not that I discovered). I hacked the
    provided SDLActivity quite a bit to get that working (You can’t seem to do
    that with a AbsoluteLayout… and changing it to Relative breaks a few
    other things). If anyone’s interested, I might be able to clean up my hacks
    a little and provide them.

_

My two cents on this, don’t change the resolution. Use the same trick that
we recommend on the desktop, set up a render target at your desired
resolution, then at the end of the frame copy to the “desktop” resolution
(or use the render logical size stuff if that suits you).–
Gabriel.

gabomdq wrote:

My two cents on this, don’t change the resolution. Use the same trick that we recommend on the desktop, set up a render target at your desired resolution, then at the end of the frame copy to the “desktop” resolution (or use the render logical size stuff if that suits you).


Gabriel.

Might I ask why? I went this route because it matches better what we do in our engine on ios, and it seemed like the recommended method?

We don’t do any post-effects on mobile, so it seemed like the thing to do…

2014/1/21 dbrady

gabomdq wrote:

My two cents on this, don’t change the resolution. Use the same trick that
we recommend on the desktop, set up a render target at your desired
resolution, then at the end of the frame copy to the “desktop” resolution
(or use the render logical size stuff if that suits you).


Gabriel.

Might I ask why? I went this route because it matches better what we do in
our engine on ios, and it seemed like the recommended method?

http://stackoverflow.com/questions/7656783/how-can-i-automatically-scale-my-opengl-es-2-0-window

We don’t do any post-effects on mobile, so it seemed like the thing to
do…

Does being simpler and not requiring changes in the standard SDLActivity
count as reasons? :slight_smile:

Of course, the best solution is whatever works for you, I just wanted to
bring up an alternative (consider the upkeep cost of the changes you made
in SDLActivity going forward)–
Gabriel.

Fair enough. Merging with latest has been a bit of pain at times. But I was hoping to get my changes accepted into SDL at some point in the future, as AbsoluteLayouts are deprecated, and it seems like a useful feature. I’m guessing that there wouldn’t be much support for that?

2014/1/21 dbrady

Fair enough. Merging with latest has been a bit of pain at times. But I
was hoping to get my changes accepted into SDL at some point in the future,
as AbsoluteLayouts are deprecated, and it seems like a useful feature. I’m
guessing that there wouldn’t be much support for that?

We had plans to get rid of AbsoluteLayout, actually, because the way to
determine if the on screen keyboard is showing is (believe it or not),
doing some tricks with the layout to see how big your view is, trick which
doesn’t work with the absolute layout we use (at least as far as I tried).

So…patches welcome!–
Gabriel.