0
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;
}

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

4 Comments

I understand but if you look at min3d you will find that the call is ""min3d.sampleProject1:raw/test2_obj" which works fine in the sample project. In this case I must supply a string like the one in the sample project.
I am wondering perhaps if I should just rename and move the sample project which is working... For some reason when I move to a new project I am having a hard time duplicating the way the resources are being accessed.
I'm not sure yet if it matters but the sample project wants android-4 where the new project I created is android-17. Perhaps is there some change in convention?
I just put an edit in with the results of some google searching. It may help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.