Back to project page glestest.
The source code is released under:
GNU General Public License
If you think the Android project glestest listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/* * GLESTestGeometry.java : Shader program management. * (C)2013 Marisa Kirisame, UnSX Team. */*ww w . j a va 2 s.c om*/ * This file is part of GLEStest. * * GLEStest is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * GLEStest is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GLEStest. If not, see <http://www.gnu.org/licenses/>. */ package org.sayachan.glestest; import android.opengl.GLES20; /*import android.util.Log;*/ /* clase principal */ class GLESTestShader { /* cdigo fuente de los shaders */ protected String fragSource, vertSource; /* shaders compilados */ protected int fragShader, vertShader; /* programa de shader */ protected int shaderProgram; public void Compile() { GLES20.glShaderSource(fragShader,fragSource); GLES20.glCompileShader(fragShader); GLES20.glShaderSource(vertShader,vertSource); GLES20.glCompileShader(vertShader); GLES20.glAttachShader(shaderProgram,fragShader); GLES20.glAttachShader(shaderProgram,vertShader); GLES20.glLinkProgram(shaderProgram); /*Log.i("GLESTest",GLES20.glGetShaderInfoLog(fragShader)); Log.i("GLESTest",GLES20.glGetShaderInfoLog(vertShader)); Log.i("GLESTest",GLES20.glGetProgramInfoLog(shaderProgram));*/ } public void Use() { GLES20.glUseProgram(shaderProgram); } public GLESTestShader( String[] src ) { fragShader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER); vertShader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER); shaderProgram = GLES20.glCreateProgram(); fragSource = src[0]; vertSource = src[1]; Compile(); } }