當前位置: 首頁>>代碼示例>>Java>>正文


Java GLES20.glCreateShader方法代碼示例

本文整理匯總了Java中android.opengl.GLES20.glCreateShader方法的典型用法代碼示例。如果您正苦於以下問題:Java GLES20.glCreateShader方法的具體用法?Java GLES20.glCreateShader怎麽用?Java GLES20.glCreateShader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glCreateShader方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * Compiles the provided shader source.
 *
 * @return A handle to the shader, or 0 on failure.
 */
public static int loadShader(int shaderType, String source) {
    int shader = GLES20.glCreateShader(shaderType);
    checkGlError("glCreateShader type=" + shaderType);
    GLES20.glShaderSource(shader, source);
    GLES20.glCompileShader(shader);
    int[] compiled = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
    if (compiled[0] == 0) {
        Log.e(TAG, "Could not compile shader " + shaderType + ":");
        Log.e(TAG, " " + GLES20.glGetShaderInfoLog(shader));
        GLES20.glDeleteShader(shader);
        shader = 0;
    }
    return shader;
}
 
開發者ID:TobiasLee,項目名稱:FilterPlayer,代碼行數:21,代碼來源:GlUtil.java

示例2: buildShader

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int buildShader(int type, String shaderSource) {
    final int shader = GLES20.glCreateShader(type);
    if (shader == 0) {
        return 0;
    }

    GLES20.glShaderSource(shader, shaderSource);
    GLES20.glCompileShader(shader);

    int[] status = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
        GLES20.glDeleteShader(shader);
        return 0;
    }

    return shader;
}
 
開發者ID:SimonCherryGZ,項目名稱:face-landmark-android,代碼行數:20,代碼來源:MyGLUtils.java

示例3: createShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private int createShader(int shaderType, String shaderString) {
    int shader = GLES20.glCreateShader(shaderType);
    if (shader == 0) {
        checkGLESError("create shader " + shaderType);
    }

    GLES20.glShaderSource(shader, shaderString);
    GLES20.glCompileShader(shader);
    int[] compiled = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
    if (compiled[0] == 0) {
        GLES20.glDeleteShader(shader);
        checkGLESError("compile shader " + shaderType);
    }
    return shader;
}
 
開發者ID:TedaLIEz,項目名稱:ParsingPlayer,代碼行數:17,代碼來源:VideoRenderThread.java

示例4: compileShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private static int compileShader(int shaderType, String source) {
  final int shader = GLES20.glCreateShader(shaderType);
  if (shader == 0) {
    throw new RuntimeException("glCreateShader() failed. GLES20 error: " + GLES20.glGetError());
  }
  GLES20.glShaderSource(shader, source);
  GLES20.glCompileShader(shader);
  int[] compileStatus = new int[] {GLES20.GL_FALSE};
  GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
  if (compileStatus[0] != GLES20.GL_TRUE) {
    Logging.e(
        TAG, "Could not compile shader " + shaderType + ":" + GLES20.glGetShaderInfoLog(shader));
    throw new RuntimeException(GLES20.glGetShaderInfoLog(shader));
  }
  GlUtil.checkNoGLES2Error("compileShader");
  return shader;
}
 
開發者ID:Piasy,項目名稱:VideoCRE,代碼行數:18,代碼來源:GlShader.java

示例5: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private int loadShader(int shaderType, String source) {
    int shader = GLES20.glCreateShader(shaderType);
    checkGlError("glCreateShader type=" + shaderType);
    GLES20.glShaderSource(shader, source);
    GLES20.glCompileShader(shader);
    int[] compiled = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
    if (compiled[0] == 0) {
        Log.e(TAG, "Could not compile shader " + shaderType + ":");
        Log.e(TAG, " " + GLES20.glGetShaderInfoLog(shader));
        GLES20.glDeleteShader(shader);
        shader = 0;
    }
    return shader;
}
 
開發者ID:SavorGit,項目名稱:Hotspot-master-devp,代碼行數:16,代碼來源:TextureRender.java

示例6: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * 加載指定的著色器方法
 * @param shaderType 著色器類型
 * @param source 著色器腳本字符串源碼
 * @return
 */
