मैं एंड्रॉइड विकास के लिए काफी नया हूं, मुझे मूलभूत गतिविधियां, मानचित्र, स्क्लाइट इत्यादि पता है मैं कुछ 3 डी ऑब्जेक्ट्स को लागू करने में सक्षम होना चाहता हूं मेरे ऐप्स के साथ बातचीत करने में सक्षम। थोड़ी सी खोज के बाद मैंने पाया कि राजवाली सबसे अच्छी विधि प्रतीत होती है। जैसा कि आप करते हैं मैंने पहले ट्यूटोरियल के साथ शुरुआत की और उदाहरण दस्तावेज़ों से स्रोत कोड पढ़ना शुरू किया। जहां मैं खो गया हूं, मैंने शब्द के लिए ट्यूटोरियल शब्द का पालन किया है और मैं स्क्रिप्ट में त्रुटियों के कारण एप्लिकेशन को चला नहीं सकता। अगर किसी ने राजवाली का इस्तेमाल किया है, तो इससे पहले कि मैं कुछ पॉइंटर्स को समझूंगा कि मैं कहां गलत हूं। (ट्यूटोरियल अंतिम बार 2 महीने पहले अपडेट किया गया था, इसलिए यह काफी हालिया है)। Tutorialआप काम करने के लिए राजवाली कैसे प्राप्त करते हैं (गिट पर ट्यूटोरियल 1)
यहाँ मेरी स्रोत कोड
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);
}
}
मैं नहीं है वास्तव में अगर मैं इसे मदद कर सकते हैं चम्मच फ़ीड कोड होना चाहता हूँ, लेकिन यह ऐसा लगता है कि त्रुटि 'डिफ्यूजमटेरियल' में है। मिनी 3 डी या राजवाली का उपयोग करने के अलावा 3 डी ऑब्जेक्ट्स में हेरफेर करने का यह बेहतर तरीका क्यों है?
यह शानदार है। मुझे आश्चर्य है कि ट्यूटोरियल क्यों काम नहीं करता है। क्या इस तरह के बाकी ट्यूटोरियल हैं? –
यकीन नहीं है, मैंने एक और ट्यूटोरियल करने की कोशिश नहीं की, लेकिन ऐसा लगता है कि ट्यूटोरियल राजवाली के पिछले संस्करण के लिए बनाया गया था। – doanvelagui
super.addChild अब काम नहीं कर रहा है। 'getCurrentScene()। addChild' काम करता है। – nunespascal