Added: 1 year ago
From: cyborusDev
Views: 4,305
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (23)

Sign In or Sign Up now to post a comment!
  • Those are some big rings below your eyes man!

  • Great, thanks for sharing this, quite interesting to know :)

  • I see your frustration, but this is intentional. What about people running multiple apps that use OpenGL? There's one device, so one instance makes sense.

    By using onPause(), onClose(), onStart(), and onResume(), you should be able to handle these issues.

    And if you really want to (and it seems you do), you can call finish() to exit your app at any time you like. Yup, it'll do it.

    Oh yeah, these are all methods you call from your Activity.

    -scott biggs

  • there's no way to preserve data? instances? bundle data? never heard of that?

  • im new to android and im just learning java, i wanted to know how to make 3d games for android, is opengl a different program or does it come in eclipse thanks

  • I'm note sure, but i think this is done with: protected void onPause(){ super.onPause(); mGLView.onPause(); } protected void onResume(){ super.onResume(); mGLView.onResume(); }

    }

    I think the View.onPause should keep the state of the GL scene, But i'm just starting to mess with And-OGL. Let me know if i'm wrong... got this from: developer.android.com/resource­s/tutorials/opengl/opengl-es10­.html

  • I'm not an android dev, but isn't there an event fired when the home button is pressed (onThombstone or something?) that way you can really quit your app (possibly save game state) so that you dont have to worry about this?

  • Nice video! I've coded some Android stuff and some OpenGL, but not a single line of OpenGL on Android. However, this is how I assumed it'd work. Isn't it is obvious that you can't rely on the context being present when you switch back considering that the Activity might get automagically get deleted if there's only tiny amount of memory left on the system etc?

  • Awesome!

    fullbleed T-Shirt?

  • Reminds me of onResetDevice() in DirectX on Windows. Interesting.

    Have to rebuild/reload everything that isn't managed by DirectX when ALT-Tab is pressed in a full-screen app.

  • onLoad() man... thats all we need! :)

  • "Renderer.onSurfaceCreated (GL10 gl, EGLConfig config)

    Called when the surface is created or recreated.

    ...

    Since this method is called at the beginning of rendering, as well as every time the EGL context is lost, this method is a convenient place to put code to create resources that need to be created when the rendering starts, and that need to be recreated when the EGL context is lost..."

    I was more worried that GL resources would get out of hand. I think this is fairly reasonable.

  • @xinaesthetic I used onSurfaceCreated as the entry point for restoring all the OpenGL assets. So yeah, it was not a terribly difficult fix. It's just frustrating that the assets die in the first place.

  • @cyborusDev in a way it's frustrating.... but there could be a lot of garbage otherwise. Anyway, it wasn't too badly hidden in the documentation. At least, it so happened that *particular* thing didn't catch me out; I had some obscurity with glCopyTexSubImage2d not working but that's a different story.

  • Have you check to see if its the cell phone?

    

  • @plutoamun What? Like as if my phone is defective or something?

  • That really blows, oh well I see why it would be that way

  • This reminds me of what happens with XNA/Windows Phone. You've got to recreate all your device objects when this happens, but at least with XNA, they're pretty explicit about it.

  • Are you using the NDK or Java?

    If you're using Java, you can simply use GLSurfaceView + GLSurfaceView.Renderer to capture the events (+it shifts rendering out into a seperate thread).

  • @MilchTheShake I'm using both. I have a GLSurfaceView piping rendering events off to NDK code.

  • Yeah lost resources or even a lost device is a common problem on Windows with DirectX aswell. Even OpenGL could need some restoring after a window switch. Linux on the other side handles OpenGL contexts much better, never ever had a lost resource with it. Best way to handle this in my opinion is some sort of restore chain through the engine which is called when a device was lost. It checks if resources need to be reloaded and so on.

  • That sucks!! I've never used OpenGL (plan too at some stage, I think i tried it a while back for like 10 minutes, but that was it) by the sounds of things you could potentially end up with having to reload a LOT of assets on program "entry" now i know why there is a short pause with some of my android applications such as gameboid when i open it up again from its "sleep state"

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more