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


Java GL4.glDrawBuffers方法代码示例

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


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

示例1: initFramebuffer

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

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(0), 0, 0);
        gl4.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT1, textureName.get(0), 0, 1);
        gl4.glFramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT2, textureName.get(0), 0, 2);
        IntBuffer drawBuffers = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1,
            GL_COLOR_ATTACHMENT2});
        gl4.glDrawBuffers(3, drawBuffers);
        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

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

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

示例2: 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);

        IntBuffer drawBuffers = GLBuffers.newDirectIntBuffer(4);
        drawBuffers.put(0, GL_NONE);
        drawBuffers.put(1, GL_COLOR_ATTACHMENT0);
        drawBuffers.put(2, GL_COLOR_ATTACHMENT1);
        drawBuffers.put(3, GL_COLOR_ATTACHMENT2);

        gl4.glDrawBuffers(4, drawBuffers);

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

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

示例3: initFramebuffer

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

        IntBuffer buffers = GLBuffers.newDirectIntBuffer(new int[]{GL_COLOR_ATTACHMENT0});
        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureColorbufferName.get(0), 0);
        gl4.glDrawBuffers(1, buffers);
        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

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

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

示例4: initFramebuffer

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

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

        gl4.glGenFramebuffers(1, framebufferName);
        gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
        gl4.glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, textureName.get(0), 0);
        gl4.glDrawBuffers(1, buffersRender);
        if (!isFramebufferComplete(gl4, framebufferName.get(0))) {
            return false;
        }

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

        BufferUtils.destroyDirectBuffer(buffersRender);

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

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

示例6: setDrawBuffers

import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
public void setDrawBuffers(final GL4 gl) {
	final int attachments[] = new int[backingTextures.size()];
	for (int i = 0; i < backingTextures.size(); i++) {
		attachments[i] = GL4.GL_COLOR_ATTACHMENT0 + i;
	}

	gl.glBindFramebuffer(GL4.GL_DRAW_FRAMEBUFFER, getId());
	gl.glDrawBuffers(backingTextures.size(), attachments, 0);
}
 
开发者ID:ClearVolume,项目名称:ClearGL,代码行数:10,代码来源:GLFramebuffer.java

示例7: render

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

    GL4 gl4 = (GL4) gl;

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

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

    // Pass 1
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, framebufferName.get(0));
    int[] drawBuffers = {GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2};
    gl4.glDrawBuffers(3, drawBuffers, 0);

    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));

    // Pass 2
    gl4.glBindFramebuffer(GL_FRAMEBUFFER, 0);
    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.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.glActiveTexture(GL_TEXTURE0);
        gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(i));

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

    gl4.glUseProgram(0);

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


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