Revision c2c08950
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/library/DistortedEffects.java | ||
---|---|---|
72 | 72 |
/// BLIT PROGRAM /// |
73 | 73 |
private static DistortedProgram mBlitProgram; |
74 | 74 |
private static int mBlitTextureH; |
75 |
private static int mBlitObjDH; |
|
76 |
private static int mBlitMVPMatrixH; |
|
75 |
private static int mBlitDepthH; |
|
77 | 76 |
private static final FloatBuffer mQuadPositions; |
78 | 77 |
|
79 | 78 |
static |
... | ... | |
166 | 165 |
|
167 | 166 |
int blitProgramH = mBlitProgram.getProgramHandle(); |
168 | 167 |
mBlitTextureH = GLES30.glGetUniformLocation( blitProgramH, "u_Texture"); |
169 |
mBlitObjDH = GLES30.glGetUniformLocation( blitProgramH, "u_objD"); |
|
170 |
mBlitMVPMatrixH= GLES30.glGetUniformLocation( blitProgramH, "u_MVPMatrix"); |
|
168 |
mBlitDepthH = GLES30.glGetUniformLocation( blitProgramH, "u_Depth"); |
|
171 | 169 |
|
172 | 170 |
// DEBUG ONLY ////////////////////////////////////// |
173 | 171 |
final InputStream debugVertexStream = resources.openRawResource(R.raw.test_vertex_shader); |
... | ... | |
349 | 347 |
|
350 | 348 |
static void blitPriv(DistortedOutputSurface projection) |
351 | 349 |
{ |
352 |
GLES30.glViewport(0, 0, projection.mWidth, projection.mHeight); |
|
353 |
|
|
354 | 350 |
mBlitProgram.useProgram(); |
355 | 351 |
|
356 |
Matrix.setIdentityM(mTmpMatrix, 0); |
|
357 |
Matrix.translateM(mTmpMatrix, 0, 0, 0, -projection.mDistance); |
|
358 |
Matrix.multiplyMM(mMVPMatrix, 0, projection.mProjectionMatrix, 0, mTmpMatrix, 0); |
|
359 |
|
|
352 |
GLES30.glViewport(0, 0, projection.mWidth, projection.mHeight); |
|
360 | 353 |
GLES30.glUniform1i(mBlitTextureH, 0); |
361 |
GLES30.glUniform2f( mBlitObjDH , projection.mWidth/2, projection.mHeight/2); |
|
362 |
GLES30.glUniformMatrix4fv(mBlitMVPMatrixH, 1, false, mMVPMatrix, 0); |
|
354 |
GLES30.glUniform1f( mBlitDepthH , 1.0f-projection.mNear); |
|
363 | 355 |
GLES30.glVertexAttribPointer(mBlitProgram.mAttribute[0], 2, GLES30.GL_FLOAT, false, 0, mQuadPositions); |
364 | 356 |
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4); |
365 | 357 |
} |
Also available in: Unified diff
simplify blitPriv()