public static int loadShader(int shaderType, String source) {
    //創建一個shader並記錄ID
    int shader = GLES20.glCreateShader(shaderType);
    if (shader != 0){
        /**
         * 創建成功進入
         * 加載著色器代碼
         */
        GLES20.glShaderSource(shader , source);
        //編譯著色器代碼
        GLES20.glCompileShader(shader);
        int[] compiled = new int[1];
        //獲取編譯的情況
        GLES20.glGetShaderiv(shader , GLES20.GL_COMPILE_STATUS , compiled , 0);
        if (compiled[0] == 0){
            /**
             * 如果編譯失敗
             * 顯示錯誤日誌
             * 刪除該shader
             */

            Log.e(TAG, "loadShader: can not compile shader" + shaderType + " : " );
            Log.e(TAG, "loadShader: " + GLES20.glGetShaderInfoLog(shader) );
            GLES20.glDeleteShader(shader);
            shader = 0;
        }
    }
    return shader;
}
 
開發者ID:ynztlxdeai,項目名稱:GLproject,代碼行數:36,代碼來源:ShaderUtil.java

示例7: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
/**
 * 加載 著色器
 */
private int loadShader(int type, String shaderCode) {
	// create a vertex shader type (GLES20.GL_VERTEX_SHADER)
	// or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
	int shader = GLES20.glCreateShader(type);

	// add the source code to the shader and compile it
	GLES20.glShaderSource(shader, shaderCode);
	GLES20.glCompileShader(shader);

	return shader;
}
 
開發者ID:FacePlusPlus,項目名稱:MegviiFacepp-Android-SDK,代碼行數:15,代碼來源:CameraMatrix.java

示例8: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadShader(int type, String shaderCode) {
    int shader = GLES20.glCreateShader(type);

    GLES20.glShaderSource(shader, shaderCode);
    GLES20.glCompileShader(shader);
    return shader;
}
 
開發者ID:FreeSunny,項目名稱:Amazing,代碼行數:8,代碼來源:MyRender.java

示例9: compileShader

import android.opengl.GLES20; //導入方法依賴的package包/類
/** 
 * Helper function to compile a shader.
 * 
 * @param shaderType The shader type.
 * @param shaderSource The shader source code.
 * @return An OpenGL handle to the shader.
 */
public static int compileShader(final int shaderType, final String shaderSource) 
{
	int shaderHandle = GLES20.glCreateShader(shaderType);

	if (shaderHandle != 0) 
	{
		// Pass in the shader source.
		GLES20.glShaderSource(shaderHandle, shaderSource);

		// Compile the shader.
		GLES20.glCompileShader(shaderHandle);

		// Get the compilation status.
		final int[] compileStatus = new int[1];
		GLES20.glGetShaderiv(shaderHandle, GLES20.GL_COMPILE_STATUS, compileStatus, 0);

		// If the compilation failed, delete the shader.
		if (compileStatus[0] == 0) 
		{
			Log.e(TAG, "Error compiling shader: " + GLES20.glGetShaderInfoLog(shaderHandle));
			GLES20.glDeleteShader(shaderHandle);
			shaderHandle = 0;
		}
	}

	if (shaderHandle == 0)
	{			
		throw new RuntimeException("Error creating shader.");
	}
	
	return shaderHandle;
}
 
開發者ID:regar007,項目名稱:ShapesInOpenGLES2.0,代碼行數:40,代碼來源:ShaderHelper.java

示例10: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadShader(int type, String shaderCode){

        // create a vertex shader type (GLES20.GL_VERTEX_SHADER)
        // or a fragment shader type (GLES20.GL_FRAGMENT_SHADER)
        int shader = GLES20.glCreateShader(type);

        // add the source code to the shader and compile it
        GLES20.glShaderSource(shader, shaderCode);
        GLES20.glCompileShader(shader);

        return shader;
    }
 
開發者ID:PacktPublishing,項目名稱:Building-Android-UIs-with-Custom-Views,代碼行數:13,代碼來源:GLDrawer.java

