49 |
49 |
private static final int NUM_CACHE = 0;
|
50 |
50 |
private static final int INDEX = EffectTypes.POSTPROCESS.ordinal();
|
51 |
51 |
|
52 |
|
private static final FloatBuffer mQuadPositions, mQuadTextureNor, mQuadTextureInv;
|
|
52 |
private static final FloatBuffer mQuadPositions, mQuadTexture;
|
53 |
53 |
|
54 |
54 |
static
|
55 |
55 |
{
|
... | ... | |
58 |
58 |
|
59 |
59 |
float[] position = { -0.5f, -0.5f, -0.5f, 0.5f, 0.5f,-0.5f, 0.5f, 0.5f };
|
60 |
60 |
float[] textureNor= { 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f };
|
61 |
|
float[] textureInv= { 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f };
|
62 |
61 |
|
63 |
62 |
mQuadPositions = ByteBuffer.allocateDirect(POS_DATA_SIZE*dataLength*bytes_per_float).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
64 |
63 |
mQuadPositions.put(position).position(0);
|
65 |
|
mQuadTextureNor= ByteBuffer.allocateDirect(TEX_DATA_SIZE*dataLength*bytes_per_float).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
66 |
|
mQuadTextureNor.put(textureNor).position(0);
|
67 |
|
mQuadTextureInv= ByteBuffer.allocateDirect(TEX_DATA_SIZE*dataLength*bytes_per_float).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
68 |
|
mQuadTextureInv.put(textureInv).position(0);
|
|
64 |
mQuadTexture= ByteBuffer.allocateDirect(TEX_DATA_SIZE*dataLength*bytes_per_float).order(ByteOrder.nativeOrder()).asFloatBuffer();
|
|
65 |
mQuadTexture.put(textureNor).position(0);
|
69 |
66 |
}
|
70 |
67 |
|
71 |
68 |
private static DistortedFramebuffer mPostBuffer = new DistortedFramebuffer(true,DistortedSurface.TYPE_SYST,1,1);
|
... | ... | |
288 |
285 |
for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]/h;
|
289 |
286 |
GLES30.glUniform1fv( mOffsets1H ,radius+1, mOffsets,0);
|
290 |
287 |
GLES30.glVertexAttribPointer(mBlur1Program.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadPositions);
|
291 |
|
GLES30.glVertexAttribPointer(mBlur1Program.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTextureInv);
|
|
288 |
GLES30.glVertexAttribPointer(mBlur1Program.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTexture);
|
292 |
289 |
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
|
293 |
290 |
|
294 |
291 |
// vertical blur
|
... | ... | |
305 |
302 |
for(int i=0; i<=radius; i++) mOffsets[i] = offsetsCache[offset+i]/w;
|
306 |
303 |
GLES30.glUniform1fv( mOffsets2H ,radius+1, mOffsets,0);
|
307 |
304 |
GLES30.glVertexAttribPointer(mBlur2Program.mAttribute[0], POS_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadPositions);
|
308 |
|
GLES30.glVertexAttribPointer(mBlur2Program.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTextureInv);
|
|
305 |
GLES30.glVertexAttribPointer(mBlur2Program.mAttribute[1], TEX_DATA_SIZE, GLES30.GL_FLOAT, false, 0, mQuadTexture);
|
309 |
306 |
GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, 4);
|
310 |
307 |
}
|
311 |
308 |
|
Merging blurred surfaces mostly ok now (blurred image still appears a bit shifted down for some reason)