Author Topic: Black color of the object rendered as transparent  (Read 394 times)

Offline ares91x

  • byte
  • *
  • Posts: 6
    • View Profile
Black color of the object rendered as transparent
« on: June 19, 2016, 04:08:14 pm »
Hi ,
someone has any idea why the BLACK COLOR of the 3D object is rendered as transparent. The object is a .3DS
This is the onDrawFrame func:
Code: [Select]
@Override
    public void onDrawFrame(GL10 gl10) {
        try {
            float[] projectionCamera = ARToolKit.getInstance().getProjectionMatrix();
            projMatrix.setIdentity();
            projMatrix.setDump(projectionCamera);
            projMatrix.transformToGL();
            SimpleVector translation = projMatrix.getTranslation();
            SimpleVector dir = projMatrix.getZAxis();
            SimpleVector up = projMatrix.getYAxis();
            cam.setPosition(translation);
            cam.setOrientation(dir, up);

            if (ARToolKit.getInstance().queryMarkerVisible(markerID)) {
                float[] transformation = ARToolKit.getInstance().queryMarkerTransformation(markerID);

                object3d.setIdentity();
                object3d.setDump(transformation);
                object3d.transformToGL();

                thing.clearTranslation();

                thing.translate(object3d.getTranslation());
                thing.setRotationMatrix(object3d);
                thing.scale(GlobalVar.getScale());
            }


            //buffer.clear(colorBLACK);
            world.renderScene(buffer);
            world.draw(buffer);
            //buffer.display();
        }catch (Exception e){
            //Log.d("esx","ERRORE RenderARESX.java  onDrawFrame(GL10 gl10) : "+e.toString());
            e.printStackTrace();
        }
    }

*The commented lines has no effect

Any idea how to solve?
This is a screenshot:

THX and sorry for my english

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11777
    • View Profile
    • http://www.jpct.net
Re: Black color of the object rendered as transparent
« Reply #1 on: June 19, 2016, 05:37:50 pm »
That's the default behaviour for transparent objects. By default, black areas of the texture will become transparent. If you don't want that: Make sure that your object isn't transparent by accident. Some 3ds files carry this information even if the object is not supposed to be transparent. In that case, add a obj.setTransparency(-1). If it's supposed to be transparent, disable the default behaviour by creating the texture with the alternative constructor that takes a boolean in addition. Set that boolean to true.