当前位置: 首页>>代码示例>>Java>>正文


Java GLES20.glDeleteShader方法代码示例

本文整理汇总了Java中android.opengl.GLES20.glDeleteShader方法的典型用法代码示例。如果您正苦于以下问题:Java GLES20.glDeleteShader方法的具体用法?Java GLES20.glDeleteShader怎么用?Java GLES20.glDeleteShader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.opengl.GLES20的用法示例。


在下文中一共展示了GLES20.glDeleteShader方法的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:SbName,项目名称:SbCamera,代码行数:21,代码来源:GlUtil.java

示例2: loadGLShader

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Converts a raw text file, saved as a resource, into an OpenGL ES shader.
 *
 * @param type  The type of shader we will be creating.
 * @param resId The resource ID of the raw text file about to be turned into a shader.
 * @return The shader object handler.
 */
public static int loadGLShader(String tag, Context context, int type, int resId) {
    String code = readRawTextFile(context, resId);
    int shader = GLES20.glCreateShader(type);
    GLES20.glShaderSource(shader, code);
    GLES20.glCompileShader(shader);

    // Get the compilation status.
    final int[] compileStatus = new int[1];
    GLES20.glGetShaderiv(shader, 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(shader));
        GLES20.glDeleteShader(shader);
        shader = 0;
    }

    if (shader == 0) {
        throw new RuntimeException("Error creating shader.");
    }

    return shader;
}
 
开发者ID:nimbl3,项目名称:nimbl3-arcore,代码行数:31,代码来源:ShaderUtil.java

示例3: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
private int loadShader(int shaderType, String source) throws Exception {
    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) {
            String error = GLES20.glGetShaderInfoLog(shader);
            GLES20.glDeleteShader(shader);
            throw new Exception(error);
        }
    }

    return shader;
}
 
开发者ID:AgoraIO,项目名称:Agora-Video-Source-Android,代码行数:18,代码来源:Shader.java

示例4: compileShader

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * type:
 * create a vertex shader type {@link GLES20.GL_VERTEX_SHADER}
 * or a fragment shader type {@link GLES20.GL_FRAGMENT_SHADER}
 */
@SuppressWarnings("JavadocReference")
public static int compileShader(int type, String shaderCode) {

    // Load in the  shader
    int shader = GLES20.glCreateShader(type);

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

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

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

        // If the compilation failed, delete the shader.
        if (compileStatus[0] == 0) {
            GLES20.glDeleteShader(shader);
            shader = 0;
        }
    }

    if (shader == 0) {
        GLES20.glGetShaderInfoLog(shader);
        throw new RuntimeException("Error creating vertex shader.");
    }

    return shader;
}
 
开发者ID:biezhihua,项目名称:Android_OpenGL_Demo,代码行数:37,代码来源:Utils.java

示例5: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
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:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:16,代码来源:GlUtil.java

示例6: loadProgram

import android.opengl.GLES20; //导入方法依赖的package包/类
public static int loadProgram(String vertexShaderSource, String fragmentShaderSource) {
    int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderSource);
    if (vertexShader == 0) {
        return 0;
    }

    int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderSource);
    if (fragmentShader == 0) {
        GLES20.glDeleteShader(vertexShader);
        return 0;
    }

    int program = GLES20.glCreateProgram();
    GLES20.glAttachShader(program, vertexShader);
    GLES20.glAttachShader(program, fragmentShader);
    GLES20.glLinkProgram(program);

    GLES20.glDeleteShader(vertexShader);
    GLES20.glDeleteShader(fragmentShader);

    int[] status = new int[1];
    GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, status, 0);
    if (status[0] <= 0) {
        mLog.e("link program failed");
        return 0;
    }
    return program;
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:29,代码来源:OpenGLUtils.java

示例7: compileShader

import android.opengl.GLES20; //导入方法依赖的package包/类
/**
 * Compiles a shader, returning the OpenGL object ID.
 */
private static int compileShader(int type, String shaderCode) {
    // Create a new shader object.
    final int shaderObjectId = GLES20.glCreateShader(type);

    if (shaderObjectId == 0) {
        return 0;
    }

    // Pass in the shader source.
    GLES20.glShaderSource(shaderObjectId, shaderCode);

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

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

    // Verify the compile status.
    if (compileStatus[0] == 0) {
        // If it failed, delete the shader object.
        GLES20.glDeleteShader(shaderObjectId);

        return 0;
    }

    // Return the shader object ID.
    return shaderObjectId;
}
 
