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


Java GL4.glBindTransformFeedback方法代码示例

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


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

示例1: initFeedback

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

        gl4.glGenTransformFeedbacks(1, feedbackName);
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
        gl4.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufferName.get(Buffer.FEEDBACK));
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

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

示例2: initFeedback

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

        // Generate a buffer object
        gl4.glGenTransformFeedbacks(1, feedbackName);
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
        gl4.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufferName.get(Buffer.FEEDBACK));
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

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

示例3: initFeedback

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

        // Generate a buffer object
        gl4.glGenTransformFeedbacks(1, feedbackName);
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
        gl4.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufferName.get(Buffer.FEEDBACK_VERTEX));
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

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

示例4: initFeedback

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

        gl4.glGenTransformFeedbacks(1, feedbackName, 0);
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName[0]);
        gl4.glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, bufferName[Buffer.FEEDBACK]);
        gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

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

示例5: render

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

    GL4 gl4 = (GL4) gl;

    {
        Mat4 model = new Mat4(1.0f);
        Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
        Mat4 mvp = projection.mul(viewMat4()).mul(model);

        uniformPointer.asFloatBuffer().put(mvp.toFa_());
    }

    // Set the display viewport
    gl4.glViewportIndexedf(0, 0.0f, 0.0f, windowSize.x, windowSize.y);

    // Clear color buffer
    gl4.glClearBufferfv(GL_COLOR, 0, new float[]{0.0f, 0.0f, 0.0f, 1.0f}, 0);

    // First draw, capture the attributes
    // Disable rasterisation, vertices processing only!
    gl4.glEnable(GL_RASTERIZER_DISCARD);

    gl4.glBindProgramPipeline(pipelineName.get(Program.TRANSFORM));
    gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
    gl4.glBindVertexArray(vertexArrayName.get(Program.TRANSFORM));
    gl4.glBindVertexBuffer(Semantic.Buffer.STATIC, bufferName.get(Buffer.VERTEX), 0, Vec4.SIZE);

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));

    gl4.glBeginQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, 0, queryName.get(0));
    gl4.glBeginTransformFeedback(GL_TRIANGLES);
    {
        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    }
    gl4.glEndTransformFeedback();
    gl4.glEndQueryIndexed(GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB, 0);

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

    gl4.glDisable(GL_RASTERIZER_DISCARD);

    IntBuffer streamOverflow = GLBuffers.newDirectIntBuffer(1);
    gl4.glGetQueryObjectuiv(queryName.get(0), GL_QUERY_RESULT, streamOverflow);

    if (streamOverflow.get(0) == 0) {

        // Second draw, reuse the captured attributes
        gl4.glBindProgramPipeline(pipelineName.get(Program.FEEDBACK));
        gl4.glBindVertexArray(vertexArrayName.get(Program.FEEDBACK));
        gl4.glBindVertexBuffer(Semantic.Buffer.STATIC, bufferName.get(Buffer.FEEDBACK), 0, glf.Vertex_v4fc4f.SIZE);

        gl4.glDrawTransformFeedback(GL_TRIANGLES, feedbackName.get(0));
    }
    BufferUtils.destroyDirectBuffer(streamOverflow);
    
    return true;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:59,代码来源:Gl_450_transform_feedback_arb.java

示例6: render

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

    GL4 gl4 = (GL4) gl;

    // Compute the MVP (Model View Projection matrix)
    {
        gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM0));
        ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0,
                Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);

        Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
        Mat4 model = new Mat4(1.0f);

        pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_());

        gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
    }

    // Set the display viewport
    gl4.glViewport(0, 0, windowSize.x, windowSize.y);

    // Clear color buffer
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 1));

    // First draw, capture the attributes
    // Disable rasterisation, vertices processing only!
    gl4.glEnable(GL_RASTERIZER_DISCARD);

    gl4.glUseProgram(transformProgramName);

    gl4.glBindVertexArray(vertexArrayName.get(VertexArray.TRANSFORM_FEEDBACK));
    gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM0));

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
    gl4.glBeginTransformFeedback(GL_TRIANGLES);
    gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    gl4.glEndTransformFeedback();
    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

    gl4.glDisable(GL_RASTERIZER_DISCARD);

    // Second draw, reuse the captured attributes
    gl4.glUseProgram(feedbackProgramName);

    gl4.glBindVertexArray(vertexArrayName.get(VertexArray.FEEDBACK));
    gl4.glDrawTransformFeedback(GL_TRIANGLES, feedbackName.get(0));

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

