OpenSceneGraph 3.6.5
Renderer
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 OSGVIEWER_RENDERER
15#define OSGVIEWER_RENDERER 1
16
17#include <OpenThreads/Condition>
18#include <osg/Timer>
19#include <osgDB/DatabasePager>
20#include <osgUtil/SceneView>
21#include <osgViewer/Export>
22
23namespace osgViewer {
24
26{
27 public:
29
30 virtual void checkQuery(osg::Stats* stats, osg::State* state,
31 osg::Timer_t startTick) = 0;
32
33 virtual void beginQuery(unsigned int frameNumber, osg::State* state) = 0;
34 virtual void endQuery(osg::State* state) = 0;
35 virtual void initialize(osg::State* state, osg::Timer_t startTick);
36 protected:
37
39};
40
42{
43 public:
44
46
47 osgUtil::SceneView* getSceneView(unsigned int i) { return _sceneView[i].get(); }
48 const osgUtil::SceneView* getSceneView(unsigned int i) const { return _sceneView[i].get(); }
49
50 void setDone(bool done) { _done = done; }
51 bool getDone() { return _done; }
52
55
56
57 virtual void cull();
58 virtual void draw();
59 virtual void cull_draw();
60
61 virtual void compile();
62
63 virtual void resizeGLObjectBuffers(unsigned int maxSize);
64 virtual void releaseGLObjects(osg::State* = 0) const;
65
66 void setCompileOnNextDraw(bool flag) { _compileOnNextDraw = flag; }
68
69 virtual void operator () (osg::Object* object);
70
71 virtual void operator () (osg::GraphicsContext* context);
72
73 virtual void release();
74
75 virtual void reset();
76
78 void setCameraRequiresSetUp(bool flag);
80
81 protected:
82 void initialize(osg::State* state);
83 virtual ~Renderer();
84
85 virtual void updateSceneView(osgUtil::SceneView* sceneView);
86
88
89 bool _done;
93
95
97 {
98 OpenThreads::Mutex _mutex;
99 OpenThreads::Condition _cond;
100 typedef std::list<osgUtil::SceneView*> SceneViewList;
103
106
108 void release();
109
111 void reset();
112
115
118 };
119
120
123
127};
128
129}
130
131#endif
unsigned long long Timer_t
Definition Timer:24
The osgViewer library provides high level viewer functionality designed to make it easier to write a ...
Camera - is a subclass of Transform which represents encapsulates the settings of a Camera.
Definition Camera:45
Main GLExtensions class for managing OpenGL extensions per graphics context.
Definition GLExtensions:160
Base class for providing Windowing API agnostic access to creating and managing graphics context.
Definition GraphicsContext:30
Definition GraphicsThread:36
Base class/standard interface for objects which require IO support, cloning and reference counting.
Definition Object:61
Smart pointer for observed objects, that automatically set pointers to them to null when they are del...
Definition observer_ptr:39
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
Definition Stats:29
SceneView is deprecated, and is now just kept for backwards compatibility.
Definition SceneView:37
virtual void initialize(osg::State *state, osg::Timer_t startTick)
virtual void beginQuery(unsigned int frameNumber, osg::State *state)=0
virtual void checkQuery(osg::Stats *stats, osg::State *state, osg::Timer_t startTick)=0
const osg::GLExtensions * _extensions
Definition Renderer:38
virtual void endQuery(osg::State *state)=0
void setCameraRequiresSetUp(bool flag)
Force update of state associated with cameras.
virtual void reset()
ThreadSafeQueue _drawQueue
Definition Renderer:122
bool _done
Definition Renderer:89
bool getCompileOnNextDraw() const
Definition Renderer:67
virtual void compile()
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
bool _graphicsThreadDoesCull
Definition Renderer:90
void setDone(bool done)
Definition Renderer:50
void setCompileOnNextDraw(bool flag)
Definition Renderer:66
const osgUtil::SceneView * getSceneView(unsigned int i) const
Definition Renderer:48
virtual void updateSceneView(osgUtil::SceneView *sceneView)
osg::ref_ptr< OpenGLQuerySupport > _querySupport
Definition Renderer:125
virtual void cull()
bool _serializeDraw
Definition Renderer:92
Renderer(osg::Camera *camera)
osgUtil::SceneView * getSceneView(unsigned int i)
Definition Renderer:47
bool getGraphicsThreadDoesCull() const
Definition Renderer:54
osg::observer_ptr< osg::Camera > _camera
Definition Renderer:87
bool getDone()
Definition Renderer:51
osg::Timer_t _startTick
Definition Renderer:126
osg::ref_ptr< osgUtil::SceneView > _sceneView[2]
Definition Renderer:94
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
virtual void draw()
virtual void release()
if this operation is a barrier then release it.
void initialize(osg::State *state)
ThreadSafeQueue _availableQueue
Definition Renderer:121
bool _compileOnNextDraw
Definition Renderer:91
bool getCameraRequiresSetUp() const
virtual void cull_draw()
bool _initialized
Definition Renderer:124
void setGraphicsThreadDoesCull(bool flag)
SceneViewList _queue
Definition Renderer:101
void release()
Release any thread waiting on the queue, even if the queue is empty.
void add(osgUtil::SceneView *sv)
Add a SceneView object to the back of the queue.
std::list< osgUtil::SceneView * > SceneViewList
Definition Renderer:100
void reset()
Reset to fefault state (_isReleased = false)
OpenThreads::Mutex _mutex
Definition Renderer:98
osgUtil::SceneView * takeFront()
Take a SceneView from the queue.
bool _isReleased
Definition Renderer:102
OpenThreads::Condition _cond
Definition Renderer:99
#define OSGVIEWER_EXPORT
Definition Export:40

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.