0
        public void initScene() {
            ALight light = new DirectionalLight(-1, 0, -1);
            light.setPower(2);
            getCurrentCamera().setPosition(0, 0, 7);
            getCurrentCamera().setLookAt(0, 0, 0);



            try {
                Cube cube = new Cube(1);
                DiffuseMaterial material = new DiffuseMaterial();
                material.addTexture(new Texture(R.drawable.rajawali_tex));
                cube.setMaterial(material);
                cube.addLight(light);
                addChild(cube);

                Vector3 axis = new Vector3(3, 1, 6);
                axis.normalize();

                RotateAnimation3D anim = new RotateAnimation3D(axis, 360);
                anim.setDuration(8000);
                anim.setRepeatMode(RepeatMode.INFINITE);
                anim.setInterpolator(new AccelerateDecelerateInterpolator());
                anim.setTransformable3D(cube);
                registerAnimation(anim);
                anim.play();    
            } 
            catch (TextureException e) {
                e.printStackTrace();
            }
        }

我看到从立方体中移除纹理和光线实际上会导致 Rajawali 下降。我想知道在这种情况下如何将立方体渲染为线框而不是纹理对象。有谁知道如何渲染线框?

提前致谢...

4

2 回答 2

1

cube.setDrawingMode(1);

或者

cube.setDrawingMode(2);

这应该这样做

于 2013-07-22T14:54:04.077 回答
1

您需要使用默认材质并将绘图模式设置为线条,例如:

mSphere = new Sphere(1, 24, 24);

Material material = new Material();

mSphere.setMaterial(material);      
mSphere.setDrawingMode(GLES20.GL_LINES);

getCurrentScene().addChild(mSphere);
于 2014-01-30T14:59:29.550 回答