Java Code Examples for android.opengl.GLES20#glDeleteProgram()

The following examples show how to use android.opengl.GLES20#glDeleteProgram() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GLES20Canvas.java    From android-openGL-canvas with Apache License 2.0 6 votes vote down vote up
private static int assembleProgram(int vertexShader, int fragmentShader, ShaderParameter[] params, int[] linkStatus) {
    int program = GLES20.glCreateProgram();
    checkError();
    if (program == 0) {
        throw new RuntimeException("Cannot create GL program: " + GLES20.glGetError());
    }
    GLES20.glAttachShader(program, vertexShader);
    checkError();
    GLES20.glAttachShader(program, fragmentShader);
    checkError();
    GLES20.glLinkProgram(program);
    checkError();
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
    if (linkStatus[0] != GLES20.GL_TRUE) {
        Log.e(TAG, "Could not link program: ");
        Log.e(TAG, GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
    }
    loadHandles(params, program);
    return program;
}
 
Example 2
Source File: GlUtil.java    From LiveVideoBroadcaster with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new program from the supplied vertex and fragment shaders.
 *
 * @return A handle to the program, or 0 on failure.
 */
public static int createProgram(String vertexSource, String fragmentSource) {
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
    if (vertexShader == 0) {
        return 0;
    }
    int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
    if (pixelShader == 0) {
        return 0;
    }

    int program = GLES20.glCreateProgram();
    checkGlError("glCreateProgram");
    if (program == 0) {
        Log.e(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.GL_LINK_STATUS, linkStatus, 0);
    if (linkStatus[0] != GLES20.GL_TRUE) {
        Log.e(TAG, "Could not link program: ");
        Log.e(TAG, GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
    }
    return program;
}
 
Example 3
Source File: ShaderProgram.java    From Spectaculum with Apache License 2.0 5 votes vote down vote up
public ShaderProgram(String vertexShaderName, String fragmentShaderName) {
    String vertexShaderCode = LibraryHelper.loadTextFromAsset("shaders/" + vertexShaderName);
    String fragmentShaderCode = LibraryHelper.loadTextFromAsset("shaders/" + fragmentShaderName);

    vertexShaderCode = preprocessVertexShaderCode(vertexShaderCode);
    fragmentShaderCode = preprocessFragmentShaderCode(fragmentShaderCode);

    mVShaderHandle = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
    mFShaderHandle = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);

    mProgramHandle = GLES20.glCreateProgram();
    GLES20.glAttachShader(mProgramHandle, mVShaderHandle);
    GLUtils.checkError("glAttachShader V");
    GLES20.glAttachShader(mProgramHandle, mFShaderHandle);
    GLUtils.checkError("glAttachShader F");
    GLES20.glLinkProgram(mProgramHandle);

    int[] linkStatus = new int[1];
    GLES20.glGetProgramiv(mProgramHandle, GLES20.GL_LINK_STATUS, linkStatus, 0);
    if (linkStatus[0] != GLES20.GL_TRUE) {
        Log.e(TAG, "Error linking program: " + GLES20.glGetProgramInfoLog(mProgramHandle));
        GLES20.glDeleteProgram(mProgramHandle);
    }

    // delete the shaders after compiling the program to free some space (if they will not be reused later)
    // http://stackoverflow.com/questions/9113154/proper-way-to-delete-glsl-shader
    deleteShader(mVShaderHandle);
    deleteShader(mFShaderHandle);
}
 
Example 4
Source File: TextureManager.java    From libstreaming with Apache License 2.0 5 votes vote down vote up
/**
 * Replaces the fragment shader.  Pass in null to reset to default.
 */
public void changeFragmentShader(String fragmentShader) {
	if (fragmentShader == null) {
		fragmentShader = FRAGMENT_SHADER;
	}
	GLES20.glDeleteProgram(mProgram);
	mProgram = createProgram(VERTEX_SHADER, fragmentShader);
	if (mProgram == 0) {
		throw new RuntimeException("failed creating program");
	}
}
 
Example 5
Source File: TextureRender.java    From android-transcoder with Apache License 2.0 5 votes vote down vote up
private int createProgram(String vertexSource, String fragmentSource) {
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
    if (vertexShader == 0) {
        return 0;
    }
    int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
    if (pixelShader == 0) {
        return 0;
    }
    int program = GLES20.glCreateProgram();
    checkGlError("glCreateProgram");
    if (program == 0) {
        Log.e(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.GL_LINK_STATUS, linkStatus, 0);
    if (linkStatus[0] != GLES20.GL_TRUE) {
        Log.e(TAG, "Could not link program: ");
        Log.e(TAG, GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
    }
    return program;
}
 
Example 6
Source File: TextureManager.java    From spydroid-ipcamera with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Replaces the fragment shader.  Pass in null to reset to default.
 */
public void changeFragmentShader(String fragmentShader) {
	if (fragmentShader == null) {
		fragmentShader = FRAGMENT_SHADER;
	}
	GLES20.glDeleteProgram(mProgram);
	mProgram = createProgram(VERTEX_SHADER, fragmentShader);
	if (mProgram == 0) {
		throw new RuntimeException("failed creating program");
	}
}
 
Example 7
Source File: TextureRenderer.java    From AndroidVideoSamples with Apache License 2.0 5 votes vote down vote up
private int createProgram( String vertexSource, String fragmentSource ) {
   int vertexShader = loadShader( GLES20.GL_VERTEX_SHADER, vertexSource );
   if ( vertexShader == 0 ) {
      return 0;
   }
   int pixelShader = loadShader( GLES20.GL_FRAGMENT_SHADER, fragmentSource );
   if ( pixelShader == 0 ) {
      return 0;
   }
   int program = GLES20.glCreateProgram();
   checkGlError( "glCreateProgram" );
   if ( program == 0 ) {
      Log.e( 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.GL_LINK_STATUS, linkStatus, 0 );
   if ( linkStatus[0] != GLES20.GL_TRUE ) {
      Log.e( TAG, "Could not link program: " );
      Log.e( TAG, GLES20.glGetProgramInfoLog( program ) );
      GLES20.glDeleteProgram( program );
      program = 0;
   }
   return program;
}
 
Example 8
Source File: ShaderHelper.java    From sealrtc-android with MIT License 5 votes vote down vote up
/**
 * 将顶点着色器和片段着色器链接到一起
 *
 * @param vertexShaderId
 * @param fragmentShaderId
 * @return
 */
public static int linkProgram(int vertexShaderId, int fragmentShaderId) {
    // 创建Opengl程序对象
    final int programObjectId = GLES20.glCreateProgram();
    if (programObjectId == 0) {
        Log.e(TAG, "linkProgram: could not create new program");
        return 0;
    }
    // 将着色器对象引用附加到新建的程序对象上
    GLES20.glAttachShader(programObjectId, vertexShaderId);
    GLES20.glAttachShader(programObjectId, fragmentShaderId);
    // 将着色器联合起来
    GLES20.glLinkProgram(programObjectId);
    // 获取链接状态
    int[] status = new int[1];
    GLES20.glGetProgramiv(programObjectId, GLES20.GL_LINK_STATUS, status, 0);
    Log.d(
            TAG,
            "linkProgram: status="
                    + status[0]
                    + " results of linking program:"
                    + GLES20.glGetProgramInfoLog(programObjectId));
    // 判断是否链接成功,如果status是0表示失败,则删除程序对象
    if (status[0] == 0) {
        GLES20.glDeleteProgram(programObjectId);
        Log.e(TAG, "linkProgram: Linking of program Failed");
        return 0;
    }
    return programObjectId;
}
 
Example 9
Source File: TextureRenderer.java    From VideoCompressor with Apache License 2.0 5 votes vote down vote up
private int createProgram(String vertexSource, String fragmentSource) {
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
    if (vertexShader == 0) {
        return 0;
    }
    int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
    if (pixelShader == 0) {
        return 0;
    }
    int program = GLES20.glCreateProgram();
    checkGlError("glCreateProgram");
    if (program == 0) {
        return 0;
    }
    GLES20.glAttachShader(program, vertexShader);
    checkGlError("glAttachShader");
    GLES20.glAttachShader(program, pixelShader);
    checkGlError("glAttachShader");
    GLES20.glLinkProgram(program);
    int[] linkStatus = new int[1];
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
    if (linkStatus[0] != GLES20.GL_TRUE) {
        GLES20.glDeleteProgram(program);
        program = 0;
    }
    return program;
}
 
Example 10
Source File: Program.java    From PD-classes with GNU General Public License v3.0 4 votes vote down vote up
public void delete() {
	GLES20.glDeleteProgram( handle );
}
 
Example 11
Source File: GreyScaleFilterRender.java    From rtmp-rtsp-stream-client-java with Apache License 2.0 4 votes vote down vote up
@Override
public void release() {
  GLES20.glDeleteProgram(program);
}
 
Example 12
Source File: CameraGLRendererBase.java    From FtcSamples with MIT License 4 votes vote down vote up
private static int loadShader(String vss, String fss) {
    Log.d("CameraGLRendererBase", "loadShader");
    int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
    GLES20.glShaderSource(vshader, vss);
    GLES20.glCompileShader(vshader);
    int[] status = new int[1];
    GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
        GLES20.glDeleteShader(vshader);
        vshader = 0;
        return 0;
    }

    int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
    GLES20.glShaderSource(fshader, fss);
    GLES20.glCompileShader(fshader);
    GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
        GLES20.glDeleteShader(vshader);
        GLES20.glDeleteShader(fshader);
        fshader = 0;
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vshader);
    GLES20.glAttachShader(program, fshader);
    GLES20.glLinkProgram(program);
    GLES20.glDeleteShader(vshader);
    GLES20.glDeleteShader(fshader);
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
        program = 0;
        return 0;
    }
    GLES20.glValidateProgram(program);
    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] == 0)
    {
        Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
        return 0;
    }

    Log.d("CameraGLRendererBase", "Shader program is built OK");

    return program;
}
 
