~saiarcot895/ubuntu/trusty/openscenegraph/armhf-support

« back to all changes in this revision

Viewing changes to OpenSceneGraph/include/osg/GraphicsContext

  • Committer: Bazaar Package Importer
  • Author(s): Loic Dachary (OuoU)
  • Date: 2009-03-23 14:08:20 UTC
  • mfrom: (1.1.7 upstream) (2.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20090323140820-i4j3jozdlhyn4lre
rules prevent lib64 with -D LIB_POSTFIX="" (Closes: #517671)

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 
17
17
#include <osg/State>
18
18
#include <osg/GraphicsThread>
 
19
#include <vector>
19
20
 
20
21
namespace osg {
21
22
 
92
93
                useMultiThreadedOpenGLEngine(false),
93
94
                useCursor(true),
94
95
                sharedContext(0),
95
 
                setInheritedWindowPixelFormat(false) {}
 
96
                setInheritedWindowPixelFormat(false),
 
97
                overrideRedirect(false) {}
96
98
                            
97
99
            // graphics context original and size
98
100
            int x;
145
147
            
146
148
            // ask the GraphicsWindow implementation to set the pixel format of an inherited window
147
149
            bool setInheritedWindowPixelFormat;
148
 
        };
149
 
    
150
 
    
 
150
            
 
151
            // X11 hint whether to override the window managers window size/position redirection
 
152
            bool overrideRedirect;
 
153
        };
 
154
 
 
155
        /** Simple resolution structure used by WindowingSystemInterface to get and set screen resolution.
 
156
          * Note the '0' value stands for 'unset'. */
 
157
        struct ScreenSettings {
 
158
            ScreenSettings() :
 
159
                width(0),
 
160
                height(0),
 
161
                refreshRate(0),
 
162
                colorDepth(0)
 
163
            {}
 
164
            ScreenSettings(int width, int height, double refreshRate=0, unsigned int colorDepth=0) :
 
165
                width(width),
 
166
                height(height),
 
167
                refreshRate(refreshRate),
 
168
                colorDepth(colorDepth)
 
169
            {}
 
170
 
 
171
            int width;
 
172
            int height;
 
173
            double refreshRate;         ///< Screen refresh rate, in Hz.
 
174
            unsigned int colorDepth;    ///< RGB(A) color buffer depth.
 
175
        };
 
176
 
 
177
        typedef std::vector<ScreenSettings> ScreenSettingsList;
 
178
 
151
179
        /** Callback to be implemented to provide access to Windowing API's ability to create Windows/pbuffers.*/
152
180
        struct WindowingSystemInterface : public osg::Referenced
153
181
        {
154
 
        
155
182
            virtual unsigned int getNumScreens(const ScreenIdentifier& screenIdentifier = ScreenIdentifier()) = 0;
156
183
 
157
 
            virtual void getScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int& width, unsigned int& height) = 0;
158
 
 
159
 
            virtual bool setScreenResolution(const ScreenIdentifier& /*screenIdentifier*/, unsigned int /*width*/, unsigned int /*height*/) { return false; }
160
 
        
161
 
            virtual bool setScreenRefreshRate(const ScreenIdentifier& /*screenIdentifier*/, double /*refreshRate*/) { return false; }
 
184
            virtual void getScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettings & resolution) = 0;
 
185
 
 
186
            virtual bool setScreenSettings(const ScreenIdentifier& /*screenIdentifier*/, const ScreenSettings & /*resolution*/) { return false; }
 
187
 
 
188
            virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0;
162
189
 
163
190
            virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0;
164
191
            
165
 
            virtual ~WindowingSystemInterface() {};
 
192
            virtual ~WindowingSystemInterface() {}
 
193
 
 
194
 
 
195
            /** Gets screen resolution without using the ScreenResolution structure.
 
196
              * \deprecated Provided only for backward compatibility. */
 
197
            inline void getScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int& width, unsigned int& height)
 
198
            {
 
199
                ScreenSettings settings;
 
200
                getScreenSettings(screenIdentifier, settings);
 
201
                width = settings.width;
 
202
                height = settings.height;
 
203
            }
 
204
 
 
205
            /** Sets screen resolution without using the ScreenSettings structure.
 
206
              * \deprecated Provided only for backward compatibility. */
 
207
            inline bool setScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height)
 
208
            {
 
209
                return setScreenSettings(screenIdentifier, ScreenSettings(width, height));
 
210
            }
 
211
 
 
212
            /** \deprecated Provided only for backward compatibility. */
 
213
            inline bool setScreenRefreshRate(const ScreenIdentifier& screenIdentifier, double refreshRate)
 
214
            {
 
215
                ScreenSettings settings;
 
216
                getScreenSettings(screenIdentifier, settings);
 
217
                settings.refreshRate = refreshRate;
 
218
                return setScreenSettings(screenIdentifier, settings);
 
219
            }
166
220
        };
167
221
    
168
222
    
263
317
        inline const Vec4& getClearColor() const { return _clearColor; }
264
318
        
265
319
        /** Set the clear mask used in glClear(..).
266
 
          * Defaults to GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT. */
 
320
          * Defaults to 0 - so no clear is done by default by the GraphicsContext, instead the Camera's attached the GraphicsContext will do the clear. 
 
321
          * GraphicsContext::setClearMask() is useful for when the Camera's Viewports don't conver the whole context, so the context will fill in the gaps. */
267
322
        inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
268
323
 
269
324
        /** Get the clear mask.*/