146
148
// ask the GraphicsWindow implementation to set the pixel format of an inherited window
147
149
bool setInheritedWindowPixelFormat;
151
// X11 hint whether to override the window managers window size/position redirection
152
bool overrideRedirect;
155
/** Simple resolution structure used by WindowingSystemInterface to get and set screen resolution.
156
* Note the '0' value stands for 'unset'. */
157
struct ScreenSettings {
164
ScreenSettings(int width, int height, double refreshRate=0, unsigned int colorDepth=0) :
167
refreshRate(refreshRate),
168
colorDepth(colorDepth)
173
double refreshRate; ///< Screen refresh rate, in Hz.
174
unsigned int colorDepth; ///< RGB(A) color buffer depth.
177
typedef std::vector<ScreenSettings> ScreenSettingsList;
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
155
182
virtual unsigned int getNumScreens(const ScreenIdentifier& screenIdentifier = ScreenIdentifier()) = 0;
157
virtual void getScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int& width, unsigned int& height) = 0;
159
virtual bool setScreenResolution(const ScreenIdentifier& /*screenIdentifier*/, unsigned int /*width*/, unsigned int /*height*/) { return false; }
161
virtual bool setScreenRefreshRate(const ScreenIdentifier& /*screenIdentifier*/, double /*refreshRate*/) { return false; }
184
virtual void getScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettings & resolution) = 0;
186
virtual bool setScreenSettings(const ScreenIdentifier& /*screenIdentifier*/, const ScreenSettings & /*resolution*/) { return false; }
188
virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0;
163
190
virtual GraphicsContext* createGraphicsContext(Traits* traits) = 0;
165
virtual ~WindowingSystemInterface() {};
192
virtual ~WindowingSystemInterface() {}
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)
199
ScreenSettings settings;
200
getScreenSettings(screenIdentifier, settings);
201
width = settings.width;
202
height = settings.height;
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)
209
return setScreenSettings(screenIdentifier, ScreenSettings(width, height));
212
/** \deprecated Provided only for backward compatibility. */
213
inline bool setScreenRefreshRate(const ScreenIdentifier& screenIdentifier, double refreshRate)
215
ScreenSettings settings;
216
getScreenSettings(screenIdentifier, settings);
217
settings.refreshRate = refreshRate;
218
return setScreenSettings(screenIdentifier, settings);
263
317
inline const Vec4& getClearColor() const { return _clearColor; }
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; }
269
324
/** Get the clear mask.*/