Example 13
Source File: CameraGLRendererBase.java    From react-native-documentscanner-android with MIT License 4 votes vote down vote up
private static int loadShader(String vss, String fss) {
    Log.d("CameraGLRendererBase", "loadShader");
    int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
    GLES20.glShaderSource(vshader, vss);
    GLES20.glCompileShader(vshader);
    int[] status = new int[1];
    GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
        GLES20.glDeleteShader(vshader);
        vshader = 0;
        return 0;
    }

    int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
    GLES20.glShaderSource(fshader, fss);
    GLES20.glCompileShader(fshader);
    GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
        GLES20.glDeleteShader(vshader);
        GLES20.glDeleteShader(fshader);
        fshader = 0;
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vshader);
    GLES20.glAttachShader(program, fshader);
    GLES20.glLinkProgram(program);
    GLES20.glDeleteShader(vshader);
    GLES20.glDeleteShader(fshader);
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
        program = 0;
        return 0;
    }
    GLES20.glValidateProgram(program);
    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] == 0)
    {
        Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
        return 0;
    }

    Log.d("CameraGLRendererBase", "Shader program is built OK");

    return program;
}
 
Example 14
Source File: ShaderHelper.java    From secureit with MIT License 4 votes vote down vote up
/**
 * Helper function to compile and link a program.
 * 
 * @param vertexShaderHandle An OpenGL handle to an already-compiled vertex shader.
 * @param fragmentShaderHandle An OpenGL handle to an already-compiled fragment shader.
 * @param attributes Attributes that need to be bound to the program.
 * @return An OpenGL handle to the program.
 */
