src/com/projectI/openglshadowdemo/common/RenderProgram.java
private int createProgram() {
		// Vertex shader
		mVertexShader = loadShader(GLES20.GL_VERTEX_SHADER, mVertexS);
		if (mVertexShader == 0) {
			return 0;
		}

		// pixel shader
		mPixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, mFragmentS);
		if (mPixelShader == 0) {
			return 0;
		}

		// Create the program
		mProgram = GLES20.glCreateProgram();
		if (mProgram != 0) {
			GLES20.glAttachShader(mProgram, mVertexShader);
			//checkGlError("glAttachShader VS " + this.toString());
			GLES20.glAttachShader(mProgram, mPixelShader);
			//checkGlError("glAttachShader PS");
			GLES20.glLinkProgram(mProgram);
			int[] linkStatus = new int[1];
			GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
			if (linkStatus[0] != GLES20.GL_TRUE) {
				Log.e(TAG, "Could not link _program: ");
				Log.e(TAG, GLES20.glGetProgramInfoLog(mProgram));
				GLES20.glDeleteProgram(mProgram);
				mProgram = 0;
				return 0;
			}
		}
		else
			Log.d("CreateProgram", "Could not create program");

		return 1;
	}
/**
	 * Creates a shader program.
	 * @param vertexSource
	 * @param fragmentSource
	 * @return returns 1 if creation successful, 0 if not
	 */
Creates a shader program.
@param vertexSource
@param fragmentSource
@return returns 1 if creation successful, 0 if not
Creates a shader program . @param vertexSource @param fragmentSource @return returns 1 if creation successful 0 if not
private int createProgram() {
		mVertexShader = loadShader(GLES20.GL_VERTEX_SHADER, mVertexS);
		if (mVertexShader == 0) {
			return 0;
		}
		mPixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, mFragmentS);
		if (mPixelShader == 0) {
			return 0;
		}
		mProgram = GLES20.glCreateProgram();
		if (mProgram != 0) {
			GLES20.glAttachShader(mProgram, mVertexShader);
			GLES20.glAttachShader(mProgram, mPixelShader);
			GLES20.glLinkProgram(mProgram);
			int[] linkStatus = new int[1];
			GLES20.glGetProgramiv(mProgram, GLES20.GL_LINK_STATUS, linkStatus, 0);
			if (linkStatus[0] != GLES20.GL_TRUE) {
				Log.e(TAG, "Could not link _program: ");
				Log.e(TAG, GLES20.glGetProgramInfoLog(mProgram));
				GLES20.glDeleteProgram(mProgram);
				mProgram = 0;
				return 0;
			}
		}
		else
			Log.d("CreateProgram", "Could not create program");
		return 1;
	}
private int createProgram ( ) { mVertexShader = loadShader ( GLES20 . GL_VERTEX_SHADER , mVertexS ) ; if ( mVertexShader == 0 ) { return 0 ; } mPixelShader = loadShader ( GLES20 . GL_FRAGMENT_SHADER , mFragmentS ) ; if ( mPixelShader == 0 ) { return 0 ; } mProgram = GLES20 . glCreateProgram ( ) ; if ( mProgram != 0 ) { GLES20 . glAttachShader ( mProgram , mVertexShader ) ; GLES20 . glAttachShader ( mProgram , mPixelShader ) ; GLES20 . glLinkProgram ( mProgram ) ; int [ ] linkStatus = new int [ 1 ] ; GLES20 . glGetProgramiv ( mProgram , GLES20 . GL_LINK_STATUS , linkStatus , 0 ) ; if ( linkStatus [ 0 ] != GLES20 . GL_TRUE ) { Log . e ( TAG , "Could not link _program: " ) ; Log . e ( TAG , GLES20 . glGetProgramInfoLog ( mProgram ) ) ; GLES20 . glDeleteProgram ( mProgram ) ; mProgram = 0 ; return 0 ; } } else Log . d ( "CreateProgram" , "Could not create program" ) ; return 1 ; }
Creates a shader program.
Creates a shader program .
// Vertex shader // pixel shader // Create the program //checkGlError("glAttachShader VS " + this.toString()); //checkGlError("glAttachShader PS");