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

FXGLVisual.h
1 /********************************************************************************
2 * *
3 * V i s u a l C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1999,2017 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (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 *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXGLVISUAL_H
22 #define FXGLVISUAL_H
23 
24 #ifndef FXVISUAL_H
25 #include "FXVisual.h"
26 #endif
27 
28 namespace FX {
29 
30 
31 class FXFont;
32 class FXWindow;
33 class FXImage;
34 class FXIcon;
35 class FXBitmap;
36 class FXDCWindow;
37 
38 
40 class FXAPI FXGLVisual : public FXVisual {
41  FXDECLARE(FXGLVisual)
42  friend class FXWindow;
43  friend class FXImage;
44  friend class FXIcon;
45  friend class FXBitmap;
46  friend class FXDCWindow;
47 protected:
48  struct FXGLSpecs;
49 protected:
50  FXuchar redSize; // Red bits
51  FXuchar greenSize; // Green depth
52  FXuchar blueSize; // Blue bits
53  FXuchar alphaSize; // Alpha bits
54  FXuchar depthSize; // Depth bits
55  FXuchar stencilSize; // Stencil bits
56  FXuchar multiSamples; // Multi-sampling
57  FXuchar accumRedSize; // Red accu buffer bits
58  FXuchar accumGreenSize; // Green accu buffer bits
59  FXuchar accumBlueSize; // Blue accu buffer bits
60  FXuchar accumAlphaSize; // Alpha accu buffer bits
61  FXuchar actualRedSize; // Actual Red bits
62  FXuchar actualGreenSize; // Actual Green depth
63  FXuchar actualBlueSize; // Actual Blue bits
64  FXuchar actualAlphaSize; // Actual Alpha bits
65  FXuchar actualDepthSize; // Actual Depth bits
66  FXuchar actualStencilSize; // Actual Stencil bits
67  FXuchar actualMultiSamples; // Actual multi-sampling
68  FXuchar actualAccumRedSize; // Actual Red accu buffer bits
69  FXuchar actualAccumGreenSize; // Actual Green accu buffer bits
70  FXuchar actualAccumBlueSize; // Actual Blue accu buffer bits
71  FXuchar actualAccumAlphaSize; // Actual Alpha accu buffer bits
72  FXbool doubleBuffer;
73  FXbool stereoBuffer;
74  FXbool accelerated;
75  FXbool copying;
76 protected:
77  FXGLVisual();
78 private:
79  FXGLVisual(const FXGLVisual&);
80  FXGLVisual &operator=(const FXGLVisual&);
81  FXint matchSpecs(const FXGLSpecs& s);
82 public:
83 
85  FXGLVisual(FXApp* a,FXuint flgs=VISUAL_DOUBLE_BUFFER);
86 
88  virtual void create();
89 
91  virtual void detach();
92 
94  virtual void destroy();
95 
97  FXint getRedSize() const { return redSize; }
98  FXint getGreenSize() const { return greenSize; }
99  FXint getBlueSize() const { return blueSize; }
100  FXint getAlphaSize() const { return alphaSize; }
101  FXint getDepthSize() const { return depthSize; }
102  FXint getStencilSize() const { return stencilSize; }
103  FXint getMultiSamples() const { return multiSamples; }
104  FXint getAccumRedSize() const { return accumRedSize; }
105  FXint getAccumGreenSize() const { return accumGreenSize; }
106  FXint getAccumBlueSize() const { return accumBlueSize; }
107  FXint getAccumAlphaSize() const { return accumAlphaSize; }
108 
110  void setRedSize(FXint rs){ redSize=rs; }
111  void setGreenSize(FXint gs){ greenSize=gs; }
112  void setBlueSize(FXint bs){ blueSize=bs; }
113  void setAlphaSize(FXint as){ alphaSize=as; }
114  void setDepthSize(FXint ds){ depthSize=ds; }
115  void setStencilSize(FXint ss){ stencilSize=ss; }
116  void setMultiSamples(FXint ms){ multiSamples=ms; }
117  void setAccumRedSize(FXint rs){ accumRedSize=rs; }
118  void setAccumGreenSize(FXint gs){ accumGreenSize=gs; }
119  void setAccumBlueSize(FXint bs){ accumBlueSize=bs; }
120  void setAccumAlphaSize(FXint as){ accumAlphaSize=as; }
121 
123  FXint getActualRedSize() const { return actualRedSize; }
124  FXint getActualGreenSize() const { return actualGreenSize; }
125  FXint getActualBlueSize() const { return actualBlueSize; }
126  FXint getActualAlphaSize() const { return actualAlphaSize; }
127  FXint getActualDepthSize() const { return actualDepthSize; }
128  FXint getActualStencilSize() const { return actualStencilSize; }
129  FXint getActualMultiSamples() const { return actualMultiSamples; }
130  FXint getActualAccumRedSize() const { return actualAccumRedSize; }
131  FXint getActualAccumGreenSize() const { return actualAccumGreenSize; }
132  FXint getActualAccumBlueSize() const { return actualAccumBlueSize; }
133  FXint getActualAccumAlphaSize() const { return actualAccumAlphaSize; }
134 
136  FXbool isDoubleBuffer() const { return doubleBuffer; }
137 
139  FXbool isStereo() const { return stereoBuffer; }
140 
142  FXbool isAccelerated() const { return accelerated; }
143 
145  FXbool isBufferSwapCopy() const { return copying; }
146 
148  static FXbool hasOpenGL(FXApp* application);
149 
151  virtual void save(FXStream& store) const;
152 
154  virtual void load(FXStream& store);
155 
157  virtual ~FXGLVisual();
158  };
159 
160 }
161 
162 #endif

Copyright © 1997-2016 Jeroen van der Zijp