示例11: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private static int loadShader(final String strSource, final int iType) {
    int[] compiled = new int[1];
    int iShader = GLES20.glCreateShader(iType);
    GLES20.glShaderSource(iShader, strSource);
    GLES20.glCompileShader(iShader);
    GLES20.glGetShaderiv(iShader, GLES20.GL_COMPILE_STATUS, compiled, 0);
    if (compiled[0] == 0) {
        Log.e("Load Shader Failed", "Compilation\n" + GLES20.glGetShaderInfoLog(iShader));
        return 0;
    }
    return iShader;
}
 
開發者ID:smartbeng,項目名稱:PaoMovie,代碼行數:13,代碼來源:OpenGLUtils.java

示例12: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
public static int loadShader(int type, String shaderSource) {
    int shader = GLES20.glCreateShader(type);
    GLES20.glShaderSource(shader, shaderSource);
    GLES20.glCompileShader(shader);

    int[] status = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        mLog.e("compile shader failed: " + GLES20.glGetShaderInfoLog(shader));
        return 0;
    }
    return shader;
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:14,代碼來源:OpenGLUtils.java

示例13: compileShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private CompilationResult compileShader(int type, String shaderCode) {
    int shader = GLES20.glCreateShader(type);
    GLES20.glShaderSource(shader, shaderCode);
    GLES20.glCompileShader(shader);

    int[] compileStatus = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compileStatus, 0);
    if (compileStatus[0] == GLES20.GL_FALSE) {
        FileLog.e("tmessages", GLES20.glGetShaderInfoLog(shader));
    }

    return new CompilationResult(shader, compileStatus[0]);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:14,代碼來源:Shader.java

示例14: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private int loadShader(int shaderType, String source) {
    int shader = GLES20.glCreateShader(shaderType);
    checkGlError("glCreateShader type=" + shaderType);
    GLES20.glShaderSource(shader, source);
    GLES20.glCompileShader(shader);
    int[] compiled = new int[1];
    GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
    if (compiled[0] == 0) {
        GLES20.glDeleteShader(shader);
        shader = 0;
    }
    return shader;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:14,代碼來源:TextureRenderer.java

示例15: loadShader

import android.opengl.GLES20; //導入方法依賴的package包/類
private static int loadShader(String vss, String fss) {
    Log.d("CameraGLRendererBase", "loadShader");
    int vshader = GLES20.glCreateShader(GLES20.GL_VERTEX_SHADER);
    GLES20.glShaderSource(vshader, vss);
    GLES20.glCompileShader(vshader);
    int[] status = new int[1];
    GLES20.glGetShaderiv(vshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile vertex shader: "+GLES20.glGetShaderInfoLog(vshader));
        GLES20.glDeleteShader(vshader);
        vshader = 0;
        return 0;
    }

    int fshader = GLES20.glCreateShader(GLES20.GL_FRAGMENT_SHADER);
    GLES20.glShaderSource(fshader, fss);
    GLES20.glCompileShader(fshader);
    GLES20.glGetShaderiv(fshader, GLES20.GL_COMPILE_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not compile fragment shader:"+GLES20.glGetShaderInfoLog(fshader));
        GLES20.glDeleteShader(vshader);
        GLES20.glDeleteShader(fshader);
        fshader = 0;
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vshader);
    GLES20.glAttachShader(program, fshader);
    GLES20.glLinkProgram(program);
    GLES20.glDeleteShader(vshader);
    GLES20.glDeleteShader(fshader);
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] == 0) {
        Log.e("CameraGLRendererBase", "Could not link shader program: "+GLES20.glGetProgramInfoLog(program));
        program = 0;
        return 0;
    }
    GLES20.glValidateProgram(program);
    GLES20.glGetProgramiv(program, GLES20.GL_VALIDATE_STATUS, status, 0);
    if (status[0] == 0)
    {
        Log.e("CameraGLRendererBase", "Shader program validation error: "+GLES20.glGetProgramInfoLog(program));
        GLES20.glDeleteProgram(program);
        program = 0;
        return 0;
    }

    Log.d("CameraGLRendererBase", "Shader program is built OK");

    return program;
}
 
開發者ID:beast,項目名稱:react-native-scan-doc,代碼行數:53,代碼來源:CameraGLRendererBase.java


注:本文中的android.opengl.GLES20.glCreateShader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。