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


Java GL4.glGetActiveUniformName方法代码示例

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


在下文中一共展示了GL4.glGetActiveUniformName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initProgram

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {

        boolean validated = true;

        gl4.glGenProgramPipelines(1, pipelineName);

        ShaderProgram shaderProgram = new ShaderProgram();

        ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true);
        ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true);

        shaderProgram.init(gl4);
        programName = shaderProgram.program();

        gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);

        shaderProgram.add(vertShaderCode);
        shaderProgram.add(fragShaderCode);
        shaderProgram.link(gl4, System.out);

        int[] activeUniform = {0};
        gl4.glGetProgramiv(programName, GL_ACTIVE_UNIFORMS, activeUniform, 0);

        for (int i = 0; i < activeUniform[0]; ++i) {

            byte[] name = new byte[128];
            int[] length = {0};

            gl4.glGetActiveUniformName(programName, i, name.length, length, 0, name, 0);

            String stringName = new String(name).trim();

            IntBuffer indices = GLBuffers.newDirectIntBuffer(1).put(0, i);
            if (stringName.equals("Transform.mvp[0]")) {
                gl4.glGetActiveUniformsiv(programName, 1, indices, GL_UNIFORM_ARRAY_STRIDE, uniformArrayStrideMat);
            }

            if (stringName.equals("Indirection.transform[0]")) {
                gl4.glGetActiveUniformsiv(programName, 1, indices, GL_UNIFORM_ARRAY_STRIDE, uniformArrayStrideInt);
            }
            BufferUtils.destroyDirectBuffer(indices);
        }

        if (validated) {

            gl4.glGenProgramPipelines(1, pipelineName);
            gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
        }

        return validated & checkError(gl4, "initProgram");
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:54,代码来源:Gl_430_multi_draw_indirect.java

示例2: initProgram

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {

        boolean validated = true;

        ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true);
        ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true);

        ShaderProgram shaderProgram = new ShaderProgram();
        shaderProgram.init(gl4);

        programName = shaderProgram.program();

        gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);

        shaderProgram.add(vertShaderCode);
        shaderProgram.add(fragShaderCode);
        shaderProgram.link(gl4, System.out);

        int[] activeUniform = {0};
        gl4.glGetProgramiv(programName, GL_ACTIVE_UNIFORMS, activeUniform, 0);

        for (int i = 0; i < activeUniform[0]; ++i) {

            byte[] name = new byte[128];
            int[] length = {0};

            gl4.glGetActiveUniformName(programName, i, name.length, length, 0, name, 0);

            String stringName = new String(name).trim();

            if (stringName.equals("indirection.Transform[0]")) {
                IntBuffer uniformIndices = GLBuffers.newDirectIntBuffer(new int[]{i});
                gl4.glGetActiveUniformsiv(programName, 1, uniformIndices, GL_UNIFORM_ARRAY_STRIDE, uniformArrayStrideInt);
                BufferUtils.destroyDirectBuffer(uniformIndices);
            }
        }

        if (validated) {

            gl4.glGenProgramPipelines(1, pipelineName);
            gl4.glUseProgramStages(pipelineName.get(0), GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
        }

        return validated & checkError(gl4, "initProgram");
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:48,代码来源:Gl_500_multi_draw_indirect_arb.java

示例3: initProgram

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private boolean initProgram(GL4 gl4) {

        boolean validated = true;

        ShaderCode vertShaderCode = ShaderCode.create(gl4, GL_VERTEX_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "vert", null, true);
        ShaderCode fragShaderCode = ShaderCode.create(gl4, GL_FRAGMENT_SHADER,
                this.getClass(), SHADERS_ROOT, null, SHADERS_SOURCE, "frag", null, true);

        ShaderProgram shaderProgram = new ShaderProgram();
        shaderProgram.init(gl4);

        programName = shaderProgram.program();

        gl4.glProgramParameteri(programName, GL_PROGRAM_SEPARABLE, GL_TRUE);

        shaderProgram.add(vertShaderCode);
        shaderProgram.add(fragShaderCode);
        shaderProgram.link(gl4, System.out);

        int[] activeUniform = {0};
        gl4.glGetProgramiv(programName, GL_ACTIVE_UNIFORMS, activeUniform, 0);

        for (int i = 0; i < activeUniform[0]; ++i) {

            byte[] name = new byte[128];
            int[] length = {0};

            gl4.glGetActiveUniformName(programName, i, name.length, length, 0, name, 0);

            String stringName = new String(name).trim();

            if (stringName.equals("indirection.Transform[0]")) {
                gl4.glGetActiveUniformsiv(programName, 1, new int[]{i}, 0, GL_UNIFORM_ARRAY_STRIDE,
                        uniformArrayStrideInt, 0);
            }
        }

        if (validated) {

            gl4.glGenProgramPipelines(1, pipelineName, 0);
            gl4.glUseProgramStages(pipelineName[0], GL_VERTEX_SHADER_BIT | GL_FRAGMENT_SHADER_BIT, programName);
        }

        return validated & checkError(gl4, "initProgram");
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:47,代码来源:Gl_500_multi_draw_indirect_count_arb.java


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