Hi All, When designing a 3D game running on Android, we need to enter into 3D (OpenGL) rendering and quit back to 2D rendering from time to time, like this control flow: game title page (2D) -> game main menu (2D) -> game window (3D / OpenGL) -> game main menu (2D). We have made this working well on the emulator by following the design pattern required by SurfaceView:
1) For 2D rendering: Canvas c = _surfaceHolder.lockCanvas(); //Do 2D rendering with canvas _surfaceHolder.unlockCanvasAndPost(c); 2) After entering 3D (OpenGL) rendering: egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); //Do OpenGL rendering egl.eglSwapBuffers(eglDisplay, eglSurface); This works well on the emulator. However on T-Mobile G1 phone, entering 3D (OpenGL) from 2D does not have any problem, but when exit 3D back to 2D, the G1's screen content remained with the last OpenGL rendering and no any 2D rendering can be added on the Surface. I think the reason is because we set the Surface type as "SurfaceHolder.SURFACE_TYPE_GPU" when we create the surface. When I quit from OpenGL, I tried to change the surface type back to "SurfaceHolder.SURFACE_TYPE_NORMAL" but it general IllegalArgument Exception. I guess it is because Android Surface does not allow to change its type dynamically. So my question is: how can we properly exit from OpenGL and make the Surface work again with all 2D rendering? Is there a way to re-create the surface of the View object? By the way, my OpenGl clean-up code is exactly same as the GLSurfaceView sample code, it should have any problem. Many thanks for any suggestions! Hongkun www.omnigsoft.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

