Hi!
Does anyone have expirience with opengl-ui-opengl threading
interraction?
I'am developing a small opengl application. I'am a little bit confused
with separate opengl thread...
Currently, my application is logically separated in two parts - the
controlling one and the rendering one.
The controlling part interracts with user - accepting user input,
changing activities, dealing with files and so on.
The rendering part - just render everything it should.
Ok, so when I need to load new texture to opengl (unfortunatelly its
large and I cant reduce its size), I'd like to show a ProgerssDialog
dialog.
Trying to show it from the open gl thread brings me an exception:
"Can't create handler inside thread that has not called
Looper.prepare()".
Because the initiator of loading is in the ui thread (for example -
user selected a menu option), I'am opening the dialog, adding the load
Runnable to stack on Runnables that will be called in
Render.onDrawFrame and passing there a callback that will be executed
after texture is loaded.
Like this:
//ui
public class Controller extends Activity {
...
protected void loadTexture(InputStream aStream) {
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setTitle("Please wait...");
dialog.setMessage("Loading texture");
dialog.show();
_renderer.loadTexture(_stream, new Runnable() {
@Override
public void run() {
dialog.dismiss();
}});
}
...
}
//gl
public class SceneRenderer implements Renderer {
@Override
public void onDrawFrame(GL10 aGL) {
this.runGLRunnables(aGL);
}
public void loadTexture(final InputStream aStream, final Runnable
aCallback) {
_glRunnablesStack.push(new GLRunnable() {
@Override
public void run(GL10 aGL) {
SceneRenderer.this.doLoadTexture(aStream);
aCallback.run();
};});
}
}
So the question is: Is there any way to show ProgressDialog from the
opengl thread?
I need exactly the ProgressDialog. There is a way to show some
picture, previously loaded, like a splashscreen using opengl renderer,
but I'd like to avoid it.
Thanks!
--
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