Question

I'm trying to make an aplication that loads an 3d object.

when i load this object (http://rgcouto.net/alexandre/COKE/fineObj/), all works fine. screenshot: http://rgcouto.net/alexandre/COKE/Screenshot_2013-01-10-15-04-42.png

But when i try load my object (http://rgcouto.net/alexandre/COKE/myObj/), exported from blender, the texture doesn't appear and the object is dark.. screenshot: http://rgcouto.net/alexandre/COKE/Screenshot_2013-01-10-15-02-27.png

What did I do wrong? What i have to do, to make my object appear with texture?

My Blend file:http://rgcouto.net/alexandre/COKE/blend/

My renderer:

public class ObjRenderer extends RajawaliRenderer {
    private static final String TAG = "renderer";
    private BaseObject3D mObjectGroup;
    Number3D mAccValues;

    public ObjRenderer(Context context) {
        super(context);
        setFrameRate(60);
        mAccValues = new Number3D();

}

protected void initScene() {

    // mLight = new DirectionalLight(1, -1, 1);
    // mLight.setPower(.9f);
    DirectionalLight light = new DirectionalLight(0, 0, 1);
    light.setPower(1);

    // light.setPosition(0, 20, -20);
    // light.setLookAt(0, 0, 0);

    mCamera.setPosition(0, 0, -14);
    mCamera.setLookAt(0, 0, 0);

    ObjParser objParser = new ObjParser(mContext.getResources(),
            mTextureManager, R.raw.camaro_obj);
    objParser.parse();
    mObjectGroup = objParser.getParsedObject();
    Log.d(TAG, "carreguei");
    DiffuseMaterial material = new DiffuseMaterial();
    material.setUseColor(true);
    mObjectGroup.setMaterial(material);
    mObjectGroup.addLight(light);

    // mObjectGroup.setScale(3);
    addChild(mObjectGroup);

    // mCameraAnim = new RotateAnimation3D(Axis.Y, 360);
    // mCameraAnim.setDuration(8000);
    // mCameraAnim.setRepeatCount(Animation3D.INFINITE);
    // mCameraAnim.setTransformable3D(mObjectGroup);
}

public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    super.onSurfaceCreated(gl, config);
    // mCameraAnim.start();
}

public void onDrawFrame(GL10 glUnused) {
    super.onDrawFrame(glUnused);
    mObjectGroup.setRotY(mObjectGroup.getRotY() + 1);
    // mObjectGroup.setRotation(mAccValues.y, mAccValues.x, mAccValues.z);
}}

Regards Alex

Was it helpful?

Solution

You have to add a color or texture to your material/object. See here: http://www.rozengain.com/blog/2011/12/05/rajawali-tutorial-3-materials/

To tell you any more I'd have to see the OBJ text.

Cheers

OTHER TIPS

Do you bind the texture before you draw the object?

On many GPUs the texture must be a power of 2 as I have already explained here:

OpenGL, Shader Model 3.3 Texturing: Black Textures?

The effect if you don't use a power of 2 texture is the one you are experiencing, a black rendered texture.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top