aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llrender/llrendertarget.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llrender/llrendertarget.h
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llrender/llrendertarget.h')
-rw-r--r--linden/indra/llrender/llrendertarget.h27
1 files changed, 22 insertions, 5 deletions
diff --git a/linden/indra/llrender/llrendertarget.h b/linden/indra/llrender/llrendertarget.h
index cc36146..918a604 100644
--- a/linden/indra/llrender/llrendertarget.h
+++ b/linden/indra/llrender/llrendertarget.h
@@ -37,7 +37,7 @@
37/* 37/*
38 SAMPLE USAGE: 38 SAMPLE USAGE:
39 39
40 LLFBOTarget target; 40 LLRenderTarget target;
41 41
42 ... 42 ...
43 43
@@ -46,7 +46,7 @@
46 46
47 //render to contents of offscreen buffer 47 //render to contents of offscreen buffer
48 target.bindTarget(); 48 target.bindTarget();
49 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 49 target.clear();
50 ... <issue drawing commands> ... 50 ... <issue drawing commands> ...
51 target.flush(); 51 target.flush();
52 52
@@ -71,7 +71,10 @@ public:
71 //allocate resources for rendering 71 //allocate resources for rendering
72 //must be called before use 72 //must be called before use
73 //multiple calls will release previously allocated resources 73 //multiple calls will release previously allocated resources
74 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, U32 usage = GL_TEXTURE_2D, BOOL force_fbo = FALSE); 74 void allocate(U32 resx, U32 resy, U32 color_fmt, BOOL depth, U32 usage = GL_TEXTURE_2D, BOOL use_fbo = TRUE);
75
76 //allocate a depth texture
77 void allocateDepth();
75 78
76 //free any allocated resources 79 //free any allocated resources
77 //safe to call redundantly 80 //safe to call redundantly
@@ -80,7 +83,7 @@ public:
80 //bind target for rendering 83 //bind target for rendering
81 //applies appropriate viewport 84 //applies appropriate viewport
82 void bindTarget(); 85 void bindTarget();
83 86
84 //clear render targer, clears depth buffer if present, 87 //clear render targer, clears depth buffer if present,
85 //uses scissor rect if in copy-to-texture mode 88 //uses scissor rect if in copy-to-texture mode
86 void clear(); 89 void clear();
@@ -88,14 +91,25 @@ public:
88 //get applied viewport 91 //get applied viewport
89 void getViewport(S32* viewport); 92 void getViewport(S32* viewport);
90 93
94 //get X resolution
95 U32 getWidth() const { return mResX; }
96
97 //get Y resolution
98 U32 getHeight() const { return mResY; }
99
91 //bind results of render for sampling 100 //bind results of render for sampling
92 void bindTexture(); 101 void bindTexture();
93 102
103 //bind results of render for sampling depth buffer
104 void bindDepth();
105
94 //flush rendering operations 106 //flush rendering operations
95 //must be called when rendering is complete 107 //must be called when rendering is complete
96 //should be used 1:1 with bindTarget 108 //should be used 1:1 with bindTarget
97 // call bindTarget once, do all your rendering, call flush once 109 // call bindTarget once, do all your rendering, call flush once
98 void flush(); 110 // if fetch_depth is TRUE, every effort will be made to copy the depth buffer into
111 // the current depth texture. A depth texture will be allocated if needed.
112 void flush(BOOL fetch_depth = FALSE);
99 113
100 //Returns TRUE if target is ready to be rendered into. 114 //Returns TRUE if target is ready to be rendered into.
101 //That is, if the target has been allocated with at least 115 //That is, if the target has been allocated with at least
@@ -108,8 +122,11 @@ private:
108 U32 mTex; 122 U32 mTex;
109 U32 mFBO; 123 U32 mFBO;
110 U32 mDepth; 124 U32 mDepth;
125 U32 mStencil;
111 BOOL mUseDepth; 126 BOOL mUseDepth;
127 BOOL mRenderDepth;
112 U32 mUsage; 128 U32 mUsage;
129
113}; 130};
114 131
115#endif 132#endif