drawSelf(int texId)格式对应

public void drawSelf(<span style="color:#cc0000;">int textureId0,int textureId1</span>){
		MatrixState.pushMatrix();
		MatrixState.scale(SPIRIT_SCALE,SPIRIT_SCALE,SPIRIT_SCALE);
		MatrixState.rotate(90, 1, 0, 0);
		loadPart[0].drawSelf(textureId1);
		loadPart[1].drawSelf(textureId0);
		loadPart[2].drawSelf(textureId1);
		
		MatrixState.popMatrix();
	}


public void drawSelf(<strong><span style="color:#ff0000;">int texId</span></strong>) {
		GLES20.glUseProgram(mProgram);
		GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, MatrixState.getFinalMatrix(), 0);
		GLES20.glUniformMatrix4fv(muMMatrixHandle, 1, false, MatrixState.getMMatrix(), 0);
		GLES20.glUniform3fv(muLightLocationHandle, 1, MatrixState.lightPositionFB);
		GLES20.glUniform3fv(muCameraHandle, 1, MatrixState.cameraFB);
		
		GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 3 * 4, mVertexBuffer);
		GLES20.glVertexAttribPointer(maNormalHandle, 3, GLES20.GL_FLOAT, false, 3*4, mNormalBuffer);
		
		GLES20.glEnableVertexAttribArray(maPositionHandle);
		GLES20.glEnableVertexAttribArray(maNormalHandle);
		
		switch(flag){
		case 0:
			GLES20.glVertexAttribPointer(maTexCoorHandle, 2, GLES20.GL_FLOAT, false, 2 * 4, mTexCoorBuffer);
			GLES20.glEnableVertexAttribArray(maTexCoorHandle);
			GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
			GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texId);
			break;
		case 1:
			GLES20.glActiveTexture(GLES20.GL_TEXTURE_CUBE_MAP);
		    GLES20.glBindTexture(GLES20.GL_TEXTURE_CUBE_MAP, texId);
			break;
		}


posted @ 2015-06-22 22:22  Anzhongliu  阅读(438)  评论(0编辑  收藏  举报