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,2006 by Jeroen van der Zijp.   All Rights Reserved.        *
00007 *********************************************************************************
00008 * This library is free software; you can redistribute it and/or                 *
00009 * modify it under the terms of the GNU Lesser General Public                    *
00010 * License as published by the Free Software Foundation; either                  *
00011 * version 2.1 of the License, or (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 GNU             *
00016 * Lesser General Public License for more details.                               *
00017 *                                                                               *
00018 * You should have received a copy of the GNU Lesser General Public              *
00019 * License along with this library; if not, write to the Free Software           *
00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA.    *
00021 *********************************************************************************
00022 * $Id: FXGLVisual.h,v 1.24 2006/01/22 17:58:04 fox Exp $                        *
00023 ********************************************************************************/
00024 #ifndef FXGLVISUAL_H
00025 #define FXGLVISUAL_H
00026 
00027 #ifndef FXVISUAL_H
00028 #include "FXVisual.h"
00029 #endif
00030 
00031 namespace FX {
00032 
00033 
00034 class FXFont;
00035 class FXWindow;
00036 class FXImage;
00037 class FXIcon;
00038 class FXBitmap;
00039 class FXDCWindow;
00040 class FXGLCanvas;
00041 
00042 
00043 /// Visual describes pixel format of a drawable
00044 class FXAPI FXGLVisual : public FXVisual {
00045   FXDECLARE(FXGLVisual)
00046   friend class FXWindow;
00047   friend class FXImage;
00048   friend class FXIcon;
00049   friend class FXBitmap;
00050   friend class FXDCWindow;
00051   friend class FXGLCanvas;
00052 protected:
00053   FXint        redSize;             // Desired #bits for red
00054   FXint        greenSize;           // Desired #bits for green
00055   FXint        blueSize;            // Desired #bits for blue
00056   FXint        alphaSize;           // Desired #bits for alpha
00057   FXint        depthSize;           // Desired #bits for Z
00058   FXint        stencilSize;         // Desired #bits for stencil
00059   FXint        accumRedSize;        // Desired #bits for accum red
00060   FXint        accumGreenSize;      // Desired #bits for accum green
00061   FXint        accumBlueSize;       // Desired #bits for accum blue
00062   FXint        accumAlphaSize;      // Desired #bits for accum alpha
00063 protected:
00064   FXGLVisual();
00065 private:
00066   FXGLVisual(const FXGLVisual&);
00067   FXGLVisual &operator=(const FXGLVisual&);
00068 public:
00069 
00070   /// Construct default visual
00071   FXGLVisual(FXApp* a,FXuint flags);
00072 
00073   /**
00074   * Test if OpenGL is possible, and what level is supported.
00075   * Because of remote display capability, the display server may
00076   * support a different level of OpenGL than the client; it may
00077   * even support no OpenGL at all!  This function returns the lesser
00078   * of the client support level and the display server support level.
00079   */
00080   static FXbool supported(FXApp* application,int& major,int& minor);
00081 
00082   /// Create visual
00083   virtual void create();
00084 
00085   /// Detach visual
00086   virtual void detach();
00087 
00088   /// Destroy visual
00089   virtual void destroy();
00090 
00091   /// Get sizes for bit-planes
00092   FXint getRedSize() const { return redSize; }
00093   FXint getGreenSize() const { return greenSize; }
00094   FXint getBlueSize() const { return blueSize; }
00095   FXint getAlphaSize() const { return alphaSize; }
00096   FXint getDepthSize() const { return depthSize; }
00097   FXint getStencilSize() const { return stencilSize; }
00098   FXint getAccumRedSize() const { return accumRedSize; }
00099   FXint getAccumGreenSize() const { return accumGreenSize; }
00100   FXint getAccumBlueSize() const { return accumBlueSize; }
00101   FXint getAccumAlphaSize() const { return accumAlphaSize; }
00102 
00103   /// Set sizes for bit-planes
00104   void setRedSize(FXint rs){ redSize=rs; }
00105   void setGreenSize(FXint gs){ greenSize=gs; }
00106   void setBlueSize(FXint bs){ blueSize=bs; }
00107   void setAlphaSize(FXint as){ alphaSize=as; }
00108   void setDepthSize(FXint ds){ depthSize=ds; }
00109   void setStencilSize(FXint ss){ stencilSize=ss; }
00110   void setAccumRedSize(FXint rs){ accumRedSize=rs; }
00111   void setAccumGreenSize(FXint gs){ accumGreenSize=gs; }
00112   void setAccumBlueSize(FXint bs){ accumBlueSize=bs; }
00113   void setAccumAlphaSize(FXint as){ accumAlphaSize=as; }
00114 
00115   /// Get ACTUAL sizes for bit-planes
00116   FXint getActualRedSize() const;
00117   FXint getActualGreenSize() const;
00118   FXint getActualBlueSize() const;
00119   FXint getActualAlphaSize() const;
00120   FXint getActualDepthSize() const;
00121   FXint getActualStencilSize() const;
00122   FXint getActualAccumRedSize() const;
00123   FXint getActualAccumGreenSize() const;
00124   FXint getActualAccumBlueSize() const;
00125   FXint getActualAccumAlphaSize() const;
00126 
00127   /// Is it double buffered?
00128   FXbool isDoubleBuffer() const;
00129 
00130   /// Is it stereo?
00131   FXbool isStereo() const;
00132 
00133   /// Is it hardware-accelerated?
00134   FXbool isAccelerated() const;
00135 
00136   /// Does it swap by copying instead of flipping buffers
00137   FXbool isBufferSwapCopy() const;
00138 
00139   /// Save visual info to a stream
00140   virtual void save(FXStream& store) const;
00141 
00142   /// Load visual info to a stream
00143   virtual void load(FXStream& store);
00144 
00145   /// Destructor
00146   virtual ~FXGLVisual();
00147   };
00148 
00149 
00150 /// Create a display list of bitmaps from font glyphs in a font
00151 extern FXAPI void glUseFXFont(FXFont* font,int first,int count,int list);
00152 
00153 }
00154 
00155 #endif

Copyright © 1997-2005 Jeroen van der Zijp