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


Java GL4.glEnable方法代码示例

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


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

示例1: renderFBO

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
private void renderFBO(GL4 gl4) {
    //glEnable(GL_SAMPLE_MASK);
    //glSampleMaski(0, 0xFF);

    gl4.glEnable(GL_MULTISAMPLE);
    gl4.glEnable(GL_SAMPLE_SHADING);
    gl4.glMinSampleShading(4 / 4.0f);

    gl4.glViewportIndexedf(0, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f));

    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
            uniformBlockSize);
    gl4.glBindSampler(0, samplerName.get(0));
    gl4.glBindTextureUnit(0, textureName.get(Texture.TEXTURE));
    gl4.glBindVertexArray(vertexArrayName.get(0));

    gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);

    gl4.glDisable(GL_MULTISAMPLE);
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:23,代码来源:Gl_430_direct_state_access_ext.java

示例2: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = true;

    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initVertexBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }

    gl4.glEnable(GL_DEPTH_TEST);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:22,代码来源:Gl_410_primitive_instanced.java

示例3: renderFBO

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

        gl4.glEnable(GL_MULTISAMPLE);
        gl4.glEnable(GL_SAMPLE_SHADING);
        gl4.glMinSampleShading(4 / 4.0f);

        gl4.glClipControl(GL_LOWER_LEFT, GL_NEGATIVE_ONE_TO_ONE);
        gl4.glViewportIndexedf(0, 0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y);

        gl4.glClearNamedFramebufferfv(framebufferName.get(Framebuffer.RENDER), GL_COLOR, 0, clearColor);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM), 0,
                uniformBlockSize);
        gl4.glBindSamplers(0, 1, samplerName);
        gl4.glBindTextureUnit(0, textureName.get(Texture.TEXTURE));
        gl4.glBindVertexArray(vertexArrayName.get(0));

        gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);

        gl4.glDisable(GL_MULTISAMPLE);
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:23,代码来源:Gl_450_direct_state_access.java

示例4: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = gl4.isExtensionAvailable("GL_ARB_derivative_control");

    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initTexture(gl4);
    }
    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }

    gl4.glEnable(GL_SAMPLE_SHADING);
    gl4.glMinSampleShading(0.0f);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:26,代码来源:Gl_450_texture_derivative.java

示例5: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = true;

    gl4.glEnable(GL_DEPTH_TEST);

    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }
    if (validated) {
        validated = initFeedback(gl4);
    }

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:25,代码来源:Gl_420_transform_feedback_instanced.java

示例6: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = true;

    if (validated) {
        validated = initTexture(gl4);
    }
    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }

    gl4.glEnable(GL_CLIP_DISTANCE0);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:25,代码来源:Gl_420_clipping.java

示例7: renderFramebuffer

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

        gl4.glEnable(GL_DEPTH_TEST);
        gl4.glDepthFunc(GL_LESS);

        gl4.glViewport(0, 0, windowSize.x, windowSize.y);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth);
        gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 1));

        gl4.glUseProgram(programName[Program.RENDER]);
        gl4.glUniform1i(uniformShadow, 0);
        gl4.glUniformBlockBinding(programName[Program.RENDER], uniformTransform[Program.RENDER],
                Semantic.Uniform.TRANSFORM0);

        gl4.glActiveTexture(GL_TEXTURE0);
        gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.SHADOWMAP));

        gl4.glBindVertexArray(vertexArrayName.get(Program.RENDER));
        gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);

        gl4.glDisable(GL_DEPTH_TEST);

        checkError(gl4, "renderFramebuffer");
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:27,代码来源:Gl_400_fbo_shadow.java

