bool GLVideo::BeginTargetScene(const Color& dwBGColor, const bool clear) { // explicit static cast for better performance TexturePtr texturePtr = m_currentTarget.lock(); if (!texturePtr) { Message(GS_L("There's no render target"), GSMT_ERROR); } Texture *pTexture = texturePtr.get(); // safety compile-time error checking GLTexture *pGLTexture = static_cast<GLTexture*>(pTexture); // safer direct cast const GLuint target = pGLTexture->GetTextureInfo().m_frameBuffer; glBindFramebuffer(GL_FRAMEBUFFER, target); CheckFrameBufferStatus(target, pGLTexture->GetTextureInfo().m_texture, false); if (clear) { math::Vector4 color; color.SetColor(dwBGColor); glClearColor(color.x, color.y, color.z, color.w); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); } UpdateInternalShadersViewData(GetScreenSizeF(), true); m_rendering = true; return true; }