www.jpct.net
jPCT-AE - a 3d engine for Android => Support => Topic started by: AGP on August 19, 2011, 09:14:38 pm
-
Texture texture = new Texture(BitmapHelper.rescale(BitmapHelper.convert(R.drawable.andersondiffuse), 128, 128)) doesn't seem to work. I have an image named andersondiffuse.png in each of my three res\drawable directories. The Android docs say I'm doing it right (http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap (http://developer.android.com/guide/topics/resources/drawable-resource.html#Bitmap)). What gives?
-
And the exact problem is... ???
-
It didn't compile. But I fixed an issue whereby the R.java wasn't being re-generated and it worked, thanks. Now I'm having trouble loading the model (what path do I pass to FileInputStream for a OBJ file at res/drawable-hdpi?). Thanks in advance.
-
Don't put your resources into drawable. Put it into raw (you might have to create that) or assets instead. You are just doing unnecessary scaling and conversions this way.
-
OK, good advice, but then how do I reference that programmatically? How would I load anderson.obj from res/raw/anderson.obj?
-
Just like
res.openRawResource(R.raw.anderson)
-
Thanks a lot.
-
And if you use the asset folder it's just:
// Create a stream to grab the data from the 3DS model file.
AssetManager.AssetInputStream inStream = (AssetInputStream) assetManager.open(fileName);
// Insert all of the models from the file into an array of Object3D's.
tempObjects = Loader.load3DS(inStream, 1.0f);