示例8: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = gl4.isExtensionAvailable("GL_ARB_multi_draw_indirect");

    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }
    if (validated) {
        validated = initTexture(gl4);
    }

    viewport[0] = new Vec4i((int) (windowSize.x / 3.0f * 0.0f), 0, windowSize.x / 3, windowSize.y);
    viewport[1] = new Vec4i((int) (windowSize.x / 3.0f * 1.0f), 0, windowSize.x / 3, windowSize.y);
    viewport[2] = new Vec4i((int) (windowSize.x / 3.0f * 2.0f), 0, windowSize.x / 3, windowSize.y);

    gl4.glEnable(GL_DEPTH_TEST);
    gl4.glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:30,代码来源:Gl_430_multi_draw_indirect.java

示例9: render

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {

    GL4 gl4 = (GL4) gl;

    gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
    gl4.glDrawBuffer(GL_BACK);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0.5f).put(2, 1).put(3, 1));

    // Renderer to image
    {
        gl4.glDrawBuffer(GL_NONE);

        gl4.glBindProgramPipeline(pipelineName.get(Pipeline.SAVE));
        gl4.glBindImageTexture(Semantic.Image.DIFFUSE, textureName.get(0), 0, false, 0, GL_WRITE_ONLY, GL_RGBA8);
        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0);
    }

    // Read from image
    {
        int border = 8;
        gl4.glEnable(GL_SCISSOR_TEST);
        gl4.glScissorIndexed(0, border, border, (windowSize.x - 2) * border, (windowSize.y - 2) * border);

        gl4.glDrawBuffer(GL_BACK);

        gl4.glBindProgramPipeline(pipelineName.get(Pipeline.READ));
        gl4.glBindImageTexture(Semantic.Image.DIFFUSE, textureName.get(0), 0, false, 0, GL_READ_ONLY, GL_RGBA8);
        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0);

        gl4.glDisable(GL_SCISSOR_TEST);
    }

    return true;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:38,代码来源:Gl_420_image_store.java

示例10: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = true;
    validated = validated && gl4.isExtensionAvailable("GL_ARB_indirect_parameters");

    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }
    if (validated) {
        validated = initTexture(gl4);
    }

    Caps caps = new Caps(gl4, Profile.CORE);

    viewport[0] = new Vec4(windowSize.x / 3.0f * 0.0f, 0, windowSize.x / 3, windowSize.y);
    viewport[1] = new Vec4(windowSize.x / 3.0f * 1.0f, 0, windowSize.x / 3, windowSize.y);
    viewport[2] = new Vec4(windowSize.x / 3.0f * 2.0f, 0, windowSize.x / 3, windowSize.y);

    gl4.glEnable(GL_DEPTH_TEST);
    gl4.glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:33,代码来源:Gl_500_multi_draw_indirect_arb.java

示例11: begin

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean begin(GL gl) {

    GL4 gl4 = (GL4) gl;

    boolean validated = true;
    validated = validated && gl4.isExtensionAvailable("GL_ARB_multi_draw_indirect");
    validated = validated && gl4.isExtensionAvailable("GL_ARB_shader_draw_parameters");
    validated = validated && gl4.isExtensionAvailable("GL_ARB_shader_storage_buffer_object");
    validated = validated && gl4.isExtensionAvailable("GL_ARB_buffer_storage");

    if (validated) {
        validated = initProgram(gl4);
    }
    if (validated) {
        validated = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }
    if (validated) {
        validated = initTexture(gl4);
    }

    viewport[0] = new Vec4(windowSize.x / 3.0f * 0.0f, 0, (float) windowSize.x / 3, windowSize.y);
    viewport[1] = new Vec4(windowSize.x / 3.0f * 1.0f, 0, (float) windowSize.x / 3, windowSize.y);
    viewport[2] = new Vec4(windowSize.x / 3.0f * 2.0f, 0, (float) windowSize.x / 3, windowSize.y);

    gl4.glEnable(GL_DEPTH_TEST);
    gl4.glProvokingVertex(GL_FIRST_VERTEX_CONVENTION);

    return validated;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:34,代码来源:Gl_440_multi_draw_indirect_id_arb.java

示例12: resolveMultisampling

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

        gl4.glViewport(0, 0, windowSize.x, windowSize.y);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

        textureName.position(Texture.MULTISAMPLE_COLORBUFFER);
        gl4.glBindTextures(0, 1, textureName);
        textureName.rewind();
        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glBindBufferRange(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM),
                uniformBlockSize, uniformBlockSize);

        gl4.glEnable(GL_SCISSOR_TEST);

        // Box
        {
            gl4.glScissor(1, 1, windowSize.x / 2 - 2, windowSize.y - 2);

            gl4.glBindProgramPipeline(pipelineName.get(Program.RESOLVE_BOX));
            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 5);
        }

        // Near
        {
            gl4.glScissor(windowSize.x / 2 + 1, 1, windowSize.x / 2 - 2, windowSize.y - 2);

            gl4.glBindProgramPipeline(pipelineName.get(Program.RESOLVE_NEAR));
            gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 5);
        }

        gl4.glDisable(GL_SCISSOR_TEST);
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:33,代码来源:Gl_450_fbo_multisample_explicit.java

