Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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 :)

share|improve this question
add comment

4 Answers 4

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.

share|improve this answer
    
OpenGL work very badly on Emulator!try to use the emulator less as possible. –  VinceFR Jul 27 '12 at 9:15
    
Thanks buddy , I'll try it. :) and there is no need to return Scene object, right? –  dizworld.com Jul 27 '12 at 9:20
    
I think the android original documentation state that the emulator supports no OpenGLES at all :) –  Grimshaw Jul 27 '12 at 12:33
add comment

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.

share|improve this answer
3  
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. –  Josh Petrie Oct 22 '12 at 15:28
add comment

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.

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.