00001 // @(#)root/gl:$Id: TGLFormat.h 36675 2010-11-15 20:33:58Z matevz $ 00002 // Author: Timur Pocheptsov, Jun 2007 00003 00004 /************************************************************************* 00005 * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers. * 00006 * All rights reserved. * 00007 * * 00008 * For the licensing terms see $ROOTSYS/LICENSE. * 00009 * For the list of contributors see $ROOTSYS/README/CREDITS. * 00010 *************************************************************************/ 00011 00012 #ifndef ROOT_TGLFormat 00013 #define ROOT_TGLFormat 00014 00015 #include "Rtypes.h" 00016 00017 #include <vector> 00018 00019 /* 00020 TGLFormat class describes the pixel format of a drawing surface. 00021 It's a generic analog of PIXELFORMATDESCRIPTOR (win32) or 00022 array of integer constants array for glXChooseVisual (X11). 00023 This class is in a very preliminary state, different 00024 options have not been tested yet, only defaults. 00025 00026 Surface can be: 00027 -RGBA 00028 -with/without depth buffer 00029 -with/without stencil buffer 00030 -with/without accum buffer 00031 -double/single buffered 00032 */ 00033 00034 class TGLFormat 00035 { 00036 public: 00037 enum EFormatOptions 00038 { 00039 kNone = 0, 00040 kDoubleBuffer = 1, 00041 kDepth = 2, 00042 kAccum = 4, 00043 kStencil = 8, 00044 kStereo = 16, 00045 kMultiSample = 32 00046 }; 00047 00048 private: 00049 Bool_t fDoubleBuffered; 00050 Bool_t fStereo; 00051 Int_t fDepthSize; 00052 Int_t fAccumSize; 00053 Int_t fStencilSize; 00054 Int_t fSamples; 00055 00056 static std::vector<Int_t> fgAvailableSamples; 00057 00058 static Int_t GetDefaultSamples(); 00059 static void InitAvailableSamples(); 00060 00061 public: 00062 TGLFormat(); 00063 TGLFormat(EFormatOptions options); 00064 00065 //Virtual dtor only to supress warnings from g++ - 00066 //ClassDef adds virtual functions, so g++ wants virtual dtor. 00067 virtual ~TGLFormat(); 00068 00069 Bool_t operator == (const TGLFormat &rhs)const; 00070 Bool_t operator != (const TGLFormat &rhs)const; 00071 00072 Int_t GetDepthSize()const; 00073 void SetDepthSize(Int_t depth); 00074 Bool_t HasDepth()const; 00075 00076 Int_t GetStencilSize()const; 00077 void SetStencilSize(Int_t stencil); 00078 Bool_t HasStencil()const; 00079 00080 Int_t GetAccumSize()const; 00081 void SetAccumSize(Int_t accum); 00082 Bool_t HasAccumBuffer()const; 00083 00084 Bool_t IsDoubleBuffered()const; 00085 void SetDoubleBuffered(Bool_t db); 00086 00087 Bool_t IsStereo()const; 00088 void SetStereo(Bool_t db); 00089 00090 Int_t GetSamples()const; 00091 void SetSamples(Int_t samples); 00092 Bool_t HasMultiSampling()const; 00093 00094 ClassDef(TGLFormat, 0); // Describes GL buffer format. 00095 }; 00096 00097 #endif