Revision ae2802b1
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
73 | 73 |
private static int mBlitDepthTextureH; |
74 | 74 |
private static int mBlitDepthDepthTextureH; |
75 | 75 |
private static int mBlitDepthDepthH; |
76 |
private static int mBlitDepthTexCorrH; |
|
76 | 77 |
|
77 | 78 |
/// NORMAL PROGRAM ///// |
78 | 79 |
private static DistortedProgram mNormalProgram; |
... | ... | |
162 | 163 |
mBlitDepthTextureH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Texture"); |
163 | 164 |
mBlitDepthDepthTextureH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_DepthTexture"); |
164 | 165 |
mBlitDepthDepthH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Depth"); |
166 |
mBlitDepthTexCorrH = GLES31.glGetUniformLocation( blitDepthProgramH, "u_TexCorr"); |
|
165 | 167 |
|
166 | 168 |
// NORMAL PROGRAM ////////////////////////////////////// |
167 | 169 |
final InputStream normalVertexStream = resources.openRawResource(R.raw.normal_vertex_shader); |
... | ... | |
331 | 333 |
|
332 | 334 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
333 | 335 |
|
334 |
static void blitDepthPriv(DistortedOutputSurface surface) |
|
336 |
static void blitDepthPriv(DistortedOutputSurface surface, float corrW, float corrH)
|
|
335 | 337 |
{ |
336 | 338 |
mBlitDepthProgram.useProgram(); |
337 | 339 |
|
338 | 340 |
GLES31.glViewport(0, 0, surface.mWidth, surface.mHeight ); |
339 | 341 |
GLES31.glUniform1i(mBlitDepthTextureH, 0); |
340 | 342 |
GLES31.glUniform1i(mBlitDepthDepthTextureH, 1); |
343 |
GLES31.glUniform2f(mBlitDepthTexCorrH, corrW, corrH ); |
|
341 | 344 |
GLES31.glUniform1f( mBlitDepthDepthH , 1.0f-surface.mNear); |
342 | 345 |
GLES31.glVertexAttribPointer(mBlitDepthProgram.mAttribute[0], 2, GLES31.GL_FLOAT, false, 0, mQuadPositions); |
343 | 346 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
Also available in: Unified diff
Postprocessing buffers mBuffer[] are now shared among all postprocessing operations. This saves a lot of memory, but also means that when doing each particular postprocessing, the textures backing up the mBuffer might be too large. We need to fix two things here: when outputting to those too large textures, we need to adjust the Viewport, and when binding those too large textures as input - we need to adjust the TexCoords to compensate.
This commit does just that. Verified as working by the 'PostprocessTree' app.