OpenSceneGraph 3.6.5
GLObjects
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_GLOBJECTS
15#define OSG_GLOBJECTS 1
16
17#include <osg/Referenced>
18#include <osg/GL>
19#include <list>
20#include <string>
21
22namespace osg {
23
24// forward declare
25class FrameStamp;
26
29extern OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime);
30
33extern OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID);
34
37extern OSG_EXPORT void deleteAllGLObjects(unsigned int contextID);
38
44extern OSG_EXPORT void discardAllGLObjects(unsigned int contextID);
45
47{
48 public:
50
51 protected:
52 virtual ~GraphicsObject();
53};
54
55
57{
58 public:
59 GraphicsObjectManager(const std::string& name, unsigned int contextID);
60
61 unsigned int getContextID() const { return _contextID; }
62
64 virtual void newFrame(osg::FrameStamp* /*fs*/) {}
65
66 virtual void resetStats() {}
67 virtual void reportStats(std::ostream& /*out*/) {}
68 virtual void recomputeStats(std::ostream& /*out*/) const {}
69
70
73 virtual void flushDeletedGLObjects(double currentTime, double& availableTime) = 0;
74
77 virtual void flushAllDeletedGLObjects() = 0;
78
81 virtual void deleteAllGLObjects() = 0;
82
88 virtual void discardAllGLObjects() = 0;
89
90 protected:
92
93 std::string _name;
94 unsigned int _contextID;
95
96};
97
99{
100public:
101 GLObjectManager(const std::string& name, unsigned int contextID);
102
103 virtual void flushDeletedGLObjects(double currentTime, double& availableTime);
104
106
107 virtual void deleteAllGLObjects();
108
109 virtual void discardAllGLObjects();
110
112 virtual void scheduleGLObjectForDeletion(GLuint globj);
113
115 virtual GLuint createGLObject();
116
118 virtual void deleteGLObject(GLuint globj) = 0;
119
120protected:
122
123 typedef std::list<GLuint> GLObjectHandleList;
124 OpenThreads::Mutex _mutex;
126
127};
128
129
130}
131
132#endif
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double &availableTime)
Flush all deleted OpenGL objects within the specified availableTime.
OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID)
Flush all deleted OpenGL objects.
OSG_EXPORT void discardAllGLObjects(unsigned int contextID)
Discard all OpenGL objects.
OSG_EXPORT void deleteAllGLObjects(unsigned int contextID)
Do a GL delete all OpenGL objects.
Class which encapsulates the frame number, reference time and calendar time of specific frame,...
Definition FrameStamp:35
virtual ~GraphicsObject()
virtual void recomputeStats(std::ostream &) const
Definition GLObjects:68
virtual void newFrame(osg::FrameStamp *)
Signal that a new frame has started.
Definition GLObjects:64
unsigned int getContextID() const
Definition GLObjects:61
virtual void flushAllDeletedGLObjects()=0
Flush all deleted OpenGL objects.
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)=0
Flush all deleted OpenGL objects within the specified availableTime.
virtual void reportStats(std::ostream &)
Definition GLObjects:67
unsigned int _contextID
Definition GLObjects:94
virtual void deleteAllGLObjects()=0
Do a GL delete all OpenGL objects.
virtual void discardAllGLObjects()=0
Discard all OpenGL objects.
GraphicsObjectManager(const std::string &name, unsigned int contextID)
virtual void resetStats()
Definition GLObjects:66
std::string _name
Definition GLObjects:93
OpenThreads::Mutex _mutex
Definition GLObjects:124
virtual void discardAllGLObjects()
Discard all OpenGL objects.
std::list< GLuint > GLObjectHandleList
Definition GLObjects:123
GLObjectManager(const std::string &name, unsigned int contextID)
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)
Flush all deleted OpenGL objects within the specified availableTime.
virtual void deleteGLObject(GLuint globj)=0
implementation of the actual deletion of an GL object - subclasses from GLObjectManager must implemen...
GLObjectHandleList _deleteGLObjectHandles
Definition GLObjects:125
virtual void deleteAllGLObjects()
Do a GL delete all OpenGL objects.
virtual void flushAllDeletedGLObjects()
Flush all deleted OpenGL objects.
virtual GLuint createGLObject()
implementation of the actual creation of an GL object - subclasses from GLObjectManager must implemen...
virtual void scheduleGLObjectForDeletion(GLuint globj)
schedule a GL object for deletion by the graphics thread.
virtual ~GLObjectManager()
Base class for providing reference counted objects.
Definition Referenced:44
#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.