You are queening events from constructor so they may be executed before
context is created and bound (make current in render thread - if you check
GLSurfaceView you will notice that renderer thread is started when renderer
instance is set but egl will not be initialized until surface is attached,
but queued event may be processed anyway). Usually all resource
initialization is made in onSurfaceCreated callback.
I also noticed this fragment:
if (dt < 33)
try {
Thread.sleep(33 - dt);
} catch (InterruptedException e) {
System.err.println("Failed to limit FPS");
e.printStackTrace();
}
else {
Never do that - openGL will throttle your rendering thread anyway (on swap)
and doing manual throttling is almost guarantee vsync miss.
And last but not least - if you want to make game you should really use
some game engine (there are a lot of them: libgdx, andengine, jmonkeyengine
and probably more). Writing game engine is fun and all but it's much bigger
task than game itself.
--
Bart
--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.