root/OpenSceneGraph/trunk/src/osg/GLObjects.cpp @ 13041

Revision 13041, 4.7 kB (checked in by robert, 2 years ago)

Ran script to remove trailing spaces and tabs

  • Property svn:eol-style set to native
Line 
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#include <osg/GLObjects>
14
15#include <osg/Texture>
16#include <osg/VertexProgram>
17#include <osg/FragmentProgram>
18#include <osg/Shader>
19#include <osg/BufferObject>
20#include <osg/FrameBufferObject>
21#include <osg/Drawable>
22#include <osg/OcclusionQueryNode>
23
24void osg::flushDeletedGLObjects(unsigned int contextID, double currentTime, double& availableTime)
25{
26#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
27    osg::Drawable::flushDeletedDisplayLists(contextID,availableTime);
28#endif
29
30#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
31    osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
32    osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
33#endif
34
35    osg::GLBufferObject::flushDeletedBufferObjects(contextID,currentTime,availableTime);
36    osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
37    osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
38    osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
39    osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
40    osg::Texture::flushDeletedTextureObjects(contextID,currentTime,availableTime);
41    osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
42}
43
44void osg::flushAllDeletedGLObjects(unsigned int contextID)
45{
46    double currentTime = DBL_MAX;
47    double availableTime = DBL_MAX;
48
49#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
50    osg::Drawable::flushAllDeletedDisplayLists(contextID);
51#endif
52
53#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
54    osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
55    osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
56#endif
57
58    osg::GLBufferObject::flushAllDeletedBufferObjects(contextID);
59    osg::Texture::flushAllDeletedTextureObjects(contextID);
60
61    osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
62    osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
63    osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
64    osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
65    osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
66}
67
68
69void osg::deleteAllGLObjects(unsigned int contextID)
70{
71    double currentTime = DBL_MAX;
72    double availableTime = DBL_MAX;
73
74#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
75    osg::Drawable::flushAllDeletedDisplayLists(contextID);
76#endif
77
78#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
79    osg::FragmentProgram::flushDeletedFragmentProgramObjects(contextID,currentTime,availableTime);
80    osg::VertexProgram::flushDeletedVertexProgramObjects(contextID,currentTime,availableTime);
81#endif
82
83    osg::GLBufferObject::deleteAllBufferObjects(contextID);
84    osg::Texture::deleteAllTextureObjects(contextID);
85
86    osg::FrameBufferObject::flushDeletedFrameBufferObjects(contextID,currentTime,availableTime);
87    osg::Program::flushDeletedGlPrograms(contextID,currentTime,availableTime);
88    osg::RenderBuffer::flushDeletedRenderBuffers(contextID,currentTime,availableTime);
89    osg::Shader::flushDeletedGlShaders(contextID,currentTime,availableTime);
90    osg::OcclusionQueryNode::flushDeletedQueryObjects(contextID,currentTime,availableTime);
91}
92
93
94void osg::discardAllGLObjects(unsigned int contextID)
95{
96#ifdef OSG_GL_DISPLAYLISTS_AVAILABLE
97    osg::Drawable::discardAllDeletedDisplayLists(contextID);
98#endif
99
100#ifdef OSG_GL_FIXED_FUNCTION_AVAILABLE
101    osg::FragmentProgram::discardDeletedFragmentProgramObjects(contextID);
102    osg::VertexProgram::discardDeletedVertexProgramObjects(contextID);
103#endif
104
105    osg::GLBufferObject::discardAllBufferObjects(contextID);
106    osg::Texture::discardAllTextureObjects(contextID);
107
108    osg::FrameBufferObject::discardDeletedFrameBufferObjects(contextID);
109    osg::Program::discardDeletedGlPrograms(contextID);
110    osg::RenderBuffer::discardDeletedRenderBuffers(contextID);
111    osg::Shader::discardDeletedGlShaders(contextID);
112    osg::OcclusionQueryNode::discardDeletedQueryObjects(contextID);
113}
Note: See TracBrowser for help on using the browser.