Back to project page Texample2.
The source code is released under:
CC0 1.0 Universal http://creativecommons.org/publicdomain/zero/1.0/legalcode
If you think the Android project Texample2 listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.android.texample2.programs; // www . j a v a 2s . co m import android.opengl.GLES20; import com.android.texample2.AttribVariable; import com.android.texample2.Utilities; public abstract class Program { private int programHandle; private int vertexShaderHandle; private int fragmentShaderHandle; private boolean mInitialized; public Program() { mInitialized = false; } public void init() { init(null, null, null); } public void init(String vertexShaderCode, String fragmentShaderCode, AttribVariable[] programVariables) { vertexShaderHandle = Utilities.loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode); fragmentShaderHandle = Utilities.loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode); programHandle = Utilities.createProgram( vertexShaderHandle, fragmentShaderHandle, programVariables); mInitialized = true; } public int getHandle() { return programHandle; } public void delete() { GLES20.glDeleteShader(vertexShaderHandle); GLES20.glDeleteShader(fragmentShaderHandle); GLES20.glDeleteProgram(programHandle); mInitialized = false; } public boolean initialized() { return mInitialized; } }