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


Java GLES20.glGetShaderiv方法代码示例

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


在下文中一共展示了GLES20.glGetShaderiv方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:AndyZhu1991,项目名称:grafika,代码行数:21,代码来源:GlUtil.java

示例2: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
public static int loadShader(int shaderType, String source) {
    int shader = GLES20.glCreateShader(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) {
        Lg.e( "Could not compile shader(TYPE=" + shaderType + "):");
        Lg.e( GLES20.glGetShaderInfoLog(shader));
        GLES20.glDeleteShader(shader);
        shader = 0;
    }
    //
    return shader;
}
 
开发者ID:wuyisheng,项目名称:libRtmp,代码行数:17,代码来源:AndroidUntil.java

示例3: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
private 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) {
            Log.e(TAG, "Could not compile shader " + shaderType + ":");
            Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
            GLES20.glDeleteShader(shader);
            shader = 0;
        }
    }
    return shader;
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:17,代码来源:GLES20TriangleRenderer.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: compileShader

import android.opengl.GLES20; //导入方法依赖的package包/类
private static int compileShader(int type, String shader) {
    int shaderObj = GLES20.glCreateShader(type);

    if (shaderObj == 0) {
        Log.e(TAG, "create shader obj fail: " + type);
        return 0;
    }

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

    final int[] compileStatus = new int[1];
    GLES20.glGetShaderiv(shaderObj, GLES20.GL_COMPILE_STATUS, compileStatus, 0);

    if (compileStatus[0] == GLES20.GL_FALSE) {
        Log.e(TAG, "compile shader code fail: " + type + ", "
                   + GLES20.glGetShaderInfoLog(shaderObj));

        GLES20.glDeleteShader(shaderObj);
        return 0;
    }

    return shaderObj;
}
 
开发者ID:Piasy,项目名称:OpenGLESTutorial-Android,代码行数:25,代码来源:ShaderHelper.java

示例6: loadShader

import android.opengl.GLES20; //导入方法依赖的package包/类
public 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) {
            Log.e(TAG, "Could not compile shader " + shaderType + ":");
            Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
            GLES20.glDeleteShader(shader);
            shader = 0;
        }
    }
    return shader;
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:17,代码来源:ShaderUtils.java

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

示例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: 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);
    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:LeonHover,项目名称:MediaCodecRecorder,代码行数:20,代码来源:GLUtil.java

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

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

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


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