Project

General

Profile

« Previous | Next » 

Revision c25273e0

Added by Leszek Koltunski almost 6 years ago

Standarize GLSL version across the whole library.

View differences:

src/main/java/org/distorted/library/main/DistortedEffects.java
130 130

  
131 131
///////////////////////////////////////////////////////////////////////////////////////////////////
132 132

  
133
  static void createProgram(Resources resources)
133
  static void createPrograms(Resources resources)
134 134
    {
135 135
    // MAIN PROGRAM ////////////////////////////////////
136 136
    final InputStream mainVertStream = resources.openRawResource(R.raw.main_vertex_shader);
......
206 206
    mBlitDepthDepthH        = GLES31.glGetUniformLocation( blitDepthProgramH, "u_Depth");
207 207
    mBlitDepthTexCorrH      = GLES31.glGetUniformLocation( blitDepthProgramH, "u_TexCorr");
208 208

  
209
    // NORMAL PROGRAM //////////////////////////////////////
210
    final InputStream normalVertexStream   = resources.openRawResource(R.raw.normal_vertex_shader);
211
    final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader);
212

  
213
    try
214
      {
215
      mNormalProgram = new DistortedProgram(normalVertexStream,normalFragmentStream, Distorted.GLSL_VERSION, Distorted.GLSL_VERSION, Distorted.GLSL);
216
      }
217
    catch(Exception e)
218
      {
219
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
220
      throw new RuntimeException(e.getMessage());
221
      }
222

  
223
    int normalProgramH = mNormalProgram.getProgramHandle();
224
    mNormalMVPMatrixH  = GLES31.glGetUniformLocation( normalProgramH, "u_MVPMatrix");
225
    }
226

  
227
  ///////////////////////////////////////////////////////////////////////////////////////////////////
228

  
229
  static void createProgramsOIT(Resources resources)
230
    {
209 231
    // OIT CLEAR PROGRAM ////////////////////////////////////
210 232
    final InputStream oitClearVertStream = resources.openRawResource(R.raw.oit_vertex_shader);
211 233
    final InputStream oitClearFragStream = resources.openRawResource(R.raw.oit_clear_fragment_shader);
......
303 325
    mOITRenderDepthH        = GLES31.glGetUniformLocation( oitRenderProgramH, "u_Depth");
304 326
    mOITRenderTexCorrH      = GLES31.glGetUniformLocation( oitRenderProgramH, "u_TexCorr");
305 327
    mOITRenderSizeH         = GLES31.glGetUniformLocation( oitRenderProgramH, "u_Size");
306

  
307
    // NORMAL PROGRAM //////////////////////////////////////
308
    final InputStream normalVertexStream   = resources.openRawResource(R.raw.normal_vertex_shader);
309
    final InputStream normalFragmentStream = resources.openRawResource(R.raw.normal_fragment_shader);
310

  
311
    try
312
      {
313
      mNormalProgram = new DistortedProgram(normalVertexStream,normalFragmentStream, Distorted.GLSL_VERSION, Distorted.GLSL_VERSION, Distorted.GLSL);
314
      }
315
    catch(Exception e)
316
      {
317
      Log.e("EFFECTS", e.getClass().getSimpleName()+" trying to compile NORMAL program: "+e.getMessage());
318
      throw new RuntimeException(e.getMessage());
319
      }
320

  
321
    int normalProgramH = mNormalProgram.getProgramHandle();
322
    mNormalMVPMatrixH  = GLES31.glGetUniformLocation( normalProgramH, "u_MVPMatrix");
323 328
    }
324 329

  
325 330
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff