ROOT logo
// @(#)root/gl:$Id: TGLFormat.cxx 21453 2007-12-18 15:18:30Z matevz $
// Author:  Timur Pocheptsov, Jun 2007

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

#include <cassert>

#include "TGLFormat.h"

//______________________________________________________________________________
//
// Encapsulation of format / contents of an OpenGL buffer.

ClassImp(TGLFormat)

//______________________________________________________________________________
TGLFormat::TGLFormat() :
   fDoubleBuffered(kTRUE),
#ifdef WIN32
   fDepthSize(32),
#else
   fDepthSize(16),//FIXFIX
#endif
   fAccumSize(0),
   fStencilSize(8)
{
   //Default ctor. Default surface is:
   //-double buffered
   //-RGBA
   //-with depth buffer
}

//______________________________________________________________________________
TGLFormat::TGLFormat(EFormatOptions opt) :
   fDoubleBuffered(opt & kDoubleBuffer),
#ifdef WIN32
   fDepthSize(opt & kDepth ? 32 : 0),
#else
   fDepthSize(opt & kDepth ? 16 : 0),//FIXFIX
#endif
   fAccumSize(opt & kAccum ? 8 : 0),    //I've never tested accumulation buffer size.
   fStencilSize(opt & kStencil ? 8 : 0) //I've never tested stencil buffer size.
{
   //Define surface using options.
}

//______________________________________________________________________________
TGLFormat::~TGLFormat()
{
   //Destructor.
}

//______________________________________________________________________________
Bool_t TGLFormat::operator == (const TGLFormat &rhs)const
{
   //Check if two formats are equal.
   return fDoubleBuffered == rhs.fDoubleBuffered && fDepthSize == rhs.fDepthSize &&
          fAccumSize == rhs.fAccumSize && fStencilSize == rhs.fStencilSize;
}

//______________________________________________________________________________
Bool_t TGLFormat::operator != (const TGLFormat &rhs)const
{
   //Check for non-equality.
   return !(*this == rhs);
}

//______________________________________________________________________________
UInt_t TGLFormat::GetDepthSize()const
{
   //Get the size of depth buffer.
   return fDepthSize;
}

//______________________________________________________________________________
void TGLFormat::SetDepthSize(UInt_t depth)
{
   //Set the size of color buffer.
   assert(depth);
   fDepthSize = depth;
}

//______________________________________________________________________________
Bool_t TGLFormat::HasDepth()const
{
   //Check, if this surface has depth buffer.
   return GetDepthSize() != 0;
}

//______________________________________________________________________________
UInt_t TGLFormat::GetStencilSize()const
{
   //Get the size of stencil buffer.
   return fStencilSize;
}

//______________________________________________________________________________
void TGLFormat::SetStencilSize(UInt_t stencil)
{
   //Set the size of stencil buffer.
   assert(stencil);
   fStencilSize = stencil;
}

//______________________________________________________________________________
Bool_t TGLFormat::HasStencil()const
{
   //Check, if this surface has stencil buffer.
   return GetStencilSize() != 0;
}

//______________________________________________________________________________
UInt_t TGLFormat::GetAccumSize()const
{
   //Get the size of accum buffer.
   return fAccumSize;
}

//______________________________________________________________________________
void TGLFormat::SetAccumSize(UInt_t accum)
{
   //Set the size of accum buffer.
   assert(accum);
   fAccumSize = accum;
}

//______________________________________________________________________________
Bool_t TGLFormat::HasAccumBuffer()const
{
   //Check, if this surface has accumulation buffer.
   return GetAccumSize() != 0;
}

//______________________________________________________________________________
Bool_t TGLFormat::IsDoubleBuffered()const
{
   //Check, if the surface is double buffered.
   return fDoubleBuffered;
}

