Problem building/running on Android (emulator)

Got logcat:

E/NME     (  952): GL Error: 1280 7x9
E/NME     (  952): GL Error: 1280 12x17
E/NME     (  952): GL Error: 1280 13x17
E/NME     (  952): GL Error: 1280 12x17
E/NME     (  952): GL Error: 1280 13x17
E/NME     (  952): GL Error: 1280 15x17

Where 1280 is GL_INVALID_ENUM

Sadly, OpenGL is pretty passive about errors. It sets an error flag whenever something goes wrong, and it’s up to you to check it.

Here are some functions to make your life easier:

public static inline function checkGLError(?posInfos:haxe.PosInfos):Void {
    var error:Int = GL.getError();
    if(error != GL.NO_ERROR) {
        haxe.Log.trace("GL error: " + getErrorDescription(error), posInfos);
    }
}
public static function getErrorDescription(error:Int):String {
    switch(error) {
        case GL.NO_ERROR:
            return "NO_ERROR";
        case GL.INVALID_ENUM:
            return "INVALID_ENUM";
        case GL.INVALID_OPERATION:
            return "INVALID_OPERATION";
        case GL.INVALID_FRAMEBUFFER_OPERATION:
            return "INVALID_FRAMEBUFFER_OPERATION";
        case GL.INVALID_VALUE:
            return "INVALID_VALUE";
        case GL.OUT_OF_MEMORY:
            return "OUT_OF_MEMORY";
        default:
            return Std.string(error);
    }
}

Call checkGLError() after every OpenGL operation, and it’ll tell you when and where something is going wrong. (Make sure you don’t supply the posInfos parameter. Haxe will fill that in automatically.)

Once you figure out which OpenGL function is causing it, look up that function online. The man page will tell you why that function would cause that error.

Actually I don’t have any problems with opengl - when I use raw OpenGLView all works perfectly, including any textures and complex shaders.

Probles is with OpenFl itself - it can’t display a bitmap on android-x86 (at least on emulator)

@singmajesty Any thoughts about this? I want to help track it down, but I need directions where to look.

What we have:

  • Everything works fine on android-arm
  • Everything except bitmaps work fine on android-x86
  • Host GPU is used
  • No problems when using GL.blahblah to load texture and display it
  • No problems with custom shaders (using GL.blablabla)
  • The only problem - displaying Bitmap (for example, when addChild(myBitmap)) (draw tiles also renders black boxes)

Actually I’ve got the same problem (bitmap black) on ARM and X86.
So the first line of your recap (everything’s fine on ARM) doesn’t apply to me
(API21, Host GPU yes)

I suppose it’s only an EMULATOR problem, but I can’t test on a real device right now

example on ARM emulator (same as x86)
What you see are lines on a sprite (there are a lot of BITMAPS around that are drawn BLACK)

I think there’s a subtle graphics card bug in there – but by “graphics card bug” I mean in the emulation layer. This could be tracked down, though unfortunately it may be hard to find. The OpenFL “next” path that’s developing should make it easier to know what’s going on in the renderer, and find/patch any improvements

Better to test on a real device I suppose…
I have to find one :wink:

If anybody solve this please post it here!

Might also be interesting to “lime rebuild android” and try DisplayingABitmap using “lime test android -Dnext”

Update

Just tried on openfl 3 (without legacy). Works fine :smile:
Except one strange thing when Tilesheet.TILE_BLEND_ADD flag is used

(it is not 1st aprils fool)

wow, new strange thing (still not fool) - when I close app and reopen again:

(only when Tilesheet.TILE_BLEND_ADD flag is used)

this is quite a good news :wink: