Well there's an API calls that can easily load several different standard 
graphics file formats, for example:

//Get the texture from the Android resource directory
InputStream is = 
context.getResources().openRawResource(R.drawable.onlylowercasefilenameshere);
Bitmap bitmap = null;
try {
//BitmapFactory is an Android graphics utility for images
bitmap = BitmapFactory.decodeStream(is);

} finally {
//Always clear and close
try {
is.close();
is = null;
} catch (IOException e) {
}
}

If you are concerned about people replacing your image files with something 
else, then you can make that more difficult by doing some sort of checksum 
before using them. Otherwise, if you are concerned with people getting 
exact copies of standard image files, I don't know what to tell you. I 
wonder if anybody can suggest an efficient solution for that?


On Thursday, March 1, 2012 4:34:00 AM UTC-7, Jim Andresakis wrote:
>
> Im using min3d to draw 3d boxes and Im applying textures to them in the 
> updateScene method which works great on some devices and on others the 
> textures wont load. Ive tried debugging by turning on the 
> glflags but I dont see any errors what so ever. Ive done a lot of reading 
> and googling the past two days on the matter and it looks like theres no 
> real good answer on why opengl would work on one device and not on another.
>
> So far Ive tried making sure the images were in the power of two and that 
> wasnt it. 
>
> The way that Im accessing the images to use as bitmaps is by pulling 
> bitmaps from images that are stored on the devices internal file system. I 
> read in one thread some where that instead of decoding a file to make a 
> bitmap
> you could turn the file into a stream and then decode that as a bitmap and 
> that would work but I havent even tried doing that since I spent most of my 
> time trying to debug to find any nullpointers or anything. At first I 
> thought I had found some null textures but they were just textures that 
> hadnt initialized yet.
>
> So as this is a common problem on android I was hoping others could help 
> me out by shedding some light on how they tackled the problem of opengl 
> textures not loading on certain devices. 
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to