开发者ID:khoatd92,项目名称:sensor-graph-opengl-es-android,代码行数:34,代码来源:ShaderUtils.java

示例8: 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:MLNO,项目名称:airgram,代码行数:14,代码来源:TextureRenderer.java

示例9: loadProgram

import android.opengl.GLES20; //导入方法依赖的package包/类
public static int loadProgram(final String strVSource, final String strFSource) {
    int iVShader;
    int iFShader;
    int iProgId;
    int[] link = new int[1];
    iVShader = loadShader(strVSource, GLES20.GL_VERTEX_SHADER);
    if (iVShader == 0) {
        Log.d("Load Program", "Vertex Shader Failed");
        return 0;
    }
    iFShader = loadShader(strFSource, GLES20.GL_FRAGMENT_SHADER);
    if (iFShader == 0) {
        Log.d("Load Program", "Fragment Shader Failed");
        return 0;
    }

    iProgId = GLES20.glCreateProgram();

    GLES20.glAttachShader(iProgId, iVShader);
    GLES20.glAttachShader(iProgId, iFShader);

    GLES20.glLinkProgram(iProgId);

    GLES20.glGetProgramiv(iProgId, GLES20.GL_LINK_STATUS, link, 0);
    if (link[0] <= 0) {
        Log.d("Load Program", "Linking Failed");
        return 0;
    }
    GLES20.glDeleteShader(iVShader);
    GLES20.glDeleteShader(iFShader);
    return iProgId;
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:33,代码来源:OpenGlUtils.java

示例10: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
static int loadShader(int shaderType, String source) {
    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) {
            String info = GLES20.glGetShaderInfoLog(shader);
            GLES20.glDeleteShader(shader);
            throw new RuntimeException("Could not compile shader " + shaderType + ":" + info);
        }
    }
    return shader;
}
 
开发者ID:gplibs,项目名称:android-magic-surface-view,代码行数:16,代码来源:GLUtil.java

示例11: 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

示例12: 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:sdrausty,项目名称:buildAPKsApps,代码行数:40,代码来源:ShaderHelper.java

示例13: 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:jorenham,项目名称:fingerblox,代码行数:53,代码来源:CameraGLRendererBase.java

示例14: Shader

import android.opengl.GLES20; //导入方法依赖的package包/类
public Shader(String vertexShader, String fragmentShader, String attributes[], String uniforms[]) {
    this.program = GLES20.glCreateProgram();

    CompilationResult vResult = compileShader(GLES20.GL_VERTEX_SHADER, vertexShader);
    if (vResult.status == GLES20.GL_FALSE) {
        FileLog.e("tmessages", "Vertex shader compilation failed");
        destroyShader(vResult.shader, 0, program);
        return;
    }

    CompilationResult fResult = compileShader(GLES20.GL_FRAGMENT_SHADER, fragmentShader);
    if (fResult.status == GLES20.GL_FALSE) {
        FileLog.e("tmessages", "Fragment shader compilation failed");
        destroyShader(vResult.shader, fResult.shader, program);
        return;
    }

    GLES20.glAttachShader(program, vResult.shader);
    GLES20.glAttachShader(program, fResult.shader);

    for (int i = 0; i < attributes.length; i++) {
        GLES20.glBindAttribLocation(program, i, attributes[i]);
    }

    if (linkProgram(program) == GLES20.GL_FALSE) {
        destroyShader(vResult.shader, fResult.shader, program);
        return;
    }

    for (String uniform : uniforms) {
        uniformsMap.put(uniform, GLES20.glGetUniformLocation(program, uniform));
    }

    if (vResult.shader != 0) {
        GLES20.glDeleteShader(vResult.shader);
    }

    if (fResult.shader != 0) {
        GLES20.glDeleteShader(fResult.shader);
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:42,代码来源:Shader.java

示例15: deleteProgram

import android.opengl.GLES20; //导入方法依赖的package包/类
public void deleteProgram() {
    GLES20.glDeleteShader(mShaderVertex);
    GLES20.glDeleteShader(mShaderFragment);
    GLES20.glDeleteProgram(mProgram);
    mProgram = mShaderVertex = mShaderFragment = 0;
}
 
开发者ID:AgoraIO,项目名称:Agora-Video-Source-Android,代码行数:7,代码来源:Shader.java


注:本文中的android.opengl.GLES20.glDeleteShader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。