LCOV - code coverage report
Current view: top level - vcl/opengl - framebuffer.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 34 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  */
       9             : 
      10             : #include <sal/log.hxx>
      11             : 
      12             : #include <opengl/framebuffer.hxx>
      13             : 
      14             : #include <vcl/opengl/OpenGLHelper.hxx>
      15             : 
      16           0 : OpenGLFramebuffer::OpenGLFramebuffer() :
      17             :     mnId( 0 ),
      18             :     mnWidth( 0 ),
      19             :     mnHeight( 0 ),
      20             :     mnAttachedTexture( 0 ),
      21             :     mpPrevFramebuffer( NULL ),
      22           0 :     mpNextFramebuffer( NULL )
      23             : {
      24           0 :     glGenFramebuffers( 1, &mnId );
      25             :     SAL_INFO( "vcl.opengl", "Created framebuffer " << (int)mnId );
      26           0 : }
      27             : 
      28           0 : OpenGLFramebuffer::~OpenGLFramebuffer()
      29             : {
      30           0 :     glDeleteFramebuffers( 1, &mnId );
      31           0 : }
      32             : 
      33           0 : void OpenGLFramebuffer::Bind()
      34             : {
      35           0 :     glBindFramebuffer( GL_FRAMEBUFFER, mnId );
      36             :     SAL_INFO( "vcl.opengl", "Binding framebuffer " << (int)mnId );
      37           0 :     CHECK_GL_ERROR();
      38           0 : }
      39             : 
      40           0 : void OpenGLFramebuffer::Unbind()
      41             : {
      42           0 :     glBindFramebuffer( GL_FRAMEBUFFER, 0 );
      43             :     SAL_INFO( "vcl.opengl", "Binding default framebuffer" );
      44           0 :     CHECK_GL_ERROR();
      45           0 : }
      46             : 
      47           0 : bool OpenGLFramebuffer::IsFree() const
      48             : {
      49           0 :     return (!mnAttachedTexture);
      50             : }
      51             : 
      52           0 : bool OpenGLFramebuffer::IsAttached( const OpenGLTexture& rTexture ) const
      53             : {
      54           0 :     return ( mnAttachedTexture == rTexture.Id() );
      55             : }
      56             : 
      57           0 : void OpenGLFramebuffer::AttachTexture( const OpenGLTexture& rTexture )
      58             : {
      59           0 :     if( rTexture.Id() == mnAttachedTexture )
      60           0 :         return;
      61             : 
      62             :     SAL_INFO( "vcl.opengl", "Attaching texture " << rTexture.Id() << " to framebuffer " << (int)mnId );
      63           0 :     mnAttachedTexture = rTexture.Id();
      64           0 :     mnWidth = rTexture.GetWidth();
      65           0 :     mnHeight = rTexture.GetHeight();
      66             :     glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
      67           0 :                             mnAttachedTexture, 0 );
      68           0 :     CHECK_GL_ERROR();
      69             : }
      70             : 
      71           0 : void OpenGLFramebuffer::DetachTexture()
      72             : {
      73           0 :     if( mnAttachedTexture != 0 )
      74             :     {
      75           0 :         CHECK_GL_ERROR();
      76           0 :         mnAttachedTexture = 0;
      77           0 :         glFramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0 );
      78           0 :         CHECK_GL_ERROR();
      79             :     }
      80           0 : }
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11