Revision 6b962e80
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/DistortedOutputSurface.java | ||
---|---|---|
157 | 157 |
|
158 | 158 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
159 | 159 |
|
160 |
void createBuffers() |
|
160 |
private void createBuffers()
|
|
161 | 161 |
{ |
162 | 162 |
float mipmap=1.0f; |
163 | 163 |
|
... | ... | |
187 | 187 |
} |
188 | 188 |
} |
189 | 189 |
|
190 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
191 |
|
|
192 |
private int blitWithDepth(int quality, long currTime) |
|
193 |
{ |
|
194 |
DistortedFramebuffer buffer = mBuffer[quality]; |
|
195 |
|
|
196 |
GLES30.glViewport(0, 0, mWidth, mHeight); |
|
197 |
setAsOutput(currTime); |
|
198 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE0); |
|
199 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, buffer.mColorH[0]); |
|
200 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE1); |
|
201 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, buffer.mDepthStencilH[0]); |
|
202 |
|
|
203 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST); |
|
204 |
GLES30.glStencilMask(0x00); |
|
205 |
|
|
206 |
DistortedEffects.blitDepthPriv(this); |
|
207 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE0); |
|
208 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); |
|
209 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE1); |
|
210 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); |
|
211 |
|
|
212 |
// clear buffers |
|
213 |
GLES30.glStencilMask(0xff); |
|
214 |
GLES30.glDepthMask(true); |
|
215 |
GLES30.glColorMask(true,true,true,true); |
|
216 |
GLES30.glClearColor(0.0f,0.0f,0.0f,0.0f); |
|
217 |
GLES30.glClearDepthf(1.0f); |
|
218 |
GLES30.glClearStencil(0); |
|
219 |
|
|
220 |
buffer.setAsOutput(); |
|
221 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, buffer.mColorH[1], 0); |
|
222 |
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT|GLES30.GL_DEPTH_BUFFER_BIT|GLES30.GL_STENCIL_BUFFER_BIT); |
|
223 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, buffer.mColorH[0], 0); |
|
224 |
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT); |
|
225 |
|
|
226 |
return 1; |
|
227 |
} |
|
228 |
|
|
190 | 229 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
191 | 230 |
// Render all children, one by one. If there are no postprocessing effects, just render to THIS. |
192 | 231 |
// Otherwise, render to a buffer and on each change of Postprocessing Bucket, apply the postprocessing |
... | ... | |
233 | 272 |
return numRenders; |
234 | 273 |
} |
235 | 274 |
|
236 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
237 |
|
|
238 |
int blitWithDepth(int quality, long currTime) |
|
239 |
{ |
|
240 |
DistortedFramebuffer buffer = mBuffer[quality]; |
|
241 |
|
|
242 |
GLES30.glViewport(0, 0, mWidth, mHeight); |
|
243 |
setAsOutput(currTime); |
|
244 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE0); |
|
245 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, buffer.mColorH[0]); |
|
246 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE1); |
|
247 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, buffer.mDepthStencilH[0]); |
|
248 |
|
|
249 |
GLES30.glDisable(GLES30.GL_STENCIL_TEST); |
|
250 |
GLES30.glStencilMask(0x00); |
|
251 |
|
|
252 |
DistortedEffects.blitDepthPriv(this); |
|
253 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE0); |
|
254 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); |
|
255 |
GLES30.glActiveTexture(GLES30.GL_TEXTURE1); |
|
256 |
GLES30.glBindTexture(GLES30.GL_TEXTURE_2D, 0); |
|
257 |
|
|
258 |
// clear buffers |
|
259 |
GLES30.glStencilMask(0xff); |
|
260 |
GLES30.glDepthMask(true); |
|
261 |
GLES30.glColorMask(true,true,true,true); |
|
262 |
GLES30.glClearColor(0.0f,0.0f,0.0f,0.0f); |
|
263 |
GLES30.glClearDepthf(1.0f); |
|
264 |
GLES30.glClearStencil(0); |
|
265 |
|
|
266 |
buffer.setAsOutput(); |
|
267 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, buffer.mColorH[1], 0); |
|
268 |
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT|GLES30.GL_DEPTH_BUFFER_BIT|GLES30.GL_STENCIL_BUFFER_BIT); |
|
269 |
GLES30.glFramebufferTexture2D(GLES30.GL_FRAMEBUFFER, GLES30.GL_COLOR_ATTACHMENT0, GLES30.GL_TEXTURE_2D, buffer.mColorH[0], 0); |
|
270 |
GLES30.glClear(GLES30.GL_COLOR_BUFFER_BIT); |
|
271 |
|
|
272 |
return 1; |
|
273 |
} |
|
274 |
|
|
275 | 275 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
276 | 276 |
|
277 | 277 |
void newJob(int t, DistortedNode n, DistortedEffectsPostprocess d) |
Also available in: Unified diff
Minor.