EJCanvasContext::~EJCanvasContext() { fontCache->release(); // Release all fonts and clip paths from the stack for( int i = 0; i < stateIndex + 1; i++ ) { stateStack[i].font->release(); //stateStack[i].clipPath->release(); } #ifdef _WINDOWS if( viewFrameBuffer ) { glDeleteFramebuffers( 1, &viewFrameBuffer); } if( viewRenderBuffer ) { glDeleteRenderbuffers(1, &viewRenderBuffer); } if( msaaFrameBuffer ) { glDeleteFramebuffers( 1, &msaaFrameBuffer); } if( msaaRenderBuffer ) { glDeleteRenderbuffers(1, &msaaRenderBuffer); } if( stencilBuffer ) { glDeleteRenderbuffers(1, &stencilBuffer); } #else if( viewFrameBuffer ) { glDeleteFramebuffersOES( 1, &viewFrameBuffer); } if( viewRenderBuffer ) { glDeleteRenderbuffersOES(1, &viewRenderBuffer); } if( msaaFrameBuffer ) { glDeleteFramebuffersOES( 1, &msaaFrameBuffer); } if( msaaRenderBuffer ) { glDeleteRenderbuffersOES(1, &msaaRenderBuffer); } if( stencilBuffer ) { glDeleteRenderbuffersOES(1, &stencilBuffer); } #endif path->release(); }
void DestroyRenderingSurfaceGLES(EAGLSurfaceDesc* surface) { if( (surface->msaaFramebuffer || surface->targetFramebuffer) && surface->depthbuffer ) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->depthbuffer) ); surface->depthbuffer = 0; } if(surface->targetRT) { GLES_CHK( glDeleteTextures(1, &surface->targetRT) ); surface->targetRT = 0; } if(surface->targetFramebuffer) { GLES_CHK( glDeleteFramebuffersOES(1, &surface->targetFramebuffer) ); surface->targetFramebuffer = 0; } if(surface->msaaRenderbuffer) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->msaaRenderbuffer) ); surface->msaaRenderbuffer = 0; } if(surface->msaaFramebuffer) { GLES_CHK( glDeleteFramebuffersOES(1, &surface->msaaFramebuffer) ); surface->msaaFramebuffer = 0; } }
GLESFrameBufferObject::~GLESFrameBufferObject() { mManager->releaseRenderBuffer(mDepth); mManager->releaseRenderBuffer(mStencil); mManager->releaseRenderBuffer(mMultisampleColourBuffer); /// Delete framebuffer object glDeleteFramebuffersOES(1, &mFB); GL_CHECK_ERROR; if (mMultisampleFB) glDeleteFramebuffersOES(1, &mMultisampleFB); GL_CHECK_ERROR; }
void GLESFrameBufferObject::notifyOnContextLost() { mManager->releaseRenderBuffer(mDepth); mManager->releaseRenderBuffer(mStencil); mManager->releaseRenderBuffer(mMultisampleColourBuffer); glDeleteFramebuffersOES(1, &mFB); GL_CHECK_ERROR; if (mMultisampleFB) glDeleteFramebuffersOES(1, &mMultisampleFB); GL_CHECK_ERROR; }
// src서피스를 this로 카피. void XSurfaceOpenGL::CopySurface( XSurface *src ) { XSurfaceOpenGL *pSrc = (XSurfaceOpenGL *)src; // src를 FBO에 연결 // glCopyTexImage를 이용해 src에서 this로 옮김. GLuint fbo; glGenFramebuffersOES(1, &fbo); glBindFramebufferOES(GL_FRAMEBUFFER_OES, fbo); glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, pSrc->GetTextureID(), 0); GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); if( status != GL_FRAMEBUFFER_COMPLETE_OES ) { XLOG( "status=%d", status ); return; } // copy texture from framebuffer glBindTexture(GL_TEXTURE_2D, m_textureID); glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, pSrc->GetMemWidth(), pSrc->GetMemHeight()); // FBO해제 GRAPHICS_GL->RestoreFrameBuffer(); glDeleteFramebuffersOES(1, &fbo); }
// -------------------------------------------------------------- openFrameworksDevice::~openFrameworksDevice() { #ifdef ASCOGRAPH_IOS if (drawCache.isAllocated()) glDeleteFramebuffersOES(1, &fbo); #endif }
void DestroySurfaceMultisampleBuffersGLES(EAGLSurfaceDesc* surface) { if(surface->depthbuffer) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->depthbuffer) ); } surface->depthbuffer = 0; if(surface->msaaDepthbuffer) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->msaaDepthbuffer) ); } surface->msaaDepthbuffer = 0; if(surface->msaaRenderbuffer) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->msaaRenderbuffer) ); } surface->msaaRenderbuffer = 0; if (surface->msaaFramebuffer) { GLES_CHK( glDeleteFramebuffersOES(1, &surface->msaaFramebuffer) ); } surface->msaaFramebuffer = 0; }
inline void VL_glDeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { if (glDeleteFramebuffersOES) glDeleteFramebuffersOES(n, framebuffers); else VL_TRAP(); }
void DestroySurfaceGLES(EAGLSurfaceDesc* surface) { if( surface->systemRenderbuffer ) { GLES_CHK( glBindRenderbufferOES(GL_RENDERBUFFER_OES, surface->systemRenderbuffer) ); DeallocateRenderBufferStorageFromEAGLLayer(); GLES_CHK( glBindRenderbufferOES(GL_RENDERBUFFER_OES, 0) ); GLES_CHK( glDeleteRenderbuffersOES(1, &surface->systemRenderbuffer) ); surface->systemRenderbuffer = 0; } if( surface->systemFramebuffer ) { GLES_CHK( glDeleteFramebuffersOES(1, &surface->systemFramebuffer) ); surface->systemFramebuffer = 0; } DestroyRenderingSurfaceGLES(surface); if(surface->depthbuffer) { GLES_CHK( glDeleteRenderbuffersOES(1, &surface->depthbuffer) ); surface->depthbuffer = 0; } }
void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName, bool useReadPixels) { glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); glDeleteFramebuffersOES(1, &fbName); if (!useReadPixels) glDeleteTextures(1, &texName); else glDeleteRenderbuffersOES(1, &texName); }
GL11Renderer::~GL11Renderer() { if( m_snowTextureId ) { glDeleteTextures( 1, &m_snowTextureId ); m_snowTextureId = 0; } if( m_vertexBufferId ) { glDeleteBuffers( 1, &m_vertexBufferId ); m_vertexBufferId = 0; } if( m_colorBufferId ) { glDeleteBuffers( 1, &m_colorBufferId ); m_colorBufferId = 0; } if( m_pointSizeBufferId ) { glDeleteBuffers( 1, &m_pointSizeBufferId ); m_pointSizeBufferId = 0; } if( m_framebuffer ) { glDeleteFramebuffersOES( 1, &m_framebuffer ); m_framebuffer = 0; } if( m_depthRenderbuffer ) { glDeleteFramebuffersOES( 1, &m_depthRenderbuffer ); m_depthRenderbuffer = 0; } if( m_colorRenderbuffer ) { glDeleteRenderbuffersOES( 1, &m_colorRenderbuffer ); m_colorRenderbuffer = 0; } }
void wyRenderTexture::releaseBuffer() { // delete custom frame buffer if(m_fbo != 0) { glDeleteFramebuffersOES(1, (GLuint*)&m_fbo); m_fbo = 0; } // reset old frame buffer object m_old_fbo = 0; }
extern void hdglDeleteTextureFrameBuffer(const GLuint fbo) { #ifndef LEVEL_EDITOR GLuint status; glDeleteFramebuffersOES(1, &fbo); status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); #endif }
void GLESFBOManager::_reload() { glDeleteFramebuffersOES(1, &mTempFBO); GL_CHECK_ERROR; detectFBOFormats(); glGenFramebuffersOES(1, &mTempFBO); GL_CHECK_ERROR; }
GLESFBOManager::~GLESFBOManager() { if(!mRenderBufferMap.empty()) { LogManager::getSingleton().logMessage("GL ES: Warning! GLESFBOManager destructor called, but not all renderbuffers were released."); } glDeleteFramebuffersOES(1, &mTempFBO); GL_CHECK_ERROR; }
OpenGLRTTexture::~OpenGLRTTexture() { if (mFBOID != 0) { glDeleteFramebuffersOES(1, &mFBOID); mFBOID = 0; } if (mRBOID != 0) { glDeleteRenderbuffersOES(1, &mRBOID); mRBOID = 0; } }
void Display::close() { if (m_uFrameBuffer != GL_INVALID_VALUE) { #if defined __ANDROID__ || defined __IOS__ || defined MARMALADE glDeleteFramebuffersOES(1, &m_uFrameBuffer); #else if (GLEW_ARB_framebuffer_object) { glDeleteFramebuffers(1, &m_uFrameBuffer); } else if (GLEW_EXT_framebuffer_object) { glDeleteFramebuffersEXT(1, &m_uFrameBuffer); } #endif m_uFrameBuffer = GL_INVALID_VALUE; } closeOpenGL(); delete m_pGLPlatform; m_pGLPlatform = NULL; int t_c = static_cast<int>(m_vecVertexBuffers.size()); for (int iLoop = 0; iLoop < t_c; ++iLoop) { delete m_vecVertexBuffers[iLoop]; m_vecVertexBuffers[iLoop] = NULL; } m_vecVertexBuffers.clear(); t_c = static_cast<int>(m_vecIndexBuffers.size()); for (int iLoop = 0; iLoop < t_c; ++iLoop) { delete m_vecIndexBuffers[iLoop]; m_vecIndexBuffers[iLoop] = NULL; } m_vecIndexBuffers.clear(); }
void Screen::DestroyHardwareSurfaces() { glDeleteFramebuffersOES(1, &frameBuffer); frameBuffer = 0; glDeleteRenderbuffersOES(1, &renderBuffer); renderBuffer = 0; #if SEED_ENABLE_DEPTH_TEST if (depthRenderbuffer) { glDeleteRenderbuffersOES(1, &depthRenderbuffer); depthRenderbuffer = 0; } #endif // SEED_ENABLE_DEPTH_TEST }
void GLESStateCacheManagerImp::deleteGLBuffer(GLenum target, GLuint buffer, GLenum attach, bool force) { // Buffer name 0 is reserved and we should never try to delete it if(buffer == 0) return; if(target == GL_FRAMEBUFFER_OES) glDeleteFramebuffersOES(1, &buffer); else if(target == GL_RENDERBUFFER_OES) glDeleteRenderbuffersOES(1, &buffer); else glDeleteBuffers(1, &buffer); GL_CHECK_ERROR }
void destroyFBO(FBO *fbo) { if (fbo==NULL) { logError(TAG, "Cannot destroy Default FBO"); return; } GLuint drbId = fbo->mDepthRenderBuffer; GLuint fboId = fbo->mFBO; // switch to default FBO glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); // delete texture destroyTexture(fbo->mTexturePtrId); // delete depth buffer glDeleteRenderbuffersOES(1, &drbId); // delete framebuffer glDeleteFramebuffersOES(1, &fboId); }
int releaseFrameBuffer(AndroidContext *rc) { LOG( ANDROID_LOG_DEBUG, TAG, "Android Delete FrameBuffer"); glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); if ( rc->framebuff >= 0 ) { glDeleteFramebuffersOES(1, &(rc->framebuff)); rc->framebuff = -1; } if ( rc->depthbuff >= 0 ) { glDeleteRenderbuffersOES(1, &(rc->depthbuff)); rc->depthbuff = -1; } }
void ofxFBOTexture::clean() { #ifndef TARGET_OPENGLES switch(texData.glTypeInternal) { case GL_RGBA32F_ARB: case GL_RGBA16F_ARB: texData.glType = GL_RGBA; texData.pixelType = GL_FLOAT; delete [](float*)pixels; break; default: texData.glType = texData.glTypeInternal; texData.pixelType = GL_UNSIGNED_BYTE; delete [](unsigned char*)pixels; } #else texData.glType = GL_RGBA; texData.pixelType = GL_UNSIGNED_BYTE; delete [](unsigned char*)pixels; #endif // try to free up the texture memory so we don't reallocate // http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/deletetextures.html if (texData.textureID != 0){ #ifndef TARGET_OPENGLES glDeleteFramebuffersEXT(1, &fbo); glDeleteRenderbuffersEXT(1, &depthBuffer); if(numSamples){ glDeleteFramebuffersEXT(1, &mfbo); glDeleteRenderbuffersEXT(1, &colorBuffer); } #else glDeleteFramebuffersOES(1, &fbo); #endif glDeleteTextures(1, (GLuint *)&texData.textureID); } texData.width = 0; texData.height = 0; texData.bFlipTexture = false; }
void DestroySurfaceGLES(EAGLSurfaceDesc* surface) { if( surface->renderbuffer ) { GLES_CHK( glBindRenderbufferOES(GL_RENDERBUFFER_OES, surface->renderbuffer) ); DeallocateRenderBufferStorageFromEAGLLayer(); GLES_CHK( glBindRenderbufferOES(GL_RENDERBUFFER_OES, 0) ); GLES_CHK( glDeleteRenderbuffersOES(1, &surface->renderbuffer) ); surface->renderbuffer = 0; } if( surface->framebuffer ) { GLES_CHK( glDeleteFramebuffersOES(1, &surface->framebuffer) ); surface->framebuffer = 0; } DestroySurfaceMultisampleBuffersGLES(surface); }
void Display::close() { #if !SCALED_DISPLAY if (m_uFrameBuffer != GL_INVALID_VALUE) { glDeleteFramebuffersOES(1, &m_uFrameBuffer); m_uFrameBuffer = GL_INVALID_VALUE; } #endif closeOpenGL(); delete m_pGLPlatform; m_pGLPlatform = NULL; int t_c = static_cast<int>(m_vecVertexBuffers.size()); for (int iLoop = 0; iLoop < t_c; ++iLoop) { delete m_vecVertexBuffers[iLoop]; m_vecVertexBuffers[iLoop] = NULL; } m_vecVertexBuffers.clear(); t_c = static_cast<int>(m_vecIndexBuffers.size()); for (int iLoop = 0; iLoop < t_c; ++iLoop) { delete m_vecIndexBuffers[iLoop]; m_vecIndexBuffers[iLoop] = NULL; } m_vecIndexBuffers.clear(); }
GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint* framebuffers) { if(n <= 0) return; int name; GLsizei i = n; GLuint *cur = framebuffers; FGLContext *ctx = getContext(); do { name = fglFramebufferObjects.get(ctx); if(name < 0) { glDeleteFramebuffersOES (n - i, framebuffers); setError(GL_OUT_OF_MEMORY); return; } fglFramebufferObjects[name] = NULL; *cur = name; cur++; } while (--i); }
sgTexture::~sgTexture() { if(fbo != -1) { if(sgRenderer::oglversion > 1) { glDeleteFramebuffers(1, &fbo); glDeleteRenderbuffers(1, &fbo_depth); }else { #if defined __IOS__ glDeleteFramebuffersOES(1, &fbo); glDeleteRenderbuffersOES(1, &fbo_depth); #endif } } if(texid != -1) glDeleteTextures(1, &texid); if(texdata != NULL) delete[] texdata; }
void glDeleteFramebuffersOESLogged(GLsizei n, const GLuint* framebuffers) { printf("glDeleteFramebuffersOES(%i, %p)\n", n, framebuffers); glDeleteFramebuffersOES(n, framebuffers); }
virtual void deleteFBO(GLuint framebuffer, GLuint depthbuffer, GLuint img) { glDeleteTextures(1, &img); glDeleteRenderbuffersOES(1, &depthbuffer); glDeleteFramebuffersOES(1, &framebuffer); }
status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, sp<IMemoryHeap>* heap, uint32_t* w, uint32_t* h, PixelFormat* f, uint32_t sw, uint32_t sh) { LOGI("captureScreenImplLocked"); status_t result = PERMISSION_DENIED; // only one display supported for now if (UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) return BAD_VALUE; if (!GLExtensions::getInstance().haveFramebufferObject()) return INVALID_OPERATION; // get screen geometry const DisplayHardware& hw(graphicPlane(dpy).displayHardware()); const uint32_t hw_w = hw.getWidth(); const uint32_t hw_h = hw.getHeight(); if ((sw > hw_w) || (sh > hw_h)) return BAD_VALUE; sw = (!sw) ? hw_w : sw; sh = (!sh) ? hw_h : sh; const size_t size = sw * sh * 4; // make sure to clear all GL error flags while ( glGetError() != GL_NO_ERROR ) ; // create a FBO GLuint name, tname; glGenRenderbuffersOES(1, &tname); glBindRenderbufferOES(GL_RENDERBUFFER_OES, tname); glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGBA8_OES, sw, sh); glGenFramebuffersOES(1, &name); glBindFramebufferOES(GL_FRAMEBUFFER_OES, name); glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, tname); GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); if (status == GL_FRAMEBUFFER_COMPLETE_OES) { // invert everything, b/c glReadPixel() below will invert the FB glViewport(0, 0, sw, sh); glScissor(0, 0, sw, sh); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glOrthof(0, hw_w, 0, hw_h, 0, 1); glMatrixMode(GL_MODELVIEW); // redraw the screen entirely... glClearColor(0,0,0,1); glClear(GL_COLOR_BUFFER_BIT); const Vector< sp<LayerBase> >& layers(mVisibleLayersSortedByZ); const size_t count = layers.size(); for (size_t i=0 ; i<count ; ++i) { const sp<LayerBase>& layer(layers[i]); layer->drawForSreenShot(); } // XXX: this is needed on tegra glScissor(0, 0, sw, sh); // check for errors and return screen capture if (glGetError() != GL_NO_ERROR) { // error while rendering result = INVALID_OPERATION; } else { // allocate shared memory large enough to hold the // screen capture sp<MemoryHeapBase> base( new MemoryHeapBase(size, 0, "screen-capture") ); void* const ptr = base->getBase(); if (ptr) { // capture the screen with glReadPixels() glReadPixels(0, 0, sw, sh, GL_RGBA, GL_UNSIGNED_BYTE, ptr); if (glGetError() == GL_NO_ERROR) { *heap = base; *w = sw; *h = sh; *f = PIXEL_FORMAT_RGBA_8888; result = NO_ERROR; } } else { result = NO_MEMORY; } } glEnable(GL_SCISSOR_TEST); glViewport(0, 0, hw_w, hw_h); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); } else { result = BAD_VALUE; } // release FBO resources glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); glDeleteRenderbuffersOES(1, &tname); glDeleteFramebuffersOES(1, &name); hw.compositionComplete(); return result; }
void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); glDeleteFramebuffersOES(1, &fbName); glDeleteTextures(1, &texName); }