public boolean load(String fileLocation,int type){
  if (mHasLoaded) {
    return false;
  }
  String shaderCode;
  try {
    shaderCode=ShaderUtils.getStringFromFileInAssets(mContext,fileLocation,true);
  }
 catch (  IOException e) {
    e.printStackTrace();
    mIsCompiled=false;
    return false;
  }
  mHasLoaded=true;
  mShaderId=GLES20.glCreateShader(type);
  if (mShaderId == 0) {
    String msg=(type == GLES20.GL_VERTEX_SHADER ? "Vertex" : "Fragment");
    Log.e(TAG,"Error creating shader of type " + msg);
    return false;
  }
  GLES20.glShaderSource(mShaderId,shaderCode);
  GLES20.glCompileShader(mShaderId);
  int[] compileStatus=new int[1];
  GLES20.glGetShaderiv(mShaderId,GLES20.GL_COMPILE_STATUS,compileStatus,0);
  mIsCompiled=(compileStatus[0] == GLES20.GL_TRUE);
  if (!mIsCompiled) {
    String compileError=GLES20.glGetShaderInfoLog(mShaderId);
    Log.e(TAG,compileError);
    GLES20.glDeleteShader(mShaderId);
  }
  return mIsCompiled && mHasLoaded;
}

public boolean load ( String fileLocation , int type ) { if ( mHasLoaded ) { return false ; } String shaderCode ; try { shaderCode = ShaderUtils . getStringFromFileInAssets ( mContext , fileLocation , true ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; mIsCompiled = false ; return false ; } mHasLoaded = true ; mShaderId = GLES20 . glCreateShader ( type ) ; if ( mShaderId == 0 ) { String msg = ( type == GLES20 . GL_VERTEX_SHADER ? "Vertex" : "Fragment" ) ; Log . e ( TAG , "Error creating shader of type " + msg ) ; return false ; } GLES20 . glShaderSource ( mShaderId , shaderCode ) ; GLES20 . glCompileShader ( mShaderId ) ; int [ ] compileStatus = new int [ 1 ] ; GLES20 . glGetShaderiv ( mShaderId , GLES20 . GL_COMPILE_STATUS , compileStatus , 0 ) ; mIsCompiled = ( compileStatus [ 0 ] == GLES20 . GL_TRUE ) ; if ( ! mIsCompiled ) { String compileError = GLES20 . glGetShaderInfoLog ( mShaderId ) ; Log . e ( TAG , compileError ) ; GLES20 . glDeleteShader ( mShaderId ) ; } return mIsCompiled && mHasLoaded ; }
load the shaders source file into a shader