public static int createAndLinkProgram(final int vertexShaderHandle, final int fragmentShaderHandle, final String[] attributes) 
{
	int programHandle = GLES20.glCreateProgram();
	
	if (programHandle != 0) 
	{
		// Bind the vertex shader to the program.
		GLES20.glAttachShader(programHandle, vertexShaderHandle);			

		// Bind the fragment shader to the program.
		GLES20.glAttachShader(programHandle, fragmentShaderHandle);
		
		// Bind attributes
		if (attributes != null)
		{
			final int size = attributes.length;
			for (int i = 0; i < size; i++)
			{
				GLES20.glBindAttribLocation(programHandle, i, attributes[i]);
			}						
		}
		
		// Link the two shaders together into a program.
		GLES20.glLinkProgram(programHandle);

		// Get the link status.
		final int[] linkStatus = new int[1];
		GLES20.glGetProgramiv(programHandle, GLES20.GL_LINK_STATUS, linkStatus, 0);

		// If the link failed, delete the program.
		if (linkStatus[0] == 0) 
		{				
			Log.e(TAG, "Error compiling program: " + GLES20.glGetProgramInfoLog(programHandle));
			GLES20.glDeleteProgram(programHandle);
			programHandle = 0;
		}
	}
	
	if (programHandle == 0)
	{
		throw new RuntimeException("Error creating program.");
	}
	
	return programHandle;
}
 
