나는 안드로이드 개발에 익숙합니다. 기본 활동,지도, sqlite 등을 알고 있습니다. 일부 3D 객체를 구현할 수 있기를 바랍니다. 내 애플 리케이션 내에서 상호 작용할 수 있습니다. 탐구의 조금 후에 나는 rajawali가 제일 방법 인 것을 찾아 냈다. 처음 튜토리얼을 시작하고 예제 문서에서 소스 코드를 읽었습니다. 내가 잃어버린 곳은 단어에 대한 튜토리얼 단어를 따라 왔고 스크립트의 오류로 인해 애플리케이션을 실행할 수 없다. 만약 내가 잘못한 부분에 대해 약간의 조언을하기 전에 누군가 Rajawali를 사용했다면. (튜토리얼은 2 개월 전 마지막 업데이트되었습니다.) 여기어떻게하면 rajawali가 작동할까요? (git on tutorial 1)
Tutorial 내 소스 코드
MainActivity입니다 :
package rajawali.tutorials;
import rajawali.RajawaliActivity;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends RajawaliActivity {
private Renderer mRenderer;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mRenderer = new Renderer(this);
mRenderer.setSurfaceView(mSurfaceView);
super.setRenderer(mRenderer);
}
}
렌더러 :
package rajawali.tutorials;
import javax.microedition.khronos.opengles.GL10;
import android.content.Context;
import rajawali.lights.DirectionalLight;
import rajawali.materials.textures.ATexture.TextureException;
import rajawali.materials.textures.Texture;
import rajawali.primitives.Sphere;
import rajawali.renderer.RajawaliRenderer;
public class Renderer extends RajawaliRenderer {
private DirectionalLight mLight;
Sphere mSphere;
public Renderer(Context context) {
super(context);
setFrameRate(60);
}
public void initScene() {
mLight = new DirectionalLight(1f, 0.2f, -1.0f);
mLight.setColor(1.0f, 1.0f, 1.0f);
mLight.setPower(2);
try {
*DiffuseMaterial* material = new *DiffuseMaterial*(); //there is an error here (DiffuseMaterial cannot be rsolved as a type)
material.addTexture(new *Texture(R.drawable.earthtruecolor_nasa_big)*); //here (constructor Texture(int) cannot be defined)
mSphere = new Sphere(1, 24, 24);
mSphere.setMaterial(material);
mSphere.*addLight(mLight)*; //and here (The method addLight(DirectionalLight) is undefined for the type Sphere)
addChild(mSphere);
} catch (TextureException e) {
e.printStackTrace();
}
getCurrentCamera().setZ(4.2f);
}
@Override
public void onDrawFrame(GL10 glUnused) {
super.onDrawFrame(glUnused);
mSphere.setRotY(mSphere.getRotY() + 1);
}
}
나는 정말 내가 그것을 도울 수 있다면 숟가락 피드 코드를 싶지 않아
그러나 그것을 오류가 'DiffuseMaterial'에있는 것으로 나타납니다. 왜이 것이거나 min3D 또는 Rajawali를 사용하는 것 이외의 3D 객체를 조작하는 더 좋은 방법이 있습니까?
감사합니다. 튜토리얼이 왜 작동하지 않는지 궁금합니다. 나머지 자습서는 이와 같이 있습니까? –
확실하지는 않지만, 다른 튜토리얼을 시도하지는 않았지만 이전 버전의 rajawali에 대한 튜토리얼이 만들어진 것처럼 보입니다. – doanvelagui
super.addChild가 더 이상 작동하지 않는 것 같습니다. 'getCurrentScene(). addChild'가 작동합니다. – nunespascal