示例13: render

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {

    GL4 gl4 = (GL4) gl;

    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
    gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 0.5f, 0.0f, 1.0f}, 0);

    gl4.glUseProgram(programName);
    gl4.glUniform1i(uniformDiffuse, 0);

    // Pass 1, render the scene in a multisampled framebuffer
    gl4.glEnable(GL_MULTISAMPLE);
    gl4.glEnable(GL_SAMPLE_SHADING);
    gl4.glMinSampleShading(4 / 2.0f);

    float[] min = {0};
    gl4.glGetFloatv(GL_MIN_SAMPLE_SHADING_VALUE, min, 0);
    //glEnable(GL_SAMPLE_MASK);
    //glSampleMaski(0, 0xFF);
    renderFBO(gl4, framebufferName.get(Framebuffer.RENDER));
    gl4.glDisable(GL_MULTISAMPLE);

    // Resolved multisampling
    gl4.glBindFramebuffer(GL_READ_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
    gl4.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, framebufferName.get(Framebuffer.RESOLVE));
    gl4.glBlitFramebuffer(
            0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
            0, 0, FRAMEBUFFER_SIZE.x, FRAMEBUFFER_SIZE.y,
            GL_COLOR_BUFFER_BIT, GL_NEAREST);
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

    // Pass 2, render the colorbuffer from the multisampled framebuffer
    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    renderFB(gl4, textureName.get(Texture.COLOR));

    return true;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:39,代码来源:Gl_400_fbo_multisample.java

示例14: render

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public void render(GL4 gl4, Application app, int eye) {

        gl4.glClearBufferfv(GL_COLOR, 0, app.clearColor);
        gl4.glClearBufferfv(GL_DEPTH, 0, app.clearDepth);

        gl4.glEnable(GL_DEPTH_TEST);

        if (app.showCubes) {

            gl4.glUseProgram(program.name);

            gl4.glUniformMatrix4fv(program.matrixUL, 1, false, app.matBuffer);

            gl4.glBindVertexArray(vertexArrayName.get(0));

            gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.MY_TEXTURE);
            gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0));

            gl4.glDrawArrays(GL_TRIANGLES, 0, vertexCount);

            gl4.glBindVertexArray(0);
        }
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-hello-vr,代码行数:24,代码来源:Scene.java

示例15: initGL

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

        if (debugOpenGL) {

            gl4.glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, null, true);
            gl4.glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
        }

        setupScene(gl4); // setupTextureMaps() inside
        setupCameras();
        setupStereoRenderTargets(gl4);
        setupDistortion(gl4);

        setupRenderModels(gl4);

        axisLineControllers = new AxisLineControllers(gl4);

        IntStreamEx.range(mat4DevicePose.length).forEach(mat -> mat4DevicePose[mat] = new Mat4());

        return true;
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-hello-vr,代码行数:22,代码来源:Application.java


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