Code example for GLSurfaceView

Methods: getResources

0
 
	// ³õʼ»¯shader 
	public void initShader(GLSurfaceView mv) {
		// ¼ÓÔض¥µã×ÅÉ«Æ÷µÄ½Å±¾ÄÚÈÝ 
		mVertexShader = ShaderUtil.loadFromAssetsFile("vertex6_7.sh",
				mv.getResources());
		// ¼ÓÔØƬԪ×ÅÉ«Æ÷µÄ½Å±¾ÄÚÈÝ 
		mFragmentShader = ShaderUtil.loadFromAssetsFile("frag6_7.sh",
				mv.getResources());
		// »ùÓÚ¶¥µã×ÅÉ«Æ÷ÓëƬԪ×ÅÉ«Æ÷´´½¨³ÌÐò 
		mProgram = ShaderUtil.createProgram(mVertexShader, mFragmentShader);
		// »ñÈ¡³ÌÐòÖж¥µãλÖÃÊôÐÔÒýÓà
		maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
		// »ñÈ¡³ÌÐòÖÐ×ܱ任¾ØÕóÒýÓà
		muMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
        //»ñȡλÖá¢Ðýת±ä»»¾ØÕóÒýÓà
        muMMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMMatrix");  
		// »ñÈ¡³ÌÐòÖÐÁ¢·½Ìå°ë¾¶ÒýÓà
		muRHandle = GLES20.glGetUniformLocation(mProgram, "uR");
        //»ñÈ¡³ÌÐòÖж¥µã·¨ÏòÁ¿ÊôÐÔÒýÓà