eglSurfaceAttrib没有实现android andengine

时间:2013-12-17 05:02:44

标签: android andengine

我是Andengine的新手。我在我的项目中添加了Andengine.jar。我想绘制一个矩形和一条线。但模拟器(API 15)停止黑屏。没有显示

MainActivity.java

package com.example.andengineilkoyun;

import org.andengine.engine.Engine;
import org.andengine.engine.camera.Camera;
import org.andengine.engine.options.EngineOptions;
import org.andengine.engine.options.ScreenOrientation;
import org.andengine.engine.options.resolutionpolicy.FillResolutionPolicy;
import org.andengine.entity.primitive.Line;
import org.andengine.entity.primitive.Rectangle;
import org.andengine.entity.scene.Scene;
import org.andengine.entity.scene.background.Background;
import org.andengine.entity.util.FPSLogger;
import org.andengine.ui.activity.BaseGameActivity;


public class MainActivity extends BaseGameActivity {

    private static final int CAMERA_WIDTH=480;
    private static final int CAMERA_HEIGHT=800;
    private Camera kamera;
    private Scene sahne;
    private Engine motor;

    @Override
    public EngineOptions onCreateEngineOptions() {
        // TODO Auto-generated method stub
        //landscape yerine landscape_fixed yazdım
        //
        kamera=new Camera(0,0,CAMERA_WIDTH,CAMERA_HEIGHT);
        final EngineOptions motorAyarlari=new EngineOptions(true,ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(),kamera);
        motorAyarlari.getTouchOptions().setNeedsMultiTouch(true);
        motorAyarlari.getTouchOptions().setTouchEventIntervalMilliseconds(500);
        motor=new Engine(motorAyarlari);

        return motorAyarlari;
    }

    @Override
    public void onCreateResources(OnCreateResourcesCallback arg0)
            throws Exception {


    }

    @Override
    public void onCreateScene(OnCreateSceneCallback arg0) throws Exception {

        this.motor.registerUpdateHandler(new FPSLogger());
        this.sahne=new Scene();

        sahne.setBackground(new Background(0.5f,0.5f,0.5f));
        Line cizgi=new Line(20,20,780,20,null);
        Rectangle dikdortgen=new Rectangle(0,0,40,50,motor.getVertexBufferObjectManager());

        this.sahne.attachChild(cizgi);
        this.sahne.attachChild(dikdortgen);

    }

    @Override
    public void onPopulateScene(Scene arg0, OnPopulateSceneCallback arg1)
            throws Exception {


    }

}

错误:

12-17 04:32:44.780: D/AndEngine(1575): MainActivity.onCreate @(Thread: 'main')
12-17 04:32:45.080: D/AndEngine(1575): MainActivity.onResume @(Thread: 'main')
12-17 04:32:45.160: D/libEGL(1575): loaded /system/lib/egl/libGLES_android.so
12-17 04:32:45.200: I/dalvikvm(1575): threadid=3: reacting to signal 3
12-17 04:32:45.241: I/dalvikvm(1575): Wrote stack traces to '/data/anr/traces.txt'
12-17 04:32:45.250: D/libEGL(1575): loaded /system/lib/egl/libEGL_emulation.so
12-17 04:32:45.250: D/(1575): HostConnection::get() New Host Connection established 0x9ae0b30, tid 1575
12-17 04:32:45.350: D/libEGL(1575): loaded /system/lib/egl/libGLESv1_CM_emulation.so
12-17 04:32:45.360: D/libEGL(1575): loaded /system/lib/egl/libGLESv2_emulation.so
12-17 04:32:45.505: W/EGL_emulation(1575): eglSurfaceAttrib not implemented
12-17 04:32:45.522: D/OpenGLRenderer(1575): Enabling debug mode 0
12-17 04:32:45.650: D/(1575): HostConnection::get() New Host Connection established 0x9a7c0b0, tid 1590
12-17 04:32:45.680: I/dalvikvm(1575): threadid=3: reacting to signal 3
12-17 04:32:45.740: I/dalvikvm(1575): Wrote stack traces to '/data/anr/traces.txt'
12-17 04:32:46.070: D/AndEngine(1575): VERSION: OpenGL ES 2.0 (3.3.0)
12-17 04:32:46.070: D/AndEngine(1575): RENDERER: Android Emulator OpenGL ES Translator (GeForce GT 130M/PCIe/SSE2)
12-17 04:32:46.070: D/AndEngine(1575): EGLCONFIG: EGLConfig(Red=5, Green=6, Blue=5, Alpha=0, Depth=24, Stencil=0)
12-17 04:32:46.070: D/AndEngine(1575): EXTENSIONS: GL_OES_EGL_image GL_OES_depth24 GL_OES_depth32 GL_OES_element_index_uint GL_OES_texture_float GL_OES_texture_float_linear GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_packed_depth_stencil GL_OES_vertex_half_float 
12-17 04:32:46.090: D/AndEngine(1575): MAX_VERTEX_ATTRIBS: 16
12-17 04:32:46.090: D/AndEngine(1575): MAX_VERTEX_UNIFORM_VECTORS: 1024
12-17 04:32:46.090: D/AndEngine(1575): MAX_FRAGMENT_UNIFORM_VECTORS: 512
12-17 04:32:46.090: D/AndEngine(1575): MAX_TEXTURE_IMAGE_UNITS: 32
12-17 04:32:46.090: D/AndEngine(1575): MAX_TEXTURE_SIZE: 8192
12-17 04:32:46.090: D/AndEngine(1575): MainActivity.onSurfaceCreated @(Thread: 'GLThread 88')
12-17 04:32:46.090: D/AndEngine(1575): MainActivity.onCreateGame @(Thread: 'GLThread 88')
12-17 04:32:46.121: D/AndEngine(1575): MainActivity.onCreateResources @(Thread: 'GLThread 88')
12-17 04:32:46.121: D/AndEngine(1575): MainActivity.onSurfaceChanged(Width=480,  Height=800) @(Thread: 'GLThread 88')
12-17 04:32:46.230: I/dalvikvm(1575): threadid=3: reacting to signal 3
12-17 04:32:46.240: I/dalvikvm(1575): Wrote stack traces to '/data/anr/traces.txt'

我的错误是什么?

1 个答案:

答案 0 :(得分:0)

请找到andengine的完整设置[添加到我的dropbox]。     安装程序设置的步骤:

Step 1 : First download all the extension i hv attached with this answer.

Step 2 : Import all the projects in Eclipse IDE

Step 3 : Add the library required in example project and othere extension there, just right click the project go to Android option there will be library imported if it show red cross plz remove that and add again as shown below :
 Note : plz note that here all the extends need Andengine project as lib in its project, so all the realted to each other..

您的项目设置应如下所示:

enter image description here