示例7: render

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

    GL4 gl4 = (GL4) gl;

    // Compute the MVP (Model View Projection matrix)
    Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

    // Set the display viewport
    gl4.glViewport(0, 0, windowSize.x, windowSize.y);

    // Clear color buffer
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 1));

    // First draw, capture the attributes
    // Disable rasterisation, vertices processing only!
    gl4.glEnable(GL_RASTERIZER_DISCARD);

    gl4.glUseProgram(transformProgramName);
    gl4.glUniformMatrix4fv(transformUniformMvp, 1, false, mvp.toFa_(), 0);

    gl4.glBindVertexArray(vertexArrayName.get(VertexArray.TRANSFORM_FEEDBACK));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.TRANSFORM_ELEMENT));

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
    gl4.glBeginTransformFeedback(GL_TRIANGLES);
    {
        gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 1, 0);
    }
    gl4.glEndTransformFeedback();
    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

    gl4.glDisable(GL_RASTERIZER_DISCARD);

    // Second draw, reuse the captured attributes
    gl4.glUseProgram(feedbackProgramName);

    gl4.glBindVertexArray(vertexArrayName.get(VertexArray.FEEDBACK));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
    gl4.glDrawTransformFeedbackStream(GL_TRIANGLES, feedbackName.get(0), 0);

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

示例8: 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, 4.0f / 3.0f, 0.1f, 100.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

    gl4.glProgramUniformMatrix4fv(programName[Pipeline.TRANSFORM], transformUniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glProgramUniformMatrix4fv(programName[Pipeline.FEEDBACK], feedbackUniformMvp, 1, false, mvp.toFa_(), 0);

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

    gl4.glClearBufferfv(GL_DEPTH, 0, clearDepth.put(0, 1.0f));
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0.0f).put(1, 0.0f).put(2, 0.0f).put(3, 1.0f));

    // First draw, capture the attributes
    // Disable rasterisation, vertices processing only!
    gl4.glEnable(GL_RASTERIZER_DISCARD);

    gl4.glBindProgramPipeline(pipelineName.get(Pipeline.TRANSFORM));
    gl4.glBindVertexArray(vertexArrayName.get(Pipeline.TRANSFORM));

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName.get(0));
    gl4.glBeginTransformFeedback(GL_TRIANGLES);
    {
        gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 1, 0);
    }
    gl4.glEndTransformFeedback();

    gl4.glDisable(GL_RASTERIZER_DISCARD);

    // Second draw, reuse the captured attributes
    gl4.glBindProgramPipeline(pipelineName.get(Pipeline.FEEDBACK));
    gl4.glBindVertexArray(vertexArrayName.get(Pipeline.FEEDBACK));

    gl4.glDrawTransformFeedbackStreamInstanced(GL_TRIANGLE_STRIP, feedbackName.get(0), 0, 5);

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

示例9: render

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

    GL4 gl4 = (GL4) gl;

    {
        Mat4 model = new Mat4(1.0f);
        Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
        Mat4 mvp = projection.mul(viewMat4()).mul(model);

        uniformPointer.asFloatBuffer().put(mvp.toFa_());
    }

    // Set the display viewport
    gl4.glViewportIndexedf(0, 0.0f, 0.0f, windowSize.x, windowSize.y);

    // Clear color buffer
    gl4.glClearBufferfv(GL_COLOR, 0, new float[]{0.0f, 0.0f, 0.0f, 1.0f}, 0);

    // First draw, capture the attributes
    // Disable rasterisation, vertices processing only!
    gl4.glEnable(GL_RASTERIZER_DISCARD);

    gl4.glBindProgramPipeline(pipelineName[Program.TRANSFORM]);
    gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName[Buffer.TRANSFORM]);
    gl4.glBindVertexArray(vertexArrayName[Program.TRANSFORM]);
    gl4.glBindVertexBuffer(Semantic.Buffer.STATIC, bufferName[Buffer.VERTEX], 0, Vec4.SIZE);

    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, feedbackName[0]);
    gl4.glBeginTransformFeedback(GL_TRIANGLES);
    {
        gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
    }
    gl4.glEndTransformFeedback();
    gl4.glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);

    gl4.glDisable(GL_RASTERIZER_DISCARD);

    // Second draw, reuse the captured attributes
    gl4.glBindProgramPipeline(pipelineName[Program.FEEDBACK]);
    gl4.glBindVertexArray(vertexArrayName[Program.FEEDBACK]);
    gl4.glBindVertexBuffer(Semantic.Buffer.STATIC, bufferName[Buffer.FEEDBACK], 0, glf.Vertex_v4fc4f.SIZE);

    gl4.glDrawTransformFeedback(GL_TRIANGLES, feedbackName[0]);

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


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