// @(#)root/gl:$Id$
// Author: Matevz Tadel, Aug 2009

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TGLFBO
#define ROOT_TGLFBO

#include "Rtypes.h"

class TGLFBO
{
private:
   TGLFBO(const TGLFBO&);            // Not implemented
   TGLFBO& operator=(const TGLFBO&); // Not implemented

protected:
   UInt_t  fFrameBuffer;
   UInt_t  fColorTexture;
   UInt_t  fDepthBuffer;
   UInt_t  fMSFrameBuffer;
   UInt_t  fMSColorBuffer;

   Int_t   fW, fH, fReqW, fReqH, fMSSamples, fMSCoverageSamples;

   Float_t fWScale, fHScale;
   Bool_t  fIsRescaled;

   static Bool_t fgRescaleToPow2;
   static Bool_t fgMultiSampleNAWarned;

   void InitStandard();
   void InitMultiSample();

   UInt_t CreateAndAttachRenderBuffer(Int_t format, Int_t type);
   UInt_t CreateAndAttachColorTexture();

public:
   TGLFBO();
   virtual ~TGLFBO();

   void Init(int w, int h, int ms_samples=0);
   void Release();

   void Bind();
   void Unbind();

   void BindTexture();
   void UnbindTexture();

   void SetAsReadBuffer();

   Int_t   GetW()    const { return fW; }
   Int_t   GetH()    const { return fH; }
   Int_t   GetReqW() const { return fReqW; }
   Int_t   GetReqH() const { return fReqH; }
   Int_t   GetMSSamples()         const { return fMSSamples; }
   Int_t   GetMSCoverageSamples() const { return fMSCoverageSamples; }

   Float_t GetWScale() const { return fWScale; }
   Float_t GetHScale() const { return fHScale; }

   Bool_t  GetIsRescaled() const { return fIsRescaled; }

   static  Bool_t GetRescaleToPow2();
   static  void   SetRescaleToPow2(Bool_t r);

   ClassDef(TGLFBO, 0); // Frame-buffer object.
};

#endif
 TGLFBO.h:1
 TGLFBO.h:2
 TGLFBO.h:3
 TGLFBO.h:4
 TGLFBO.h:5
 TGLFBO.h:6
 TGLFBO.h:7
 TGLFBO.h:8
 TGLFBO.h:9
 TGLFBO.h:10
 TGLFBO.h:11
 TGLFBO.h:12
 TGLFBO.h:13
 TGLFBO.h:14
 TGLFBO.h:15
 TGLFBO.h:16
 TGLFBO.h:17
 TGLFBO.h:18
 TGLFBO.h:19
 TGLFBO.h:20
 TGLFBO.h:21
 TGLFBO.h:22
 TGLFBO.h:23
 TGLFBO.h:24
 TGLFBO.h:25
 TGLFBO.h:26
 TGLFBO.h:27
 TGLFBO.h:28
 TGLFBO.h:29
 TGLFBO.h:30
 TGLFBO.h:31
 TGLFBO.h:32
 TGLFBO.h:33
 TGLFBO.h:34
 TGLFBO.h:35
 TGLFBO.h:36
 TGLFBO.h:37
 TGLFBO.h:38
 TGLFBO.h:39
 TGLFBO.h:40
 TGLFBO.h:41
 TGLFBO.h:42
 TGLFBO.h:43
 TGLFBO.h:44
 TGLFBO.h:45
 TGLFBO.h:46
 TGLFBO.h:47
 TGLFBO.h:48
 TGLFBO.h:49
 TGLFBO.h:50
 TGLFBO.h:51
 TGLFBO.h:52
 TGLFBO.h:53
 TGLFBO.h:54
 TGLFBO.h:55
 TGLFBO.h:56
 TGLFBO.h:57
 TGLFBO.h:58
 TGLFBO.h:59
 TGLFBO.h:60
 TGLFBO.h:61
 TGLFBO.h:62
 TGLFBO.h:63
 TGLFBO.h:64
 TGLFBO.h:65
 TGLFBO.h:66
 TGLFBO.h:67
 TGLFBO.h:68
 TGLFBO.h:69
 TGLFBO.h:70
 TGLFBO.h:71
 TGLFBO.h:72
 TGLFBO.h:73
 TGLFBO.h:74
 TGLFBO.h:75
 TGLFBO.h:76
 TGLFBO.h:77