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


Java GL4.glUniformMatrix4fv方法代码示例

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


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

示例1: renderFBO

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

        Mat4 perspective = glm.perspective_((float) Math.PI * 0.25f, (float) FRAMEBUFFER_SIZE.x / FRAMEBUFFER_SIZE.y,
                0.1f, 100.0f);
        Mat4 model = new Mat4(1.0f).scale(new Vec3(1, -1, 1));
        Mat4 mvp = perspective.mul(viewMat4()).mul(model);

        gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);

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

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

        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:20,代码来源:Gl_400_fbo_multisample.java

示例2: render

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

    GL4 gl4 = (GL4) gl;

    gl4.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

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

    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 0));

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glPatchParameteri(GL_PATCH_VERTICES, vertexCount);
    gl4.glPatchParameterfv(GL_PATCH_DEFAULT_INNER_LEVEL, patch.put(0, 16).put(1, 16));
    gl4.glPatchParameterfv(GL_PATCH_DEFAULT_OUTER_LEVEL, patch.put(0, 16).put(1, 16).put(2, 16).put(3, 16));
    gl4.glDrawArraysInstanced(GL_PATCHES, 0, vertexCount, 1);

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

示例3: 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);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

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

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

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform4f(uniformDiffuse, 1.0f, 0.5f, 0.0f, 1.0f);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);

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

示例4: 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, 1000.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

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

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform1i(uniformDiffuse, 0);

    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0));
    gl4.glBindSampler(0, samplerName.get(0));

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);

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

示例5: render

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

        if (app.hmd.IsInputFocusCapturedByAnotherProcess.apply() == 0) {

            gl4.glUseProgram(program.name);
            gl4.glUniformMatrix4fv(program.matrixUL, 1, false, app.matBuffer);
            gl4.glBindVertexArray(vertexArrayName.get(0));
            gl4.glDrawArrays(GL_LINES, 0, vertCount);
            gl4.glBindVertexArray(0);
        }
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-hello-vr,代码行数:12,代码来源:AxisLineControllers.java

示例6: render

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

        // ----- Render Model rendering -----                
        gl4.glUseProgram(program.name);

        for (int trackedDevice = 0; trackedDevice < VR.k_unMaxTrackedDeviceCount; trackedDevice++) {
            if (app.rbShowTrackedDevice[trackedDevice] == false) {
                continue;
            }
            if (trackedDeviceToRenderModel[trackedDevice] == null || !showTrackedDevice[trackedDevice]) {
                continue;
            }

            TrackedDevicePose_t pose = app.trackedDevicePose[trackedDevice];
            if (pose.bPoseIsValid == 0) {
                continue;
            }

            if (app.hmd.IsInputFocusCapturedByAnotherProcess.apply() == 1 && app.hmd.GetTrackedDeviceClass.apply(trackedDevice)
                    == VR.ETrackedDeviceClass.TrackedDeviceClass_Controller) {
                continue;
            }

            Mat4 matDeviceToTracking = app.mat4DevicePose[trackedDevice];
            app.vp.mul_(matDeviceToTracking).toDfb(app.matBuffer);

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

            trackedDeviceToRenderModel[trackedDevice].render(gl4);
        }
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-hello-vr,代码行数:32,代码来源:ModelsRender.java

示例7: renderFB

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

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

        gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);

        gl4.glActiveTexture(GL_TEXTURE0);
        gl4.glBindTexture(GL_TEXTURE_2D, texture2dName);

        gl4.glBindVertexArray(vertexArrayName.get(0));
        gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0);
    }
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:15,代码来源:Gl_400_fbo_multisample.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, (float) windowSize.x / windowSize.y, 0.1f, 100.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

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

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

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

    gl4.glActiveTexture(GL_TEXTURE1);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DXT1));

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform1i(uniformRGB8, 0);
    gl4.glUniform1i(uniformDXT1, 1);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));

    gl4.glUniform1f(uniformDisplacement, 1.1f);
    subroutineId.position(Subroutine.DXT1);
    gl4.glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, subroutineId);
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 1, 0);

    gl4.glUniform1f(uniformDisplacement, -1.1f);
    subroutineId.position(Subroutine.DXT1);
    gl4.glUniformSubroutinesuiv(GL_FRAGMENT_SHADER, 1, subroutineId);
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 1, 0);

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