Example 15
Source File: CameraGLRendererBase.java    From ml-authentication with Apache License 2.0 4 votes vote down vote up
private static int loadShader(String vss, String fss) {
    Log.d("CameraGLRendererBase", "loadShader");
    int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
    GLES20.glShaderSource(vshader, vss);
    GLES20.glCompileShader(vshader);
    int[] status = new int[1];
    GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
        GLES20.glDeleteShader(vshader);
        vshader = 0;
        return 0;
    }

    int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
    GLES20.glShaderSource(fshader, fss);
    GLES20.glCompileShader(fshader);
    GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
        GLES20.glDeleteShader(vshader);
        GLES20.glDeleteShader(fshader);
        fshader = 0;
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vshader);
    GLES20.glAttachShader(program, fshader);
    GLES20.glLinkProgram(program);
    GLES20.glDeleteShader(vshader);
    GLES20.glDeleteShader(fshader);
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
        program = 0;
        return 0;
    }
    GLES20.glValidateProgram(program);
    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] == 0)
    {
        Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
        return 0;
    }

    Log.d("CameraGLRendererBase", "Shader program is built OK");

    return program;
}
 
Example 16
Source File: FlatShadedProgram.java    From PhotoMovie with Apache License 2.0 4 votes vote down vote up
/**
 * Releases the program.
 */
public void release() {
    GLES20.glDeleteProgram(mProgramHandle);
    mProgramHandle = -1;
}
 
Example 17
Source File: GPUImageFilter.java    From SimpleVideoEditor with Apache License 2.0 4 votes vote down vote up
public final void destroy() {
    mIsInitialized = false;
    GLES20.glDeleteProgram(mGLProgId);
    onDestroy();
}
 
Example 18
Source File: CameraGLRendererBase.java    From MOAAP with MIT License 4 votes vote down vote up
private static int loadShader(String vss, String fss) {
    Log.d("CameraGLRendererBase", "loadShader");
    int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
    GLES20.glShaderSource(vshader, vss);
    GLES20.glCompileShader(vshader);
    int[] status = new int[1];
    GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
        GLES20.glDeleteShader(vshader);
        vshader = 0;
        return 0;
    }

    int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
    GLES20.glShaderSource(fshader, fss);
    GLES20.glCompileShader(fshader);
    GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
        GLES20.glDeleteShader(vshader);
        GLES20.glDeleteShader(fshader);
        fshader = 0;
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vshader);
    GLES20.glAttachShader(program, fshader);
    GLES20.glLinkProgram(program);
    GLES20.glDeleteShader(vshader);
    GLES20.glDeleteShader(fshader);
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
        program = 0;
        return 0;
    }
    GLES20.glValidateProgram(program);
    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] == 0)
    {
        Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
        return 0;
    }

    Log.d("CameraGLRendererBase", "Shader program is built OK");

    return program;
}
 
Example 19
Source File: ShaderUtils.java    From ZGDanmaku with Apache License 2.0 4 votes vote down vote up
/**
 * 创建shader程序
 *
 * @param vertexSource
 * @param fragmentSource
 * @return 创建成功返回非0值,失败返回0
 */
public static int createProgram(String vertexSource, String fragmentSource) {

    //加载顶点着色器
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
    if (vertexShader == 0) {
        return 0;
    }

    //加载片元着色器
    int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, 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);

        //存放链接成功program数量的数组
        int[] linkStatus = new int[1];

        //获取program的链接情况
        GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);

        //若链接失败则报错并删除程序
        if (linkStatus[0] != GLES20.GL_TRUE) {
            ZGLog.e("ES20_ERROR" + "Could not link program: ");
            ZGLog.e("ES20_ERROR" + GLES20.glGetProgramInfoLog(program));
            GLES20.glDeleteProgram(program);
            program = 0;
        }
    }
    ZGLog.d("createProgram program=" + program + ", \nvertexSource[" + vertexSource + "]" + ", \nfragmentSource[" + fragmentSource + "]");
    return program;
}
 
Example 20
Source File: GLRenderer.java    From UltimateAndroid with Apache License 2.0 votes vote down vote up
/**
	 * Cleans up the opengl objects for this renderer.  Must be called with opengl context.
	 * Normally called by {@link FastImageProcessingPipeline}.
	 */
	public void destroy() {
		initialized = false;
		if(programHandle != 0) {
			GLES20.glDeleteProgram(programHandle);
			programHandle = 0;
		}
		if(vertexShaderHandle != 0) {
			GLES20.glDeleteShader(vertexShaderHandle);
			vertexShaderHandle = 0;
		}
		if(fragmentShaderHandle != 0) {
			GLES20.glDeleteShader(fragmentShaderHandle);
			fragmentShaderHandle = 0;
		}
		
	}