Debian Codegraph @

3rdparty/osgXR/src/XRFramebuffer.h

raw symbols SCIP
1 // SPDX-License-Identifier: LGPL-2.1-only
2 // Copyright (C) 2021 James Hogan <[email protected]>
3
4 #ifndef OSGXR_XRFRAMEBUFFER
5 #define OSGXR_XRFRAMEBUFFER 1
6
7 #include <osg/GL>
8 #include <osg/Referenced>
9
10 #include <cinttypes>
11
12 namespace osgXR {
13
14 class XRFramebuffer : public osg::Referenced
15 {
16 public:
17
18 explicit XRFramebuffer(uint32_t width, uint32_t height,
19 GLuint texture, GLuint depthTexture = 0);
20 // releaseGLObjects() first
21 virtual ~XRFramebuffer();
22
23 void setDepthFormat(GLenum depthFormat)
24 {
25 _depthFormat = depthFormat;
26 }
27
28 bool valid(osg::State &state) const;
29 void bind(osg::State &state);
30 void unbind(osg::State &state);
31 // GL context must be current
32 void releaseGLObjects(osg::State &state);
33
34 protected:
35
36 uint32_t _width;
37 uint32_t _height;
38 GLenum _depthFormat;
39
40 GLuint _fbo;
41 GLuint _texture;
42 GLuint _depthTexture;
43
44 bool _generated;
45 bool _boundTexture;
46 bool _boundDepthTexture;
47 bool _deleteDepthTexture;
48 };
49
50 } // osgXR
51
52 #endif