0
\$\begingroup\$

I'm new in andengine . I create following code

public class MainActivity extends BaseGameActivity {


static final int CAMERA_WIDTH = 800;
static final int CAMERA_HEIGHT = 480;

public Font mFont;
public Camera mCamera;

//A reference to the current scene
public Scene mCurrentScene;
public static BaseActivity instance;

public EngineOptions onCreateEngineOptions() {
    instance = this;
    mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
}


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

    mFont = FontFactory.create(this.getFontManager(),this.getTextureManager(), 256, 256,Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
            mFont.load();
}

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

    mEngine.registerUpdateHandler(new FPSLogger());
    mCurrentScene = new Scene();
    Log.v("Scene","enter");
            mCurrentScene.setBackground(new Background(0.09804f, 0.7274f, 0.8f));
 //             return mCurrentScene;

}

@Override
public void onPopulateScene(Scene arg0, OnPopulateSceneCallback arg1)
        throws Exception {
    // TODO Auto-generated method stub

}

 }

I got code on sites there is returning scene but in AndEngine GLES2 in method onCreateScene() there is no return scene ... so my First run is BLACK .. any suggestion :)

\$\endgroup\$

4 Answers 4

1
\$\begingroup\$

The definitive answer is that the OpenGL APIs are not implemented on the emulator. Essentially, the OpenGL interface is just a big method stub that does nothing. That means any app that uses OpenGL for rendering will not display on the emulator.

So, yes, use a phone directly to test your application.

\$\endgroup\$
0
\$\begingroup\$

I've already dumped by AndEngine just like you. I copied the source code from the website, struggled with F5 button during 2 hours. And at last, I found that AndEngine GLES2 DIDN'T work in EMULATOR, in a youtube video of AndEngine's author :D.

Just plug your real Android phone and it'll work.

\$\endgroup\$
3
  • \$\begingroup\$ OpenGL work very badly on Emulator!try to use the emulator less as possible. \$\endgroup\$
    – VinceFR
    Jul 27, 2012 at 9:15
  • \$\begingroup\$ Thanks buddy , I'll try it. :) and there is no need to return Scene object, right? \$\endgroup\$ Jul 27, 2012 at 9:20
  • \$\begingroup\$ I think the android original documentation state that the emulator supports no OpenGLES at all :) \$\endgroup\$
    – Grimshaw
    Jul 27, 2012 at 12:33
0
\$\begingroup\$

I had the same problem as you, the onCreateScene method was void.

Check this post, he is using a callback function to initialize the scene.

\$\endgroup\$
1
  • 3
    \$\begingroup\$ If you're going to just link elsewhere, it's usually preferable to also include at least an overview of the technique described in the link to ensure your answer still remains valid if the link dies. \$\endgroup\$
    – user1430
    Oct 22, 2012 at 15:28
0
\$\begingroup\$

Currently the emulator supports OpenGL ES 2.0 and you can run AndEngine apps in it. The latest emulator also allows you to use your graphics hardware. In combination with Intel HAXM driver and the latest Intel Atom images for Android 4+ and 2.3+ this makes the emulator much faster on Intel machines.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .