We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1478 - Can't load image in SDL2 on Android
Summary: Can't load image in SDL2 on Android
Status: RESOLVED INVALID
Alias: None
Product: SDL_image
Classification: Unclassified
Component: misc (show other bugs)
Version: unspecified
Hardware: ARM Android (All)
: P2 critical
Assignee: Sam Lantinga
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-18 16:58 UTC by Dan Hatch
Modified: 2012-05-16 00:24 UTC (History)
2 users (show)

See Also:


Attachments
Simple test program (1.05 KB, text/x-c++src)
2012-04-18 16:58 UTC, Dan Hatch
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Hatch 2012-04-18 16:58:21 UTC
Created attachment 846 [details]
Simple test program

I'm using the most recent versions of sdl-1.3 and SDL_image from HG. My build environment is Ubuntu 11.10 x86_64.
I've built a simple test program which loads an image and displays it for 5 seconds. The image fails to load, and the app is just a black screen that remains open.
'adb logcat' displays the following:

(loads all .so files just fine)
------------------------------
V/SDL     (  785): pixel format RGB_565
I/SDL     (  785): SDL_Android_Init()
I/SDL     (  785): SDL_Android_Init() finished!
W/SDL/APP (  785): **Setting up display
I/Process (   80): Sending signal. PID: 785 SIG: 3
I/dalvikvm(  785): threadid=3: reacting to signal 3
W/SDL/APP (  785): **Error::Video driver doesn't support changing display mode
V/SDL     (  785): Starting up OpenGL ES 1.1
D/libEGL  (  785): Emulator without GPU support detected. Fallback to software renderer.
D/libEGL  (  785): loaded /system/lib/egl/libGLES_android.so
I/dalvikvm(  785): Wrote stack traces to '/data/anr/traces.txt'
D/gralloc_goldfish(  785): Emulator without GPU emulation detected.
I/SDL     (  785): [STUB] GL_SetSwapInterval
I/SDL     (  785): [STUB] GL_GetSwapInterval
W/SDL/APP (  785): **Loading Image /sdcard/data/images/test.jpg
W/SDL/APP (  785): **Error::Image Failed to Load
W/SDL/APP (  785): **Displaying Image
W/SDL/APP (  785): **Error::Invalid texture
I/ActivityManager(   80): Displayed org.libsdl.app/.SDLActivity: +2s172ms
W/InputManagerService(   80): Starting input on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@41593c58 (uid=10013 pid=177)
W/NetworkManagementSocketTagger(   80): setKernelCountSet(10013, 0) failed with errno -2
------------------------------
The files exists inside the emulator:
$adb shell
# ls /sdcard/data/images/
default.png
grass(old).png
grass.png
items.png
monster.png
objects.png
objectsheet.xcf
pirate.png
pog.png
stoneblock.png
test.jpg

I think I am having a similar problem as described in this post:
http://forums.libsdl.org/viewtopic.php?t=8037&sid=6e8774e5eb3b0e7b83be13d7bfe1fcf6
Comment 1 Dan Hatch 2012-04-19 13:25:07 UTC
I'm also getting an 'invalid renderer'
Comment 2 Dan Hatch 2012-04-20 14:28:59 UTC
Tested on 2.1 and 4.0.3 emulators and a 2.3 device. All platforms show same errors.
Comment 3 Gabriel Jacobo 2012-05-11 11:32:25 UTC
You are loading the image from an absolute path outside of the Android package. By default IMG_Load under Android will, iirc, load images using RWops and the paths have to be specified relative to the assets folder (ie, whatever you drop into the assets folder of the Android project you can load it as if it where in a "virtual root").
Comment 4 Dan Hatch 2012-05-16 00:24:46 UTC
(In reply to comment #3)
> You are loading the image from an absolute path outside of the Android package.
> By default IMG_Load under Android will, iirc, load images using RWops and the
> paths have to be specified relative to the assets folder (ie, whatever you drop
> into the assets folder of the Android project you can load it as if it where in
> a "virtual root").

Ok, cool thanks, I'll give it a try :)