static void SDLGL_EndRendering(void *drv) { AG_DriverSDLGL *sgl = drv; AG_GL_Context *gl = &sgl->gl; /* Render to specified capture output. */ if (sgl->outMode != AG_SDLGL_OUT_NONE) SDLGL_CaptureOutput(sgl); glPopAttrib(); if (AGDRIVER_SW(sgl)->flags & AG_DRIVER_SW_OVERLAY) { /* * Restore the OpenGL state exactly to its former state * (all textures are display lists are deleted). */ AG_GL_DestroyContext(gl); } else { SDL_GL_SwapBuffers(); if (gl->clipStates[0]) { glEnable(GL_CLIP_PLANE0); } else { glDisable(GL_CLIP_PLANE0); } if (gl->clipStates[1]) { glEnable(GL_CLIP_PLANE1); } else { glDisable(GL_CLIP_PLANE1); } if (gl->clipStates[2]) { glEnable(GL_CLIP_PLANE2); } else { glDisable(GL_CLIP_PLANE2); } if (gl->clipStates[3]) { glEnable(GL_CLIP_PLANE3); } else { glDisable(GL_CLIP_PLANE3); } } }
static void SDLGL_EndRendering(void *drv) { AG_DriverSDLGL *sgl = drv; Uint i; /* Render to specified capture output. */ if (sgl->outMode != AG_SDLGL_OUT_NONE) SDLGL_CaptureOutput(sgl); if (!(AGDRIVER_SW(sgl)->flags & AG_DRIVER_SW_OVERLAY)) { SDL_GL_SwapBuffers(); if (sgl->clipStates[0]) { glEnable(GL_CLIP_PLANE0); } else { glDisable(GL_CLIP_PLANE0); } if (sgl->clipStates[1]) { glEnable(GL_CLIP_PLANE1); } else { glDisable(GL_CLIP_PLANE1); } if (sgl->clipStates[2]) { glEnable(GL_CLIP_PLANE2); } else { glDisable(GL_CLIP_PLANE2); } if (sgl->clipStates[3]) { glEnable(GL_CLIP_PLANE3); } else { glDisable(GL_CLIP_PLANE3); } } glPopAttrib(); /* Remove textures and display lists queued for deletion. */ glDeleteTextures(sgl->nTextureGC, sgl->textureGC); for (i = 0; i < sgl->nListGC; i++) { glDeleteLists(sgl->listGC[i], 1); } sgl->nTextureGC = 0; sgl->nListGC = 0; #if defined(AG_THREADS) && defined(HAVE_GETTIMEOFDAY) && \ defined(HAVE_CLOCK_GETTIME) && !defined(HAVE_CYGWIN) { extern AG_Cond agCondEndRender; /* Resume any AG_Delay()'ed threads. */ AG_CondBroadcast(&agCondEndRender); } #endif }