//______________________________________________________________________________
void TGLFormat::SetDoubleBuffered(Bool_t db)
{
   //Set the surface as double/single buffered.
   fDoubleBuffered = db;
}
 TGLFormat.cxx:1
 TGLFormat.cxx:2
 TGLFormat.cxx:3
 TGLFormat.cxx:4
 TGLFormat.cxx:5
 TGLFormat.cxx:6
 TGLFormat.cxx:7
 TGLFormat.cxx:8
 TGLFormat.cxx:9
 TGLFormat.cxx:10
 TGLFormat.cxx:11
 TGLFormat.cxx:12
 TGLFormat.cxx:13
 TGLFormat.cxx:14
 TGLFormat.cxx:15
 TGLFormat.cxx:16
 TGLFormat.cxx:17
 TGLFormat.cxx:18
 TGLFormat.cxx:19
 TGLFormat.cxx:20
 TGLFormat.cxx:21
 TGLFormat.cxx:22
 TGLFormat.cxx:23
 TGLFormat.cxx:24
 TGLFormat.cxx:25
 TGLFormat.cxx:26
 TGLFormat.cxx:27
 TGLFormat.cxx:28
 TGLFormat.cxx:29
 TGLFormat.cxx:30
 TGLFormat.cxx:31
 TGLFormat.cxx:32
 TGLFormat.cxx:33
 TGLFormat.cxx:34
 TGLFormat.cxx:35
 TGLFormat.cxx:36
 TGLFormat.cxx:37
 TGLFormat.cxx:38
 TGLFormat.cxx:39
 TGLFormat.cxx:40
 TGLFormat.cxx:41
 TGLFormat.cxx:42
 TGLFormat.cxx:43
 TGLFormat.cxx:44
 TGLFormat.cxx:45
 TGLFormat.cxx:46
 TGLFormat.cxx:47
 TGLFormat.cxx:48
 TGLFormat.cxx:49
 TGLFormat.cxx:50
 TGLFormat.cxx:51
 TGLFormat.cxx:52
 TGLFormat.cxx:53
 TGLFormat.cxx:54
 TGLFormat.cxx:55
 TGLFormat.cxx:56
 TGLFormat.cxx:57
 TGLFormat.cxx:58
 TGLFormat.cxx:59
 TGLFormat.cxx:60
 TGLFormat.cxx:61
 TGLFormat.cxx:62
 TGLFormat.cxx:63
 TGLFormat.cxx:64
 TGLFormat.cxx:65
 TGLFormat.cxx:66
 TGLFormat.cxx:67
 TGLFormat.cxx:68
 TGLFormat.cxx:69
 TGLFormat.cxx:70
 TGLFormat.cxx:71
 TGLFormat.cxx:72
 TGLFormat.cxx:73
 TGLFormat.cxx:74
 TGLFormat.cxx:75
 TGLFormat.cxx:76
 TGLFormat.cxx:77
 TGLFormat.cxx:78
 TGLFormat.cxx:79
 TGLFormat.cxx:80
 TGLFormat.cxx:81
 TGLFormat.cxx:82
 TGLFormat.cxx:83
 TGLFormat.cxx:84
 TGLFormat.cxx:85
 TGLFormat.cxx:86
 TGLFormat.cxx:87
 TGLFormat.cxx:88
 TGLFormat.cxx:89
 TGLFormat.cxx:90
 TGLFormat.cxx:91
 TGLFormat.cxx:92
 TGLFormat.cxx:93
 TGLFormat.cxx:94
 TGLFormat.cxx:95
 TGLFormat.cxx:96
 TGLFormat.cxx:97
 TGLFormat.cxx:98
 TGLFormat.cxx:99
 TGLFormat.cxx:100
 TGLFormat.cxx:101
 TGLFormat.cxx:102
 TGLFormat.cxx:103
 TGLFormat.cxx:104
 TGLFormat.cxx:105
 TGLFormat.cxx:106
 TGLFormat.cxx:107
 TGLFormat.cxx:108
 TGLFormat.cxx:109
 TGLFormat.cxx:110
 TGLFormat.cxx:111
 TGLFormat.cxx:112
 TGLFormat.cxx:113
 TGLFormat.cxx:114
 TGLFormat.cxx:115
 TGLFormat.cxx:116
 TGLFormat.cxx:117
 TGLFormat.cxx:118
 TGLFormat.cxx:119
 TGLFormat.cxx:120
 TGLFormat.cxx:121
 TGLFormat.cxx:122
 TGLFormat.cxx:123
 TGLFormat.cxx:124
 TGLFormat.cxx:125
 TGLFormat.cxx:126
 TGLFormat.cxx:127
 TGLFormat.cxx:128
 TGLFormat.cxx:129
 TGLFormat.cxx:130
 TGLFormat.cxx:131
 TGLFormat.cxx:132
 TGLFormat.cxx:133
 TGLFormat.cxx:134
 TGLFormat.cxx:135
 TGLFormat.cxx:136
 TGLFormat.cxx:137
 TGLFormat.cxx:138
 TGLFormat.cxx:139
 TGLFormat.cxx:140
 TGLFormat.cxx:141
 TGLFormat.cxx:142
 TGLFormat.cxx:143
 TGLFormat.cxx:144
 TGLFormat.cxx:145
 TGLFormat.cxx:146
 TGLFormat.cxx:147
 TGLFormat.cxx:148
 TGLFormat.cxx:149
 TGLFormat.cxx:150
 TGLFormat.cxx:151
 TGLFormat.cxx:152