示例9: 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, windowSize.x * 0.5f / windowSize.y, 0.1f, 100.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 1));

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));

    gl4.glViewport(0, 0, (int) (windowSize.x * 0.5f), windowSize.y);
    gl4.glUseProgram(programName[Program.TESS]);
    gl4.glUniformMatrix4fv(uniformMvp[Program.TESS], 1, false, mvp.toFa_(), 0);

    gl4.glPatchParameteri(GL_PATCH_VERTICES, vertexCount);
    gl4.glDrawArraysInstanced(GL_PATCHES, 0, vertexCount, 1);

    gl4.glViewport((int) (windowSize.x * 0.5f), 0, (int) (windowSize.x * 0.5f), windowSize.y);
    gl4.glUseProgram(programName[Program.SMOOTH]);
    gl4.glUniformMatrix4fv(uniformMvp[Program.SMOOTH], 1, false, mvp.toFa_(), 0);

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

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

示例10: 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);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

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

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

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform1i(uniformDisplacement, 0);
    gl4.glUniform1i(uniformDiffuse, 1);

    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.DISPLACEMENT));

    gl4.glActiveTexture(GL_TEXTURE1);
    gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.DIFFUSE));

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 5, 0);

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

示例11: 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.glViewport(0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 0));

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform4f(uniformDiffuse, 1.0f, 0.5f, 0.0f, 1.0f);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName.get(Buffer.INDIRECT));

    if (useIndirect) {
        gl4.glDrawElementsIndirect(
                GL_TRIANGLES,
                GL_UNSIGNED_INT,
                0);
    } else {
        gl4.glDrawElementsInstancedBaseVertexBaseInstance(
                GL_TRIANGLES,
                command.count,
                GL_UNSIGNED_INT,
                command.firstIndex,
                command.primCount,
                command.baseVertex,
                command.reservedMustBeZero);
    }

    return true;
}
 
开发者ID:java-opengl-labs,项目名称:jogl-samples,代码行数:38,代码来源:Gl_400_draw_indirect.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, 1000.0f);
    Mat4 model = new Mat4(1.0f);
    Mat4 mvp = projection.mul(viewMat4()).mul(model);

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

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);
    gl4.glUniform1i(uniformDiffuseRGB, 0);
    gl4.glUniform1i(uniformDiffuseBGR, 1);

    gl4.glActiveTexture(GL_TEXTURE0);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.RGB));
    gl4.glBindSampler(0, samplerName.get(0));

    gl4.glActiveTexture(GL_TEXTURE1);
    gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.BGR));
    gl4.glBindSampler(1, samplerName.get(0));

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 1, 0);

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

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

示例14: render

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

    GL4 gl4 = (GL4) gl;

    gl4.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

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

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

    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 0));

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glPatchParameteri(GL_PATCH_VERTICES, vertexCount);
    gl4.glDrawArraysInstanced(GL_PATCHES, 0, vertexCount, 1);

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

示例15: render

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

    GL4 gl4 = (GL4) gl;

    gl4.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

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

    gl4.glViewport(0, 0, windowSize.x, windowSize.y);
    gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 0).put(1, 0).put(2, 0).put(3, 0));

    gl4.glUseProgram(programName);
    gl4.glUniformMatrix4fv(uniformMvp, 1, false, mvp.toFa_(), 0);

    gl4.glBindVertexArray(vertexArrayName.get(0));
    gl4.glPatchParameteri(GL_PATCH_VERTICES, vertexCount);

    gl4.glDrawArraysInstanced(GL_PATCHES, 0, vertexCount, 1);

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


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