VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtGlRenderToTexture.h
Go to the documentation of this file.
1 /******************************************************************************
2 ** Copyright (c) 2020 MAK Technologies, Inc.
3 ** All rights reserved.
4 ******************************************************************************/
5 #pragma once
6 
10 
11 
16 
17 #include <vector>
18 #include <string>
19 
20 #define DTGLRENDERTEXTURE_FBO_DEBUG 0
21 
22 #if DTGLRENDERTEXTURE_FBO_DEBUG
23 #include <tbb/atomic.h>
24 #endif
25 
26 namespace makVrv
27 {
28  class DtGlTexture;
29 
32  {
33  private:
36 
39 
41  DtGlRenderTexture& operator=(const DtGlRenderTexture&);
42 
43  public:
46  DtGlRenderTexture(const std::string& name, int width, int height, int samples = 0, int layers = 1, bool useMultiView = false);
47 
49  virtual ~DtGlRenderTexture();
50 
52  virtual bool init(DtGlImageType colorFormat = RGB32F, GLenum minFilter = GL_LINEAR, GLenum wrapMode = GL_CLAMP_TO_EDGE);
53 
57  virtual bool init(unsigned int glColorTexId);
58 
60  virtual bool initDepth(DtGlImageType depthFormat = D32);
61 
64  virtual bool initDepth(unsigned int glDepthTexId);
65 
67  virtual void activateForDrawingInto(bool shouldClear = true, bool setViewport = true);
68 
71  virtual void copyFromFramebuffer(unsigned int srcFbo, unsigned int bufferBits);
72 
74  // isArray indicates the srcTexture is a Tex 2D array and srclayer is the layer of the array to copy from.
75  virtual void copyFromTexture(unsigned int srcTexture, bool isDepth, bool isArray = false, unsigned int srclayer = 0, unsigned int layerCount = 1);
76 
78  virtual void deactivateForDrawingInto();
79 
81  virtual void bindColorTexture(int unit);
82 
84  virtual void bindDepthTexture(int unit);
85 
87  virtual void unbindColorTexture(int unit);
88 
90  virtual void unbindDepthTexture(int unit);
91 
93  virtual int width() const;
94 
96  virtual int height() const;
97 
99  virtual int layers() const;
100 
102  virtual unsigned int colorId() const;
103 
105  virtual unsigned int depthId() const;
106 
108  virtual int numSamples() const;
109 
111  virtual bool useMultiView() const;
112 
114  virtual bool usingStencil() const;
115 
116  virtual void setDeleteFbosOnDestruction(bool val);
117  virtual bool deleteFbosOnDestruction(void) const;
118 
119  virtual unsigned int fbo(void) const;
120  virtual unsigned int multiSampleFbo(void) const;
121 
122  protected:
123  unsigned int myFboId;
124  unsigned int myMultisampleFboId;
127 
129 
130  virtual void initFBO(const std::string& name);
131 
132  virtual GLenum getGLInternalTypes(DtGlImageType colorType);
133 
134  int myWidth;
135  int myHeight;
136  int myLayers;
137 
141 
143 
145 
146  std::string myName;
147 
149 
150 #if DTGLRENDERTEXTURE_FBO_DEBUG
151  static tbb::atomic<int> theFBOCount;
152 #endif
153  };
154 
155 }
156 
DtGlTexture * myDepthTexture
Definition: DtGlRenderToTexture.h:144
bool myIsFrameBufferValid
Definition: DtGlRenderToTexture.h:139
Dll export defines.
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlRenderToTexture.h:31
int myLayers
Definition: DtGlRenderToTexture.h:136
std::string myName
Definition: DtGlRenderToTexture.h:146
Definition: DtGlImageType.h:28
unsigned int myMultisampleFboId
Definition: DtGlRenderToTexture.h:124
unsigned int myMultisampleColorBuffer
Definition: DtGlRenderToTexture.h:125
bool myHasDepth
Definition: DtGlRenderToTexture.h:138
bool myDeleteFbosOnDestruction
Definition: DtGlRenderToTexture.h:128
A helper classes for creating and managing OpenGL Shader programs.
unsigned int myFboId
Definition: DtGlRenderToTexture.h:123
DtGlImageType
Definition: DtGlImageType.h:15
Definition: DtGlImageType.h:20
DtGlTexture * myColorTexture
Definition: DtGlRenderToTexture.h:142
unsigned int GLenum
Definition: DtGlTextureBufferObject.h:18
Enumerations for various types of texture/buffer formats.
DT_DLL_DEBUGDRAWRENDERER void init(makVrv::DtDe &de)
Work function for the plugin initialization.
bool myUseMultiView
Definition: DtGlRenderToTexture.h:140
#define DT_DLL_VRVGRAPHICSUTILS
Definition: vrvGraphicsUtils.h:18
int myNumSamples
Definition: DtGlRenderToTexture.h:148
int myWidth
Definition: DtGlRenderToTexture.h:134
enum representing an OpenGL image type
A helper classes for creating a RTT target, optionally including depth buffer.
Definition: DtGlTexture.h:20
unsigned int myMultisampleDepthBuffer
Definition: DtGlRenderToTexture.h:126
int myHeight
Definition: DtGlRenderToTexture.h:135

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)