private int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(GLES20.GlVertexShader, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GlFragmentShader, fragmentSource); if (pixelShader == 0) { return 0; } int program = GLES20.GlCreateProgram(); checkGlError("glCreateProgram"); if (program == 0) { Log.Error(TAG, "Could not create program"); } GLES20.GlAttachShader(program, vertexShader); checkGlError("glAttachShader"); GLES20.GlAttachShader(program, pixelShader); checkGlError("glAttachShader"); GLES20.GlLinkProgram(program); int[] linkStatus = new int[1]; GLES20.GlGetProgramiv(program, GLES20.GlLinkStatus, linkStatus, 0); if (linkStatus[0] != GLES20.GlTrue) { Log.Error(TAG, "Could not link program: "); Log.Error(TAG, GLES20.GlGetProgramInfoLog(program)); GLES20.GlDeleteProgram(program); program = 0; } return program; }
private int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(35633, vertexSource); if (vertexShader == 0) { return(0); } int pixelShader = loadShader(35632, fragmentSource); if (pixelShader == 0) { return(0); } int program = GLES20.GlCreateProgram(); if (program != 0) { GLES20.GlAttachShader(program, vertexShader); checkGlError("glAttachShader"); GLES20.GlAttachShader(program, pixelShader); checkGlError("glAttachShader"); GLES20.GlLinkProgram(program); int[] linkStatus = new int[1]; GLES20.GlGetProgramiv(program, 35714, linkStatus, 0); if (linkStatus[0] != 1) { Log.Error("DistortionRenderer", "Could not link program: "); Log.Error("DistortionRenderer", GLES20.GlGetProgramInfoLog(program)); GLES20.GlDeleteProgram(program); program = 0; } } return(program); }