OpenSceneGraph 3.6.5
GraphicsContext
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_GRAPHICSCONTEXT
15#define OSG_GRAPHICSCONTEXT 1
16
17#include <osg/State>
18#include <osg/GraphicsThread>
19#include <osg/Timer>
20
21#include <vector>
22
23namespace osg {
24
25// forward declare osg::Camera
26class Camera;
27
30{
31 public:
32
34 {
36
37 ScreenIdentifier(int in_screenNum);
38
39 ScreenIdentifier(const std::string& in_hostName,int in_displayNum, int in_screenNum);
40
42 std::string displayName() const;
43
49
54 void setScreenIdentifier(const std::string& displayName);
55
62
63 std::string hostName;
66 };
67
70 {
72
73 // graphics context original and size
74 int x;
75 int y;
76 int width;
77 int height;
78
79 // provide a hint as to which WindowingSystemInterface implementation to use, i.e. "X11", "Win32", "Cocoa", "Carbon" etc.
80 // if the windowingSystemPreference string is empty (default) then return the first available WindowingSystemInterface that
81 // has been registered with the osg::GraphiccsContext::WindowingSystemInterfaces singleton
82 // if the windowingSystemPreference string is not empty then return the first WindowingSystemInterface that matches
84
85 // window decoration and behaviour
86 std::string windowName;
89
90 // buffer depths, 0 equals off.
91 unsigned int red;
92 unsigned int blue;
93 unsigned int green;
94 unsigned int alpha;
95 unsigned int depth;
96 unsigned int stencil;
97
98 // multi sample parameters
99 unsigned int sampleBuffers;
100 unsigned int samples;
101
102 // buffer configuration
106
107 // render to texture
108 GLenum target;
109 GLenum format;
110 unsigned int level;
111 unsigned int face;
112 unsigned int mipMapGeneration;
113
114 // V-sync
115 bool vsync;
116
117 // Swap Group
119 GLuint swapGroup;
121
122 // use multithreaded OpenGL-engine (OS X only)
124
125 // enable cursor
127
128 // settings used in set up of graphics context, only presently used by GL3 build of OSG.
129 std::string glContextVersion;
130 unsigned int glContextFlags;
132
134 bool getContextVersion(unsigned int& major, unsigned int& minor) const;
135
136 // shared context
138
140
141 // ask the GraphicsWindow implementation to set the pixel format of an inherited window
143
144 // X11 hint whether to override the window managers window size/position redirection
146
148
149 // hint of what affinity to use for any thrads associated with the graphics context created using these Traits
150 OpenThreads::Affinity affinity;
151 };
152
157 width(0),
158 height(0),
159 refreshRate(0),
160 colorDepth(0)
161 {}
162
163 ScreenSettings(int in_width, int in_height, double in_refreshRate=0, unsigned int in_colorDepth=0) :
164 width(in_width),
165 height(in_height),
166 refreshRate(in_refreshRate),
167 colorDepth(in_colorDepth)
168 {}
169
170 int width;
172 double refreshRate;
173 unsigned int colorDepth;
174 };
175
176 typedef std::vector<ScreenSettings> ScreenSettingsList;
177
180 {
181 void setName(const std::string& name) { _name = name; }
182 const std::string& getName() const { return _name; }
183
184 virtual unsigned int getNumScreens(const ScreenIdentifier& screenIdentifier = ScreenIdentifier()) = 0;
185
186 virtual void getScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettings & resolution) = 0;
187
188 virtual bool setScreenSettings(const ScreenIdentifier& /*screenIdentifier*/, const ScreenSettings & /*resolution*/) { return false; }
189
190 virtual void enumerateScreenSettings(const ScreenIdentifier& screenIdentifier, ScreenSettingsList & resolutionList) = 0;
191
193
194 virtual osg::DisplaySettings* getDisplaySettings() const { return 0; }
195
197
200 inline void getScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int& width, unsigned int& height)
201 {
202 ScreenSettings settings;
203 getScreenSettings(screenIdentifier, settings);
204 width = settings.width;
205 height = settings.height;
206 }
207
210 inline bool setScreenResolution(const ScreenIdentifier& screenIdentifier, unsigned int width, unsigned int height)
211 {
212 return setScreenSettings(screenIdentifier, ScreenSettings(width, height));
213 }
214
216 inline bool setScreenRefreshRate(const ScreenIdentifier& screenIdentifier, double refreshRate)
217 {
218 ScreenSettings settings;
219 getScreenSettings(screenIdentifier, settings);
220 settings.refreshRate = refreshRate;
221 return setScreenSettings(screenIdentifier, settings);
222 }
223 protected:
226
227 std::string _name;
228 };
229
231 {
232 public:
234
235 typedef std::vector< osg::ref_ptr<GraphicsContext::WindowingSystemInterface> > Interfaces;
236
237 Interfaces& getInterfaces() { return _interfaces; }
238
240
242
245
246 private:
248 Interfaces _interfaces;
249 };
250
252
254 static WindowingSystemInterface* getWindowingSystemInterface(const std::string& name = "");
255
258
261 static unsigned int createNewContextID();
262
264 static unsigned int getMaxContextID();
265
267 static void incrementContextIDUsageCount(unsigned int contextID);
268
270 static void decrementContextIDUsageCount(unsigned int contextID);
271
272 typedef std::vector<GraphicsContext*> GraphicsContexts;
273
276
278 static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID);
279
281 static void setCompileContext(unsigned int contextID, GraphicsContext* gc);
282
284 static GraphicsContext* getOrCreateCompileContext(unsigned int contextID);
285
287 static GraphicsContext* getCompileContext(unsigned int contextID);
288
289 public:
290
292 void add(Operation* operation);
293
295 void remove(Operation* operation);
296
298 void remove(const std::string& name);
299
302
304 virtual void runOperations();
305
306 typedef std::list< ref_ptr<Operation> > GraphicsOperationQueue;
307
310
312 OpenThreads::Mutex* getOperationsMutex() { return &_operationsMutex; }
313
316
319
320
321 public:
322
324 inline const Traits* getTraits() const { return _traits.get(); }
325
327 virtual bool valid() const = 0;
328
329
331 inline void setState(State* state) { _state = state; }
332
334 inline State* getState() { return _state.get(); }
335
337 inline const State* getState() const { return _state.get(); }
338
339
341 inline void setClearColor(const Vec4& color) { _clearColor = color; }
342
344 inline const Vec4& getClearColor() const { return _clearColor; }
345
349 inline void setClearMask(GLbitfield mask) { _clearMask = mask; }
350
352 inline GLbitfield getClearMask() const { return _clearMask; }
353
356 virtual void clear();
357
359
360
362 bool realize();
363
369 void close(bool callCloseImplementation=true);
370
373
375 inline bool isRealized() const { return isRealizedImplementation(); }
376
377
382
387
391
393 inline bool isCurrent() const { return _threadOfLastMakeCurrent == OpenThreads::Thread::CurrentThreadId(); }
394
396 inline void bindPBufferToTexture(GLenum buffer) { bindPBufferToTextureImplementation(buffer); }
397
398
399
402
405
408
410 const GraphicsThread* getGraphicsThread() const { return _graphicsThread.get(); }
411
412
415 virtual bool realizeImplementation() = 0;
416
419 virtual bool isRealizedImplementation() const = 0;
420
423 virtual void closeImplementation() = 0;
424
427 virtual bool makeCurrentImplementation() = 0;
428
431 virtual bool makeContextCurrentImplementation(GraphicsContext* readContext) = 0;
432
435
438 virtual void bindPBufferToTextureImplementation(GLenum buffer) = 0;
439
441 {
443 };
444
450
453
455 const SwapCallback* getSwapCallback() const { return _swapCallback.get(); }
456
461 {
462 if (_state.valid()) _state->frameCompleted();
463
464 if (_swapCallback.valid()) _swapCallback->swapBuffersImplementation(this);
466 }
467
470 virtual void swapBuffersImplementation() = 0;
471
472
473
476 void resized(int x, int y, int width, int height)
477 {
478 if (_resizedCallback.valid()) _resizedCallback->resizedImplementation(this, x, y, width, height);
479 else resizedImplementation(x, y, width, height);
480 }
481
483 {
484 virtual void resizedImplementation(GraphicsContext* gc, int x, int y, int width, int height) = 0;
485 };
486
490
493
495 const ResizedCallback* getResizedCallback() const { return _resizedCallback.get(); }
496
498 virtual void resizedImplementation(int x, int y, int width, int height);
499
500
501 typedef std::list< osg::Camera* > Cameras;
502
505
507 const Cameras& getCameras() const { return _cameras; }
508
510 void setDefaultFboId(GLuint i) { _defaultFboId = i; }
511
512 GLuint getDefaultFboId() const { return _defaultFboId; }
513
514 public:
515
516 virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsContext*>(object)!=0; }
517 virtual const char* libraryName() const { return "osg"; }
518 virtual const char* className() const { return "GraphicsContext"; }
519
520 protected:
521
524
526
527 virtual Object* cloneType() const { return 0; }
528 virtual Object* clone(const CopyOp&) const { return 0; }
529
532
535
536
537 void addCamera(osg::Camera* camera);
539
541
542 friend class osg::Camera;
543
546
548 GLbitfield _clearMask;
549
551
552 OpenThreads::Mutex _operationsMutex;
556
558
561
563
565};
566
567//#include <osg/GLExtensions>
568
569
579
580
581template<class T>
583{
584 WindowingSystemInterfaceProxy(const std::string& name)
585 {
586 _wsi = new T;
587 _wsi->setName(name);
588
589 osg::GraphicsContext::getWindowingSystemInterfaces()->addWindowingSystemInterface(_wsi.get());
590 }
591
593 {
594 osg::GraphicsContext::getWindowingSystemInterfaces()->removeWindowingSystemInterface(_wsi.get());
595 }
596
598};
599
600#define REGISTER_WINDOWINGSYSTEMINTERFACE(ext, classname) \
601 extern "C" void graphicswindow_##ext(void) {} \
602 static osg::WindowingSystemInterfaceProxy<classname> s_proxy_##classname(#ext);
603
604}
605
606#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
struct __GLsync * GLsync
Definition GLDefines:680
Vec4f Vec4
Definition Vec4:21
unsigned long long Timer_t
Definition Timer:24
Camera - is a subclass of Transform which represents encapsulates the settings of a Camera.
Definition Camera:45
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
DisplaySettings class for encapsulating what visuals are required and have been set up,...
Definition DisplaySettings:34
SwapMethod
Definition DisplaySettings:257
Base class for providing Windowing API agnostic access to creating and managing graphics context.
Definition GraphicsContext:30
void removeAllOperations()
Remove all operations from OperationQueue.
virtual bool isSameKindAs(const Object *object) const
Definition GraphicsContext:516
bool isRealized() const
Return true if the graphics context has been realized and is ready to use.
Definition GraphicsContext:375
double getTimeSinceLastClear() const
Definition GraphicsContext:358
const State * getState() const
Get the const State object which tracks the current OpenGL state for this graphics context.
Definition GraphicsContext:337
Vec4 _clearColor
Definition GraphicsContext:547
bool isCurrent() const
Return true if the current thread has this OpenGL graphics context.
Definition GraphicsContext:393
void resized(int x, int y, int width, int height)
resized method should be called when the underlying window has been resized and the GraphicsWindow an...
Definition GraphicsContext:476
ref_ptr< State > _state
Definition GraphicsContext:545
void setSwapCallback(SwapCallback *rc)
Set the swap callback which overrides the GraphicsContext::swapBuffersImplementation(),...
Definition GraphicsContext:449
void setDefaultFboId(GLuint i)
set the default FBO-id, this id will be used when the rendering-backend is finished with RTT FBOs
Definition GraphicsContext:510
static void decrementContextIDUsageCount(unsigned int contextID)
Decrement the usage count associate with a contextID.
osg::ref_ptr< osg::RefBlock > _operationsBlock
Definition GraphicsContext:553
Timer_t _lastClearTick
Definition GraphicsContext:562
GLuint _defaultFboId
Definition GraphicsContext:564
virtual void bindPBufferToTextureImplementation(GLenum buffer)=0
Pure virtual, Bind the graphics context to associated texture implementation.
static GraphicsContexts getRegisteredGraphicsContexts(unsigned int contextID)
Get all the registered graphics contexts associated with a specific contextID.
std::list< ref_ptr< Operation > > GraphicsOperationQueue
Definition GraphicsContext:306
virtual bool makeCurrentImplementation()=0
Make this graphics context current implementation.
osg::ref_ptr< Operation > _currentOperation
Definition GraphicsContext:555
std::list< osg::Camera * > Cameras
Definition GraphicsContext:501
static void registerGraphicsContext(GraphicsContext *gc)
Register a GraphicsContext.
virtual void clear()
Do an OpenGL clear of the full graphics context/window.
std::vector< GraphicsContext * > GraphicsContexts
Definition GraphicsContext:272
SwapCallback * getSwapCallback()
Get the swap callback which overrides the GraphicsContext::swapBuffersImplementation().
Definition GraphicsContext:452
ref_ptr< Traits > _traits
Definition GraphicsContext:544
static unsigned int createNewContextID()
Create a contextID for a new graphics context, this contextID is used to set up the osg::State associ...
void remove(const std::string &name)
Remove named operation from OperationQueue.
Cameras & getCameras()
Get the list of cameras associated with this graphics context.
Definition GraphicsContext:504
static void setCompileContext(unsigned int contextID, GraphicsContext *gc)
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specifi...
virtual ~GraphicsContext()
GLuint getDefaultFboId() const
Definition GraphicsContext:512
void add(Operation *operation)
Add operation to end of OperationQueue.
std::vector< ScreenSettings > ScreenSettingsList
Definition GraphicsContext:176
ref_ptr< ResizedCallback > _resizedCallback
Definition GraphicsContext:559
virtual void closeImplementation()=0
Close the graphics context implementation.
size_t _threadOfLastMakeCurrent
Definition GraphicsContext:550
GraphicsOperationQueue & getOperationsQueue()
Get the operations queue, note you must use the OperationsMutex when accessing the queue.
Definition GraphicsContext:309
GraphicsThread * getGraphicsThread()
Get the graphics thread assigned the graphics context.
Definition GraphicsContext:407
void bindPBufferToTexture(GLenum buffer)
Bind the graphics context to associated texture.
Definition GraphicsContext:396
osg::RefBlock * getOperationsBlock()
Get the operations queue block used to mark an empty queue, if you end items into the empty queue you...
Definition GraphicsContext:315
const GraphicsThread * getGraphicsThread() const
Get the const graphics thread assigned the graphics context.
Definition GraphicsContext:410
virtual bool makeContextCurrentImplementation(GraphicsContext *readContext)=0
Make this graphics context current with specified read context implementation.
virtual bool isRealizedImplementation() const =0
Return true if the graphics context has been realized, and is ready to use, implementation.
GLbitfield getClearMask() const
Get the clear mask.
Definition GraphicsContext:352
virtual void runOperations()
Run the operations.
Cameras _cameras
Definition GraphicsContext:540
virtual const char * libraryName() const
return the name of the object's library.
Definition GraphicsContext:517
static unsigned int getMaxContextID()
Get the current max ContextID.
void setClearMask(GLbitfield mask)
Set the clear mask used in glClear(..).
Definition GraphicsContext:349
static void incrementContextIDUsageCount(unsigned int contextID)
Increment the usage count associate with a contextID.
virtual bool valid() const =0
Return whether a valid and usable GraphicsContext has been created.
virtual bool realizeImplementation()=0
Realize the GraphicsContext implementation, Pure virtual - must be implemented by concrete implementa...
void setGraphicsThread(GraphicsThread *gt)
Assign a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
ResizedCallback * getResizedCallback()
Get the resized callback which overrides the GraphicsConext::realizedImplementation().
Definition GraphicsContext:492
const Cameras & getCameras() const
Get the const list of cameras associated with this graphics context.
Definition GraphicsContext:507
void setClearColor(const Vec4 &color)
Sets the clear color.
Definition GraphicsContext:341
OpenThreads::Mutex _operationsMutex
Definition GraphicsContext:552
static WindowingSystemInterface * getWindowingSystemInterface(const std::string &name="")
Get the default WindowingSystemInterface for this OS.
ref_ptr< SwapCallback > _swapCallback
Definition GraphicsContext:560
void swapBuffersCallbackOrImplementation()
Convenience method for handling whether to call swapbuffers callback or the standard context swapBuff...
Definition GraphicsContext:460
bool realize()
Realize the GraphicsContext.
virtual bool releaseContextImplementation()=0
Release the graphics context implementation.
GraphicsOperationQueue _operations
Definition GraphicsContext:554
void remove(Operation *operation)
Remove operation from OperationQueue.
void createGraphicsThread()
Create a graphics thread to the graphics context, so that the thread handles all OpenGL operations.
const Traits * getTraits() const
Get the traits of the GraphicsContext.
Definition GraphicsContext:324
const ResizedCallback * getResizedCallback() const
Get the const resized callback which overrides the GraphicsConext::realizedImplementation().
Definition GraphicsContext:495
static void unregisterGraphicsContext(GraphicsContext *gc)
Unregister a GraphicsContext.
void setState(State *state)
Set the State object which tracks the current OpenGL state for this graphics context.
Definition GraphicsContext:331
Operation * getCurrentOperation()
Get the current operations that is being run.
Definition GraphicsContext:318
const SwapCallback * getSwapCallback() const
Get the const swap callback which overrides the GraphicsContext::swapBuffersImplementation().
Definition GraphicsContext:455
State * getState()
Get the State object which tracks the current OpenGL state for this graphics context.
Definition GraphicsContext:334
void removeCamera(osg::Camera *camera)
virtual void resizedImplementation(int x, int y, int width, int height)
resized implementation, by default resizes the viewports and aspect ratios the cameras associated wit...
virtual const char * className() const
return the name of the object's class type.
Definition GraphicsContext:518
GraphicsContext(const GraphicsContext &, const osg::CopyOp &)
static GraphicsContext * createGraphicsContext(Traits *traits)
Create a graphics context for a specified set of traits.
void swapBuffers()
swap the front and back buffers.
bool makeContextCurrent(GraphicsContext *readContext)
Make this graphics context current with specified read context.
ref_ptr< GraphicsThread > _graphicsThread
Definition GraphicsContext:557
const Vec4 & getClearColor() const
Returns the clear color.
Definition GraphicsContext:344
OpenThreads::Mutex * getOperationsMutex()
Get the operations queue mutex.
Definition GraphicsContext:312
static GraphicsContext * getOrCreateCompileContext(unsigned int contextID)
Get existing or create a new GraphicsContext to do background compilation for GraphicsContexts associ...
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition GraphicsContext:527
GLbitfield _clearMask
Definition GraphicsContext:548
bool releaseContext()
Release the graphics context.
void close(bool callCloseImplementation=true)
close the graphics context.
static GraphicsContext * getCompileContext(unsigned int contextID)
Get the GraphicsContext for doing background compilation for GraphicsContexts associated with specifi...
static osg::ref_ptr< WindowingSystemInterfaces > & getWindowingSystemInterfaces()
virtual Object * clone(const CopyOp &) const
Clone an object, with Object* return type.
Definition GraphicsContext:528
virtual void swapBuffersImplementation()=0
Swap the front and back buffers implementation.
bool makeCurrent()
Make this graphics context current.
void setResizedCallback(ResizedCallback *rc)
Set the resized callback which overrides the GraphicsConext::realizedImplementation(),...
Definition GraphicsContext:489
static GraphicsContexts getAllRegisteredGraphicsContexts()
Get all the registered graphics contexts.
void addCamera(osg::Camera *camera)
Definition GraphicsContext:34
ScreenIdentifier(const std::string &in_hostName, int in_displayNum, int in_screenNum)
void setUndefinedScreenDetailsToDefaultScreen()
Set any undefined displayNum or screenNum values (i.e.
Definition GraphicsContext:57
std::string hostName
Definition GraphicsContext:63
void readDISPLAY()
Read the DISPLAY environmental variable, and set the ScreenIdentifier accordingly.
std::string displayName() const
Return the display name in the form hostName::displayNum:screenNum.
int screenNum
Definition GraphicsContext:65
void setScreenIdentifier(const std::string &displayName)
Set the screenIndentifier from the displayName string.
int displayNum
Definition GraphicsContext:64
GraphicsContext Traits object provides the specification of what type of graphics context is required...
Definition GraphicsContext:70
int width
Definition GraphicsContext:76
GLenum target
Definition GraphicsContext:108
unsigned int face
Definition GraphicsContext:111
bool vsync
Definition GraphicsContext:115
int y
Definition GraphicsContext:75
unsigned int glContextProfileMask
Definition GraphicsContext:131
bool doubleBuffer
Definition GraphicsContext:105
unsigned int level
Definition GraphicsContext:110
bool getContextVersion(unsigned int &major, unsigned int &minor) const
return true if glContextVersion is set in the form major.minor, and assign the appropriate major and ...
unsigned int red
Definition GraphicsContext:91
bool pbuffer
Definition GraphicsContext:103
osg::ref_ptr< osg::Referenced > inheritedWindowData
Definition GraphicsContext:139
unsigned int samples
Definition GraphicsContext:100
bool useCursor
Definition GraphicsContext:126
std::string windowingSystemPreference
Definition GraphicsContext:83
GLuint swapBarrier
Definition GraphicsContext:120
bool setInheritedWindowPixelFormat
Definition GraphicsContext:142
unsigned int sampleBuffers
Definition GraphicsContext:99
bool swapGroupEnabled
Definition GraphicsContext:118
unsigned int green
Definition GraphicsContext:93
bool useMultiThreadedOpenGLEngine
Definition GraphicsContext:123
bool windowDecoration
Definition GraphicsContext:87
bool overrideRedirect
Definition GraphicsContext:145
bool supportsResize
Definition GraphicsContext:88
osg::observer_ptr< GraphicsContext > sharedContext
Definition GraphicsContext:137
unsigned int glContextFlags
Definition GraphicsContext:130
int height
Definition GraphicsContext:77
DisplaySettings::SwapMethod swapMethod
Definition GraphicsContext:147
OpenThreads::Affinity affinity
Definition GraphicsContext:150
GLuint swapGroup
Definition GraphicsContext:119
unsigned int depth
Definition GraphicsContext:95
bool quadBufferStereo
Definition GraphicsContext:104
int x
Definition GraphicsContext:74
unsigned int stencil
Definition GraphicsContext:96
GLenum format
Definition GraphicsContext:109
std::string windowName
Definition GraphicsContext:86
unsigned int mipMapGeneration
Definition GraphicsContext:112
unsigned int alpha
Definition GraphicsContext:94
std::string glContextVersion
Definition GraphicsContext:129
Traits(DisplaySettings *ds=0)
unsigned int blue
Definition GraphicsContext:92
Simple resolution structure used by WindowingSystemInterface to get and set screen resolution.
Definition GraphicsContext:155
unsigned int colorDepth
RGB(A) color buffer depth.
Definition GraphicsContext:173
int height
Definition GraphicsContext:171
double refreshRate
Screen refresh rate, in Hz.
Definition GraphicsContext:172
ScreenSettings()
Definition GraphicsContext:156
int width
Definition GraphicsContext:170
ScreenSettings(int in_width, int in_height, double in_refreshRate=0, unsigned int in_colorDepth=0)
Definition GraphicsContext:163
Callback to be implemented to provide access to Windowing API's ability to create Windows/pbuffers.
Definition GraphicsContext:180
bool setScreenResolution(const ScreenIdentifier &screenIdentifier, unsigned int width, unsigned int height)
Sets screen resolution without using the ScreenSettings structure.
Definition GraphicsContext:210
WindowingSystemInterface()
Definition GraphicsContext:224
void setName(const std::string &name)
Definition GraphicsContext:181
std::string _name
Definition GraphicsContext:227
bool setScreenRefreshRate(const ScreenIdentifier &screenIdentifier, double refreshRate)
Definition GraphicsContext:216
virtual unsigned int getNumScreens(const ScreenIdentifier &screenIdentifier=ScreenIdentifier())=0
virtual osg::DisplaySettings * getDisplaySettings() const
Definition GraphicsContext:194
void getScreenResolution(const ScreenIdentifier &screenIdentifier, unsigned int &width, unsigned int &height)
Gets screen resolution without using the ScreenResolution structure.
Definition GraphicsContext:200
virtual void setDisplaySettings(DisplaySettings *)
Definition GraphicsContext:192
const std::string & getName() const
Definition GraphicsContext:182
virtual GraphicsContext * createGraphicsContext(Traits *traits)=0
virtual void getScreenSettings(const ScreenIdentifier &screenIdentifier, ScreenSettings &resolution)=0
virtual void enumerateScreenSettings(const ScreenIdentifier &screenIdentifier, ScreenSettingsList &resolutionList)=0
virtual bool setScreenSettings(const ScreenIdentifier &, const ScreenSettings &)
Definition GraphicsContext:188
virtual ~WindowingSystemInterface()
Definition GraphicsContext:225
WindowingSystemInterface * getWindowingSystemInterface(const std::string &name="")
get named WindowingSystemInterface if one is available, otherwise return 0;
Interfaces & getInterfaces()
Definition GraphicsContext:237
std::vector< osg::ref_ptr< GraphicsContext::WindowingSystemInterface > > Interfaces
Definition GraphicsContext:235
void removeWindowingSystemInterface(WindowingSystemInterface *wsInterface)
void addWindowingSystemInterface(WindowingSystemInterface *wsInterface)
Definition GraphicsContext:441
virtual void swapBuffersImplementation(GraphicsContext *gc)=0
Definition GraphicsContext:483
virtual void resizedImplementation(GraphicsContext *gc, int x, int y, int width, int height)=0
virtual void swapBuffersImplementation(GraphicsContext *gc)
GLsync _previousSync
Definition GraphicsContext:577
osg::ref_ptr< T > _wsi
Definition GraphicsContext:597
WindowingSystemInterfaceProxy(const std::string &name)
Definition GraphicsContext:584
~WindowingSystemInterfaceProxy()
Definition GraphicsContext:592
GraphicsThread is a helper class for running OpenGL GraphicsOperation within a single thread assigned...
Definition GraphicsThread:26
Object()
Construct an object.
Definition Object:69
Smart pointer for observed objects, that automatically set pointers to them to null when they are del...
Definition observer_ptr:39
Definition OperationThread:31
Base class for implementing graphics operations.
Definition OperationThread:51
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
static Timer * instance()
double delta_s(Timer_t t1, Timer_t t2) const
Get the time in seconds between timer ticks t1 and t2.
Definition Timer:59
#define OSG_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.