Revision 2f35828c
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
54 | 54 |
/// MAIN PROGRAM /// |
55 | 55 |
private static DistortedProgram mMainProgram; |
56 | 56 |
private static int mMainTextureH; |
57 |
private static int mCountIndexH; |
|
58 | 57 |
|
59 | 58 |
/// BLIT PROGRAM /// |
60 | 59 |
private static DistortedProgram mBlitProgram; |
... | ... | |
122 | 121 |
throws FragmentCompilationException,VertexCompilationException,VertexUniformsException,FragmentUniformsException,LinkingException |
123 | 122 |
{ |
124 | 123 |
// MAIN PROGRAM //////////////////////////////////// |
125 |
android.util.Log.e("Effects", "creating main program"); |
|
126 |
|
|
127 | 124 |
final InputStream mainVertStream = resources.openRawResource(R.raw.main_vertex_shader); |
128 | 125 |
final InputStream mainFragStream = resources.openRawResource(R.raw.main_fragment_shader); |
129 | 126 |
|
... | ... | |
158 | 155 |
EffectQueueVertex.getUniforms(mainProgramH); |
159 | 156 |
EffectQueueMatrix.getUniforms(mainProgramH); |
160 | 157 |
mMainTextureH= GLES31.glGetUniformLocation( mainProgramH, "u_Texture"); |
161 |
mCountIndexH = GLES31.glGetUniformLocation( mainProgramH, "u_currentIndex"); |
|
162 | 158 |
|
163 | 159 |
// BLIT PROGRAM //////////////////////////////////// |
164 |
android.util.Log.e("Effects", "creating blit program"); |
|
165 |
|
|
166 | 160 |
final InputStream blitVertStream = resources.openRawResource(R.raw.blit_vertex_shader); |
167 | 161 |
final InputStream blitFragStream = resources.openRawResource(R.raw.blit_fragment_shader); |
168 | 162 |
|
... | ... | |
184 | 178 |
mBlitDepthH = GLES31.glGetUniformLocation( blitProgramH, "u_Depth"); |
185 | 179 |
|
186 | 180 |
// BLIT DEPTH PROGRAM //////////////////////////////////// |
187 |
android.util.Log.e("Effects", "creating blit depth program"); |
|
188 |
|
|
189 | 181 |
final InputStream blitDepthVertStream = resources.openRawResource(R.raw.blit_depth_vertex_shader); |
190 | 182 |
final InputStream blitDepthFragStream = resources.openRawResource(R.raw.blit_depth_fragment_shader); |
191 | 183 |
|
... | ... | |
231 | 223 |
} |
232 | 224 |
|
233 | 225 |
// BLIT DEPTH RENDER PROGRAM /////////////////////////// |
234 |
android.util.Log.e("Effects", "creating blit depth render program"); |
|
235 |
|
|
236 | 226 |
final InputStream blitDepthRenderVertStream = resources.openRawResource(R.raw.blit_depth_vertex_shader); |
237 | 227 |
final InputStream blitDepthRenderFragStream = resources.openRawResource(R.raw.blit_depth_render_fragment_shader); |
238 | 228 |
|
... | ... | |
253 | 243 |
mBlitDepthRenderSizeH = GLES31.glGetUniformLocation( blitDepthRenderProgramH, "u_Size"); |
254 | 244 |
|
255 | 245 |
// NORMAL PROGRAM ////////////////////////////////////// |
256 |
android.util.Log.e("Effects", "creating normal program"); |
|
257 |
|
|
258 | 246 |
final InputStream normalVertexStream = resources.openRawResource(R.raw.normal_vertex_shader); |
259 | 247 |
final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader); |
260 | 248 |
|
... | ... | |
374 | 362 |
|
375 | 363 |
mMainProgram.useProgram(); |
376 | 364 |
GLES31.glUniform1i(mMainTextureH, 0); |
377 |
GLES31.glUniform1i(mCountIndexH, surface.getNewCounter() ); |
|
378 | 365 |
|
379 | 366 |
GLES31.glBindBuffer(GLES31.GL_ARRAY_BUFFER, mesh.mAttVBO[0]); |
380 | 367 |
GLES31.glVertexAttribPointer(mMainProgram.mAttribute[0], MeshObject.POS_DATA_SIZE, GLES31.GL_FLOAT, false, MeshObject.VERTSIZE, MeshObject.OFFSET0); |
... | ... | |
423 | 410 |
GLES31.glUniform1f(mBlitDepthDepthH , 1.0f-surface.mNear); |
424 | 411 |
GLES31.glVertexAttribPointer(mBlitDepthProgram.mAttribute[0], 2, GLES31.GL_FLOAT, false, 0, mQuadPositions); |
425 | 412 |
GLES31.glDrawArrays(GLES31.GL_TRIANGLE_STRIP, 0, 4); |
426 |
|
|
427 |
|
|
428 |
//android.util.Log.e("effects", "width="+surface.mWidth+" height="+surface.mHeight+ |
|
429 |
// " bufferSize: "+mBufferSize+" numRecords: "+((mBufferSize-surface.mWidth*surface.mHeight)/3) ); |
|
430 | 413 |
} |
431 | 414 |
|
432 | 415 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
- remove counting of transparent pixels from main fragment shader
- remove debugs and tidy up
- some fixes for the Mali GPU