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

FXGLVisual.h
Go to the documentation of this file.
1 /********************************************************************************
2 * *
3 * V i s u a l C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2006 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or *
9 * modify it under the terms of the GNU Lesser General Public *
10 * License as published by the Free Software Foundation; either *
11 * version 2.1 of the License, or (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
16 * Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public *
19 * License along with this library; if not, write to the Free Software *
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
21 *********************************************************************************
22 * $Id: FXGLVisual.h,v 1.24 2006/01/22 17:58:04 fox Exp $ *
23 ********************************************************************************/
24 #ifndef FXGLVISUAL_H
25 #define FXGLVISUAL_H
26 
27 #ifndef FXVISUAL_H
28 #include "FXVisual.h"
29 #endif
30 
31 namespace FX {
32 
33 
34 class FXFont;
35 class FXWindow;
36 class FXImage;
37 class FXIcon;
38 class FXBitmap;
39 class FXDCWindow;
40 class FXGLCanvas;
41 
42 
43 /// Visual describes pixel format of a drawable
44 class FXAPI FXGLVisual : public FXVisual {
46  friend class FXWindow;
47  friend class FXImage;
48  friend class FXIcon;
49  friend class FXBitmap;
50  friend class FXDCWindow;
51  friend class FXGLCanvas;
52 protected:
53  FXint redSize; // Desired #bits for red
54  FXint greenSize; // Desired #bits for green
55  FXint blueSize; // Desired #bits for blue
56  FXint alphaSize; // Desired #bits for alpha
57  FXint depthSize; // Desired #bits for Z
58  FXint stencilSize; // Desired #bits for stencil
59  FXint accumRedSize; // Desired #bits for accum red
60  FXint accumGreenSize; // Desired #bits for accum green
61  FXint accumBlueSize; // Desired #bits for accum blue
62  FXint accumAlphaSize; // Desired #bits for accum alpha
63 protected:
64  FXGLVisual();
65 private:
66  FXGLVisual(const FXGLVisual&);
67  FXGLVisual &operator=(const FXGLVisual&);
68 public:
69 
70  /// Construct default visual
71  FXGLVisual(FXApp* a,FXuint flags);
72 
73  /**
74  * Test if OpenGL is possible, and what level is supported.
75  * Because of remote display capability, the display server may
76  * support a different level of OpenGL than the client; it may
77  * even support no OpenGL at all! This function returns the lesser
78  * of the client support level and the display server support level.
79  */
80  static FXbool supported(FXApp* application,int& major,int& minor);
81 
82  /// Create visual
83  virtual void create();
84 
85  /// Detach visual
86  virtual void detach();
87 
88  /// Destroy visual
89  virtual void destroy();
90 
91  /// Get sizes for bit-planes
92  FXint getRedSize() const { return redSize; }
93  FXint getGreenSize() const { return greenSize; }
94  FXint getBlueSize() const { return blueSize; }
95  FXint getAlphaSize() const { return alphaSize; }
96  FXint getDepthSize() const { return depthSize; }
97  FXint getStencilSize() const { return stencilSize; }
98  FXint getAccumRedSize() const { return accumRedSize; }
99  FXint getAccumGreenSize() const { return accumGreenSize; }
100  FXint getAccumBlueSize() const { return accumBlueSize; }
101  FXint getAccumAlphaSize() const { return accumAlphaSize; }
102 
103  /// Set sizes for bit-planes
104  void setRedSize(FXint rs){ redSize=rs; }
105  void setGreenSize(FXint gs){ greenSize=gs; }
106  void setBlueSize(FXint bs){ blueSize=bs; }
107  void setAlphaSize(FXint as){ alphaSize=as; }
108  void setDepthSize(FXint ds){ depthSize=ds; }
109  void setStencilSize(FXint ss){ stencilSize=ss; }
110  void setAccumRedSize(FXint rs){ accumRedSize=rs; }
111  void setAccumGreenSize(FXint gs){ accumGreenSize=gs; }
112  void setAccumBlueSize(FXint bs){ accumBlueSize=bs; }
113  void setAccumAlphaSize(FXint as){ accumAlphaSize=as; }
114 
115  /// Get ACTUAL sizes for bit-planes
116  FXint getActualRedSize() const;
117  FXint getActualGreenSize() const;
118  FXint getActualBlueSize() const;
119  FXint getActualAlphaSize() const;
120  FXint getActualDepthSize() const;
121  FXint getActualStencilSize() const;
122  FXint getActualAccumRedSize() const;
123  FXint getActualAccumGreenSize() const;
124  FXint getActualAccumBlueSize() const;
125  FXint getActualAccumAlphaSize() const;
126 
127  /// Is it double buffered?
128  FXbool isDoubleBuffer() const;
129 
130  /// Is it stereo?
131  FXbool isStereo() const;
132 
133  /// Is it hardware-accelerated?
134  FXbool isAccelerated() const;
135 
136  /// Does it swap by copying instead of flipping buffers
137  FXbool isBufferSwapCopy() const;
138 
139  /// Save visual info to a stream
140  virtual void save(FXStream& store) const;
141 
142  /// Load visual info to a stream
143  virtual void load(FXStream& store);
144 
145  /// Destructor
146  virtual ~FXGLVisual();
147  };
148 
149 
150 /// Create a display list of bitmaps from font glyphs in a font
151 extern FXAPI void glUseFXFont(FXFont* font,int first,int count,int list);
152 
153 }
154 
155 #endif
A Bitmap is a rectangular array of pixels.
Definition: FXBitmap.h:64
Base class for all windows.
Definition: FXWindow.h:115
unsigned int FXuint
Definition: fxdefs.h:389
void glUseFXFont(FXFont *font, int first, int count, int list)
Create a display list of bitmaps from font glyphs in a font.
#define FXAPI
Definition: fxdefs.h:122
FXuchar FXbool
Definition: fxdefs.h:386
Application Object.
Definition: FXApp.h:158
Definition: FX4Splitter.h:31
int FXint
Definition: fxdefs.h:390
An Icon is an image with two additional server-side resources: a shape bitmap, which is used to mask ...
Definition: FXIcon.h:45
GLCanvas, an area drawn by another object.
Definition: FXGLCanvas.h:38
Visual describes pixel format of a drawable.
Definition: FXGLVisual.h:44
Visual describes pixel format of a drawable.
Definition: FXVisual.h:84
Window Device Context.
Definition: FXDCWindow.h:52
An Image is a rectangular array of pixels.
Definition: FXImage.h:67
#define FXDECLARE(classname)
Macro to set up class declaration.
Definition: FXObject.h:92

Copyright © 1997-2005 Jeroen van der Zijp