OpenSceneGraph 3.6.5
GraphicsThread
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_GRAPHICSTHREAD
15#define OSG_GRAPHICSTHREAD 1
16
17#include <osg/OperationThread>
18#include <osg/State>
19
20namespace osg {
21
22class GraphicsContext;
23
26{
27 public:
28
30
32 virtual void run();
33};
34
36{
37 GraphicsOperation(const std::string& name, bool keep):
38 Operation(name,keep) {}
39
42 virtual void operator () (Object* object);
43
44 virtual void operator () (GraphicsContext* context) = 0;
45
47 virtual void resizeGLObjectBuffers(unsigned int /*maxSize*/) {}
48
52 virtual void releaseGLObjects(osg::State* = 0) const {}
53};
54
55
58{
60 osg::Referenced(true),
61 GraphicsOperation("SwapBuffers",true) {}
62
63 virtual void operator () (GraphicsContext* context);
64};
65
67struct OSG_EXPORT BarrierOperation : public Operation, public OpenThreads::Barrier
68{
75
76 BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true):
77 osg::Referenced(true),
78 Operation("Barrier", keep),
79 OpenThreads::Barrier(numThreads),
80 _preBlockOp(op) {}
81
82 virtual void release();
83
84 virtual void operator () (Object* object);
85
87};
88
92{
94 osg::Referenced(true),
95 GraphicsOperation("ReleaseContext_Block_MakeCurrent", false) {}
96
97 virtual void release();
98
99 virtual void operator () (GraphicsContext* context);
100};
101
102struct OSG_EXPORT BlockAndFlushOperation : public GraphicsOperation, public OpenThreads::Block
103{
105
106 virtual void release();
107
108 virtual void operator () (GraphicsContext*);
109};
110
111
113{
114 FlushDeletedGLObjectsOperation(double availableTime, bool keep=false);
115
116 virtual void operator () (GraphicsContext*);
117
119};
120
122{
123public:
124
126 osg::GraphicsOperation("RunOperation",true) {}
127
128 virtual void operator () (osg::GraphicsContext* context);
129
130};
131
133{
134 public:
135
137
138 void completed(osg::State* state);
139
140 protected:
141
143};
144
145}
146
147#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Base class for providing Windowing API agnostic access to creating and managing graphics context.
Definition GraphicsContext:30
virtual void run()
Run does the graphics thread run loop.
Definition GraphicsThread:36
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
Definition GraphicsThread:52
virtual void resizeGLObjectBuffers(unsigned int)
Resize any per context GLObject buffers to specified size.
Definition GraphicsThread:47
GraphicsOperation(const std::string &name, bool keep)
Definition GraphicsThread:37
SwapBuffersOperation()
Definition GraphicsThread:59
PreBlockOp
Definition GraphicsThread:70
@ GL_FINISH
Definition GraphicsThread:73
@ NO_OPERATION
Definition GraphicsThread:71
@ GL_FLUSH
Definition GraphicsThread:72
BarrierOperation(int numThreads, PreBlockOp op=NO_OPERATION, bool keep=true)
Definition GraphicsThread:76
virtual void release()
if this operation is a barrier then release it.
PreBlockOp _preBlockOp
Definition GraphicsThread:86
virtual void release()
if this operation is a barrier then release it.
ReleaseContext_Block_MakeCurrentOperation()
Definition GraphicsThread:93
virtual void release()
if this operation is a barrier then release it.
double _availableTime
Definition GraphicsThread:118
FlushDeletedGLObjectsOperation(double availableTime, bool keep=false)
RunOperations()
Definition GraphicsThread:125
EndOfDynamicDrawBlock(unsigned int)
void completed(osg::State *state)
~EndOfDynamicDrawBlock()
Definition GraphicsThread:142
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
RefBlock()
Definition OperationThread:34
Operation(const std::string &name, bool keep)
Definition OperationThread:54
OperationThread is a helper class for running Operation within a single thread.
Definition OperationThread:154
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
#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.