E/libEGL: call to OpenGL ES API with no current context

26 views
Skip to first unread message

Andres Q

unread,
Feb 12, 2019, 2:47:13 PM2/12/19
to pl...@googlegroups.com
Hi,

On my Android Activity I'm doing something similar to
playn.showcase.android.ShowcaseActivity to handle the back button:

@Override
public void onBackPressed() {
if (game.onMenu()) {
super.onBackPressed();
} else {
game.gotoMenu();
}
}

game is a SceneGame and gotoMenu simply replaces the screen with the
menu screen:

public void gotoMenu() {
screens.replace(new MenuScreen(this));
}

this MenuScreen includes some labels with icons which I'm creating
using Icons.image(...)

When I click the back button on Android I get:

E/libEGL: call to OpenGL ES API with no current context (logged once per thread)

which I *think* is being throws on the state() method of the anonymous
class returned by Icons.image:

return source.tileAsync().map(Functions.constant((Icon)this));

At first I thought I should wrap the contents of onBackPressed in a
runOnUiThread() block, but it didn't fix the problem

Any ideas what am I doing wrong?

thanks!

Guillermo Rodriguez Garcia

unread,
Feb 13, 2019, 6:23:36 AM2/13/19
to PlayN
Hi,
I wouldn't expect that to make any difference, as onBackPressed is always called on the UI thread already.
 

Any ideas what am I doing wrong?

I don't know but I would try to start by validating your assumption that the error is being thrown in the state() method of the anonymous class returned by Icons.image.
The easiest way to do that would be to just remove the icons from your MenuPage and see if you still get the same error..

BR,

Guillermo

Andres Q

unread,
Feb 13, 2019, 7:46:58 AM2/13/19
to pl...@googlegroups.com
I removed the icons from the screen but still failed. Eventually I
figured out that the error was more explanatory that I thought, and
realized that the onBackPressed() on Android is called from the main
thread and not the GLThread, which lead me to
playn.tests.android.TestsGameActivity which handles exactly that case!

on the activity:

@Override public void onBackPressed () {
if (!game.onHardwardBack()) super.onBackPressed();
}

on the game:

public boolean onHardwardBack () {
if (currentTest == null) return false;
displayMenuLater(); // we're not currently on the GL thread
return true;
}

I did it that way and the error is gone

thanks!

El mié., 13 de feb. de 2019 a la(s) 08:23, Guillermo Rodriguez Garcia
(guille.r...@gmail.com) escribió:
> --
>
> ---
> You received this message because you are subscribed to the Google Groups "PlayN" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to playn+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Guillermo Rodriguez Garcia

unread,
Feb 13, 2019, 7:52:10 AM2/13/19
to pl...@googlegroups.com
I'm glad that it helped :-)
--
Guillermo Rodriguez Garcia
guille.r...@gmail.com
Reply all
Reply to author
Forward
0 new messages