openscenegraph
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;
126
127};
128
129
130}
131
132#endif
This class provides an object-oriented thread mutex interface.
Definition Mutex:31
Definition FrameStamp:35
Definition GLObjects:99
OpenThreads::Mutex _mutex
Definition GLObjects:124
virtual void discardAllGLObjects()
std::list< GLuint > GLObjectHandleList
Definition GLObjects:123
GLObjectManager(const std::string &name, unsigned int contextID)
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)
virtual void deleteGLObject(GLuint globj)=0
GLObjectHandleList _deleteGLObjectHandles
Definition GLObjects:125
virtual void deleteAllGLObjects()
virtual void flushAllDeletedGLObjects()
virtual GLuint createGLObject()
virtual void scheduleGLObjectForDeletion(GLuint globj)
virtual ~GLObjectManager()
Definition GLObjects:57
virtual void recomputeStats(std::ostream &) const
Definition GLObjects:68
virtual void newFrame(osg::FrameStamp *)
Definition GLObjects:64
unsigned int getContextID() const
Definition GLObjects:61
virtual void flushAllDeletedGLObjects()=0
virtual void flushDeletedGLObjects(double currentTime, double &availableTime)=0
virtual void reportStats(std::ostream &)
Definition GLObjects:67
unsigned int _contextID
Definition GLObjects:94
virtual void deleteAllGLObjects()=0
virtual void discardAllGLObjects()=0
GraphicsObjectManager(const std::string &name, unsigned int contextID)
virtual void resetStats()
Definition GLObjects:66
std::string _name
Definition GLObjects:93
Definition GLObjects:47
virtual ~GraphicsObject()
Definition Referenced:44
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
OSG_EXPORT void flushDeletedGLObjects(unsigned int contextID, double currentTime, double &availableTime)
OSG_EXPORT void flushAllDeletedGLObjects(unsigned int contextID)
OSG_EXPORT void discardAllGLObjects(unsigned int contextID)
OSG_EXPORT void deleteAllGLObjects(unsigned int contextID)
#define OSG_EXPORT
Definition osg/Export:39