Displaying the ProgressDialog from the OpenGL thread.

by Dmitriy Shilonosov » Wed, 12 May 2010 15:13:07 GMT

Sponsored Links

Does anyone have expirience with opengl-ui-opengl threading

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
Trying to show it from the open gl thread brings me an exception:
"Can't create handler inside thread that has not called
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:


public class Controller extends Activity {


  protected void loadTexture(InputStream aStream) {
    final ProgressDialog dialog = new ProgressDialog(this);
    dialog.setTitle("Please wait...");
    dialog.setMessage("Loading texture");
    _renderer.loadTexture(_stream, new Runnable() {
      public void run() {



public class SceneRenderer implements Renderer {
  public void onDrawFrame(GL10 aGL) {

  public void loadTexture(final InputStream aStream, final Runnable
aCallback) {
    _glRunnablesStack.push(new GLRunnable() {
    public void run(GL10 aGL) {

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.



Other Threads

1. Double quotes in resources?

I'm probably missing something obvious, but for some reason I don't
manage to put a string with double quotes in a resources file.

      <string name="message_empty_folder">Folder &quot;%s&quot; is

   String format = getResources().getString

Log output:
   Folder %s is empty.

What's eating up the double quotes?

Thanks in advance,


2. polylines or polygons on map

Has anyone sucessfully implemented a polyline or polygon overlay on
the Android Maps?


3. Wallpaper

4. android sources in eclipse and slow 'refreshing external folders'

5. Permission to use bindAppWidgetId()

6. Is it possible to get raw events tuples for keyboard, touch screen etc?

7. Will the droid with andoid 2.0 get updates that give us more home screens>?