Project

General

Profile

« Previous | Next » 

Revision 78ff6ea9

Added by Leszek Koltunski over 3 years ago

Convert the Integer part (i.e. effect names and the two associations) of vertex and fragment shaders to Uniform Buffer Objects.
Next: convert the last part, i.e. the float effect parameters.

View differences:

src/main/java/org/distorted/library/main/DistortedLibrary.java
116 116
  private static int mGLSL;
117 117
  private static String mGLSL_VERSION;
118 118
  private static boolean mOITCompilationAttempted;
119
  private static int mMaxTextureSize = Integer.MAX_VALUE;
119

  
120
  private static int mMaxTextureSize         = Integer.MAX_VALUE;
121
  private static int mMaxNumberOfVerUniforms = Integer.MAX_VALUE;
122
  private static int mMaxNumberOfFraUniforms = Integer.MAX_VALUE;
120 123

  
121 124
  //////////////////////////////////////////////////////////////////////////////////////////////
122 125
  /// MAIN PROGRAM ///
......
547 550
    mFullProgram.useProgram();
548 551
    mesh.bindVertexAttribs(mFullProgram);
549 552
    queue.compute(1);
550
    queue.send(0.0f,3);
553
    queue.send(0.0f,mFullProgramH,3);
551 554
    mesh.send(mFullProgramH,3);
552 555

  
553 556
    GLES30.glBindBufferBase(GLES30.GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfo );
......
583 586
      float mipmap      = surface.mMipmap;
584 587
      float[] projection= surface.mProjectionMatrix;
585 588

  
586
      EffectQueue.send(queues, distance, mipmap, projection, inflate, 1 );
589
      EffectQueue.send(queues, mMainOITProgramH, distance, mipmap, projection, inflate, 1 );
587 590
      GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
588 591

  
589 592
      if( mesh.getShowNormals() )
590 593
        {
591 594
        mMainProgram.useProgram();
592 595
        mesh.send(mMainProgramH,0);
593
        EffectQueue.send(queues, distance, mipmap, projection, inflate, 0 );
596
        EffectQueue.send(queues, mMainProgramH, distance, mipmap, projection, inflate, 0 );
594 597
        displayNormals(projection,mesh);
595 598
        }
596 599
      }
......
617 620
      float mipmap      = surface.mMipmap;
618 621
      float[] projection= surface.mProjectionMatrix;
619 622

  
620
      EffectQueue.send(queues, distance, mipmap, projection, inflate, 0 );
623
      EffectQueue.send(queues, mMainProgramH, distance, mipmap, projection, inflate, 0 );
621 624
      GLES30.glDrawArrays(GLES30.GL_TRIANGLE_STRIP, 0, mesh.getNumVertices() );
622 625

  
623 626
      if( mesh.getShowNormals() ) displayNormals(projection,mesh);
......
984 987
      mGLSL = (major==3 && minor==0) ? 300 : 310;
985 988
      }
986 989

  
987
    int[] maxTextureSize = new int[1];
988
    GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, maxTextureSize, 0);
989
    mMaxTextureSize = maxTextureSize[0];
990
    int[] tmp = new int[1];
991
    GLES30.glGetIntegerv(GLES30.GL_MAX_TEXTURE_SIZE, tmp, 0);
992
    mMaxTextureSize = tmp[0];
993
    GLES30.glGetIntegerv(GLES30.GL_MAX_VERTEX_UNIFORM_VECTORS  , tmp, 0);
994
    mMaxNumberOfVerUniforms = tmp[0];
995
    GLES30.glGetIntegerv(GLES30.GL_MAX_FRAGMENT_UNIFORM_VECTORS, tmp, 0);
996
    mMaxNumberOfFraUniforms = tmp[0];
990 997

  
991 998
    android.util.Log.e("DISTORTED", "Using OpenGL ES "+major+"."+minor);
999
    android.util.Log.e("DISTORTED", "max texture size: "+mMaxTextureSize);
1000
    android.util.Log.e("DISTORTED", "max num vert: "+mMaxNumberOfVerUniforms);
1001
    android.util.Log.e("DISTORTED", "max num frag: "+mMaxNumberOfFraUniforms);
1002

  
992 1003
    mGLSL_VERSION = "#version "+mGLSL+" es\n";
993 1004

  
994 1005
    InternalStackFrameList.setInitialized(true);

Also available in: Unified diff