Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXGLVisual.h

Go to the documentation of this file.
00001 /********************************************************************************
00002 *                                                                               *
00003 *                            V i s u a l   C l a s s                            *
00004 *                                                                               *
00005 *********************************************************************************
00006 * Copyright (C) 1999,2009 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or modify          *
00009 * it under the terms of the GNU Lesser General Public License as published by   *
00010 * the Free Software Foundation; either version 3 of the License, or             *
00011 * (at your option) any later version.                                           *
00012 *                                                                               *
00013 * This library is distributed in the hope that it will be useful,               *
00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 *
00016 * GNU Lesser General Public License for more details.                           *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public License      *
00019 * along with this program.  If not, see <http://www.gnu.org/licenses/>          *
00020 *********************************************************************************
00021 * $Id: FXGLVisual.h,v 1.38 2009/01/06 13:07:24 fox Exp $                        *
00022 ********************************************************************************/
00023 #ifndef FXGLVISUAL_H
00024 #define FXGLVISUAL_H
00025 
00026 #ifndef FXVISUAL_H
00027 #include "FXVisual.h"
00028 #endif
00029 
00030 namespace FX {
00031 
00032 
00033 class FXFont;
00034 class FXWindow;
00035 class FXImage;
00036 class FXIcon;
00037 class FXBitmap;
00038 class FXDCWindow;
00039 class FXGLCanvas;
00040 
00041 
00042 /// Visual describes pixel format of a drawable
00043 class FXAPI FXGLVisual : public FXVisual {
00044   FXDECLARE(FXGLVisual)
00045   friend class FXWindow;
00046   friend class FXImage;
00047   friend class FXIcon;
00048   friend class FXBitmap;
00049   friend class FXDCWindow;
00050   friend class FXGLCanvas;
00051 protected:
00052   FXuchar redSize;              // Red bits
00053   FXuchar greenSize;            // Green depth
00054   FXuchar blueSize;             // Blue bits
00055   FXuchar alphaSize;            // Alpha bits
00056   FXuchar depthSize;            // Depth bits
00057   FXuchar stencilSize;          // Stencil bits
00058   FXuchar multiSamples;         // Multi-sampling
00059   FXuchar accumRedSize;         // Red accu buffer bits
00060   FXuchar accumGreenSize;       // Green accu buffer bits
00061   FXuchar accumBlueSize;        // Blue accu buffer bits
00062   FXuchar accumAlphaSize;       // Alpha accu buffer bits
00063   FXuchar actualRedSize;        // Actual Red bits
00064   FXuchar actualGreenSize;      // Actual Green depth
00065   FXuchar actualBlueSize;       // Actual Blue bits
00066   FXuchar actualAlphaSize;      // Actual Alpha bits
00067   FXuchar actualDepthSize;      // Actual Depth bits
00068   FXuchar actualStencilSize;    // Actual Stencil bits
00069   FXuchar actualMultiSamples;   // Actual multi-sampling
00070   FXuchar actualAccumRedSize;   // Actual Red accu buffer bits
00071   FXuchar actualAccumGreenSize; // Actual Green accu buffer bits
00072   FXuchar actualAccumBlueSize;  // Actual Blue accu buffer bits
00073   FXuchar actualAccumAlphaSize; // Actual Alpha accu buffer bits
00074   FXbool  doubleBuffer;
00075   FXbool  stereoBuffer;
00076   FXbool  accelerated;
00077   FXbool  copying;
00078 protected:
00079   FXGLVisual();
00080 private:
00081   FXGLVisual(const FXGLVisual&);
00082   FXGLVisual &operator=(const FXGLVisual&);
00083 public:
00084 
00085   /// Construct default visual
00086   FXGLVisual(FXApp* a,FXuint flgs=VISUAL_DOUBLE_BUFFER|VISUAL_WINDOW);
00087 
00088   /// Create visual
00089   virtual void create();
00090 
00091   /// Detach visual
00092   virtual void detach();
00093 
00094   /// Destroy visual
00095   virtual void destroy();
00096 
00097   /// Get sizes for bit-planes
00098   FXint getRedSize() const { return redSize; }
00099   FXint getGreenSize() const { return greenSize; }
00100   FXint getBlueSize() const { return blueSize; }
00101   FXint getAlphaSize() const { return alphaSize; }
00102   FXint getDepthSize() const { return depthSize; }
00103   FXint getStencilSize() const { return stencilSize; }
00104   FXint getMultiSamples() const { return multiSamples; }
00105   FXint getAccumRedSize() const { return accumRedSize; }
00106   FXint getAccumGreenSize() const { return accumGreenSize; }
00107   FXint getAccumBlueSize() const { return accumBlueSize; }
00108   FXint getAccumAlphaSize() const { return accumAlphaSize; }
00109 
00110   /// Set sizes for bit-planes
00111   void setRedSize(FXint rs){ redSize=rs; }
00112   void setGreenSize(FXint gs){ greenSize=gs; }
00113   void setBlueSize(FXint bs){ blueSize=bs; }
00114   void setAlphaSize(FXint as){ alphaSize=as; }
00115   void setDepthSize(FXint ds){ depthSize=ds; }
00116   void setStencilSize(FXint ss){ stencilSize=ss; }
00117   void setMultiSamples(FXint ms){ multiSamples=ms; }
00118   void setAccumRedSize(FXint rs){ accumRedSize=rs; }
00119   void setAccumGreenSize(FXint gs){ accumGreenSize=gs; }
00120   void setAccumBlueSize(FXint bs){ accumBlueSize=bs; }
00121   void setAccumAlphaSize(FXint as){ accumAlphaSize=as; }
00122 
00123   /// Get ACTUAL sizes for bit-planes
00124   FXint getActualRedSize() const { return actualRedSize; }
00125   FXint getActualGreenSize() const { return actualGreenSize; }
00126   FXint getActualBlueSize() const { return actualBlueSize; }
00127   FXint getActualAlphaSize() const { return actualAlphaSize; }
00128   FXint getActualDepthSize() const { return actualDepthSize; }
00129   FXint getActualStencilSize() const { return actualStencilSize; }
00130   FXint getActualMultiSamples() const { return actualMultiSamples; }
00131   FXint getActualAccumRedSize() const { return actualAccumRedSize; }
00132   FXint getActualAccumGreenSize() const { return actualAccumGreenSize; }
00133   FXint getActualAccumBlueSize() const { return actualAccumBlueSize; }
00134   FXint getActualAccumAlphaSize() const { return actualAccumAlphaSize; }
00135 
00136   /// Is it double buffered?
00137   FXbool isDoubleBuffer() const { return doubleBuffer; }
00138 
00139   /// Is it stereo?
00140   FXbool isStereo() const { return stereoBuffer; }
00141 
00142   /// Is it hardware-accelerated?
00143   FXbool isAccelerated() const { return accelerated; }
00144 
00145   /// Does it swap by copying instead of flipping buffers
00146   FXbool isBufferSwapCopy() const { return copying; }
00147 
00148   /// Test if if OpenGL is supported.
00149   static FXbool hasOpenGL(FXApp* application);
00150 
00151   /// Save visual info to a stream
00152   virtual void save(FXStream& store) const;
00153 
00154   /// Load visual info to a stream
00155   virtual void load(FXStream& store);
00156 
00157   /// Destructor
00158   virtual ~FXGLVisual();
00159   };
00160 
00161 }
00162 
00163 #endif

Copyright © 1997-2009 Jeroen van der Zijp