Issue
package com.example.tictactoe3d;
import min3d.core.Object3dContainer;
import min3d.core.RendererActivity;
import min3d.parser.IParser;
import min3d.parser.Parser;
import min3d.vos.Light;
public class MainActivity extends RendererActivity {
private Object3dContainer objModel;
@Override
public void initScene() {
scene.lights().add(new Light());
IParser parser = Parser.createParser(Parser.Type.OBJ,getResources(), "res/raw/camaro_obj" , true);
parser.parse();
objModel = parser.getParsedObject();
//objModel.scale().x = objModel.scale().y = objModel.scale().z = .7f;
scene.addChild(objModel);
}
@Override
public void updateScene() {
//objModel.rotation().x++;
//objModel.rotation().z++;
scene.camera().position.setAll(0,0,5);
}
}
I am getting a resource not found exception coming out into the log of Eclipse ADT. The min3d library I am using requires to access the resource with a string. I am able to access the resource using R.raw.camaro_obj with the auto complete however the min3d library wants to access that same resource with a string. I have tried:
"com.example.tictactoe3d:raw/camaro_obj"
"res/raw/camaro_obj"
"raw/camaro_obj"
Is there some way to access the resource "res/raw/camaro_obj" by string somehow?
Thanks...
The call in min3d sample project looks like this:
IParser parser = Parser.createParser(Parser.Type.OBJ,getResources(), "min3d.sampleProject1:raw/test2_obj" , true);
The code that is actually called by that line is doing this:
public AParser(Resources resources, String resourceID, Boolean generateMipMap)
{
this();
this.resources = resources;
this.resourceID = resourceID;
if (resourceID.indexOf(":") > -1)
this.packageID = resourceID.split(":")[0];
this.generateMipMap = generateMipMap;
}
Solution
You normally don't use a string, you access them by id. R.raw.camaro_obj will be an int and you can get an input stream to it by calling getResources().openRawResources(R.raw.camaro_obj);
Edit:
I did some googling, this http://androidbook.blogspot.com/2009/08/referring-to-android-resources-using.html may help
Answered By - Gabe Sechan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.