13.07.2015 Views

OpenGL ES* 1.0 Framework Software Developer's Guide

OpenGL ES* 1.0 Framework Software Developer's Guide

OpenGL ES* 1.0 Framework Software Developer's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>OpenGL</strong> ES <strong>Framework</strong> ImplementationR3.5 Power Management ExtensionsOn a handheld device, power management events such as sleep, resume from sleep, etc. can occurat any time while an application is running. The application may or may not have advanced noticethat such an event is going to occur. When the system returns from the power management event,the EGLContext will be invalid and all subsequent <strong>OpenGL</strong> calls on this context will have noeffect.To detect this state, upon return from a power management event, calls to eglSwapBuffers,eglCopyBuffer or eglMakeCurrent will fail and return EGL_FALSE. The application should calleglGetError and check for “EGL_CONTEXT_LOST_IMG”.If this error is detected, the application must destroy all contexts by calling eglDestroyContext foreach context. The application must then recreate contexts, restore GL states and objects, andreload surfaces prior to resuming the rendering loop.Note: The 2700G Multimedia Accelerator Reference Platform does not support the “sleep” event and,therefore, will not trigger the power management extensions.Figure 6. Pseudo-code to detect power management eventseglSwapBuffersif eglSwapBuffers failedthenif eglGetError returns EGL_CONTEXT_LOST_IMG//detected resume from sleep modethen{//release current context//release current EGL surfaces//shut down EGL//recreate current EGL surfaces//re-load textures and set states}//check if eglSwapBuffers works nowif eglSwapBuffers failsthen exit // something else is wrong}else{//eglSwapBuffers failed and not EGL_CONTEXT_LOST_IMGexit;}<strong>OpenGL</strong> <strong>ES*</strong> <strong>1.0</strong> <strong>Framework</strong> <strong>Software</strong> Developer’s <strong>Guide</strong> 27

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!