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


Java GL4.glBindFramebuffer方法代码示例

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


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

示例1: 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 = initBuffer(gl4);
    }
    if (validated) {
        validated = initVertexArray(gl4);
    }

    gl4.glEnable(GL_DEPTH_TEST);
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
    gl4.glDrawBuffer(GL_BACK);
    if (!isFramebufferComplete(gl, 0)) {
        return false;
    }

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

示例2: initFramebuffer

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

        gl4.glGenFramebuffers(Framebuffer.MAX, framebufferName);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.MULTISAMPLE));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.MULTISAMPLE), 0);
        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.MULTISAMPLE))) {
            return false;
        }
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.COLOR));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.COLOR), 0);
        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.COLOR))) {
            return false;
        }
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

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

示例3: initFramebuffer

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

        boolean validated = true;

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_WIDTH, windowSize.x);
        gl4.glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_HEIGHT, windowSize.y);
        gl4.glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_LAYERS, 1);
        gl4.glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_SAMPLES, 1);
        gl4.glFramebufferParameteri(GL_FRAMEBUFFER, GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS, GL_TRUE);
        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        return validated;
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:19,代码来源:Gl_430_fbo_without_attachment.java

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

示例5: initFramebuffer

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

        gl4.glGenFramebuffers(Framebuffer.MAX, framebufferName);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RENDER));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.MULTISAMPLE_COLORBUFFER), 0);
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, textureName.get(Texture.MULTISAMPLE_DEPTHBUFFER), 0);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.RESOLVE));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.COLORBUFFER), 0);

        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.RENDER))) {
            return false;
        }
        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.RESOLVE))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

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

示例6: FramebufferDesc

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public FramebufferDesc(GL4 gl4, Vec2i size) {

        gl4.glGenFramebuffers(Target.MAX, framebufferName);
        gl4.glGenRenderbuffers(1, depthBufferName);
        gl4.glGenTextures(Target.MAX, textureName);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Target.RENDER));

        gl4.glBindRenderbuffer(GL_RENDERBUFFER, depthBufferName.get(0));
        gl4.glRenderbufferStorageMultisample(GL_RENDERBUFFER, 4, GL_DEPTH_COMPONENT, size.x, size.y);
        gl4.glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBufferName.get(0));

        gl4.glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, textureName.get(Target.RENDER));
        gl4.glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, size.x, size.y, true);
        gl4.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D_MULTISAMPLE,
                textureName.get(Target.RENDER), 0);

        if (!checkFramebufferStatus(gl4)) {
            return;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Target.RESOLVE));

        gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Target.RESOLVE));
        gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
        gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
        gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0);
        gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
        gl4.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, size.x, size.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, null);
        gl4.glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 
                textureName.get(Target.RESOLVE), 0);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

        if (!checkFramebufferStatus(gl4)) {
            return;
        }

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

示例7: 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.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindSampler(0, samplerName.get(0));

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

    gl4.glBindProgramPipeline(pipelineName.get(Pipeline.RENDER));
    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DIFFUSE));
    gl4.glBindImageTexture(Semantic.Image.DIFFUSE, textureName.get(Texture.COLORBUFFER), 0, false, 0, GL_WRITE_ONLY,
            GL_RGBA8);

    gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0);

    // Splash
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);

    gl4.glBindProgramPipeline(pipelineName.get(Pipeline.SPLASH));
    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.COLORBUFFER));

    gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0);

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

示例8: initFramebuffer

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

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.COLORBUFFER), 0);
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, textureName.get(Texture.RENDERBUFFER), 0);

        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        return true;
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:15,代码来源:Gl_430_fbo_srgb_decode.java

示例9: initFramebuffer

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

        boolean validated = true;

        IntBuffer buffersRender = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0});

        gl4.glGenFramebuffers(Framebuffer.MAX, framebufferName);

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.FRAMEBUFFER));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.COLORBUFFER), 0);
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, textureName.get(Texture.RENDERBUFFER), 0);
        gl4.glDrawBuffers(1, buffersRender);
        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.FRAMEBUFFER))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(Framebuffer.SHADOW));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, textureName.get(Texture.SHADOWMAP), 0);
        gl4.glDrawBuffer(GL_NONE);
        if (!isFramebufferComplete(gl4, framebufferName.get(Framebuffer.SHADOW))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        gl4.glDrawBuffer(GL_BACK);
        if (!isFramebufferComplete(gl4, 0)) {
            return false;
        }

        BufferUtils.destroyDirectBuffer(buffersRender);

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

示例10: initFramebuffer

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

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.R), 0);
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, textureName.get(Texture.G), 0);
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, textureName.get(Texture.B), 0);

        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        return checkError(gl4, "initFramebuffer");
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:16,代码来源:Gl_400_fbo_rtt.java

示例11: render

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

    GL4 gl4 = (GL4) gl;

    Vec2i framebufferSize = new Vec2i(windowSize.x / FRAMEBUFFER_SIZE, windowSize.y / FRAMEBUFFER_SIZE);

    // Pass 1
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
    gl4.glViewport(0, 0, framebufferSize.x, framebufferSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 0).put(2, 0).put(3, 1));
    gl4.glClearBufferfv(GL_COLOR, 1, clearColor.put(0, 0).put(1, 1).put(2, 0).put(3, 1));
    gl4.glClearBufferfv(GL_COLOR, 2, clearColor.put(0, 0).put(1, 0).put(2, 1).put(3, 1));
    gl4.glClearBufferfv(GL_COLOR, 3, clearColor.put(0, 1).put(1, 1).put(2, 0).put(3, 1));

    // Pass 2
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, .5f).put(2, 0).put(3, 1));

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

    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
    gl4.glBindVertexArray(vertexArrayName.get(0));

    for (int i = 0; i < Texture.MAX; ++i) {
        gl4.glViewport((int) viewport[i].x, (int) viewport[i].y, (int) viewport[i].z, (int) viewport[i].w);
        gl4.glUniform1i(uniformLayer, i);

        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    }

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

示例12: render

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

    GL4 gl4 = (GL4) gl;

    {
        Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y,
                0.1f, 100.0f);
        viewMat4().print("view");
        uniformPointer.asFloatBuffer().put(viewMat4().toFa_());
        //uniformPointer.asFloatBuffer().put(new Mat4().toFa_());
    }

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


    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);        
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor);
    
    gl4.glBindBufferRange(GL_UNIFORM_BUFFER, 
            Semantic.Uniform.TRANSFORM0, 
            bufferName.get(Buffer.TRANSFORM), 
            0,
            Mat4.SIZE);
    
    gl4.glBindVertexArray(vertexArrayName.get(0));

    gl4.glDrawArrays(GL_TRIANGLES, 0, 3);

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

示例13: destroy

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public void destroy(GL4 gl) {
	gl.glDeleteFramebuffers(1, framebufferId, 0);
	gl.glBindFramebuffer(GL4.GL_FRAMEBUFFER, 0);

	for (GLTexture bt : backingTextures.values()) {
		bt.delete();
	}

	for (GLTexture dt : depthBuffers.values()) {
		dt.delete();
	}

	backingTextures.clear();
	depthBuffers.clear();
}
 
开发者ID:ClearVolume,项目名称:ClearGL,代码行数:16,代码来源:GLFramebuffer.java

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

示例15: initFramebuffer

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

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(Texture.COLORBUFFER), 0);
        gl4.glDrawBuffer(GL_COLOR_ATTACHMENT0);

        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

        gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
        return true;
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:15,代码来源:Gl_420_sampler_fetch.java


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