@Override public void glPatchParameter(int count) { gl4.glPatchParameter(count); checkError(); }
@Override public int glGetProgramResourceIndex(int program, int programInterface, String name) { final int result = gl4.glGetProgramResourceIndex(program, programInterface, name); checkError(); return result; }
@Override public void glShaderStorageBlockBinding(int program, int storageBlockIndex, int storageBlockBinding) { gl4.glShaderStorageBlockBinding(program, storageBlockIndex, storageBlockBinding); checkError(); }
private void bindBuffer(final ShaderBufferBlock bufferBlock, final BufferObject bufferObject, final int shaderId, final BufferObject.BufferType bufferType) { switch (bufferType) { case UniformBufferObject: { final int blockIndex = gl3.glGetUniformBlockIndex(shaderId, bufferBlock.getName()); gl3.glBindBufferBase(GL3.GL_UNIFORM_BUFFER, bufferObject.getBinding(), bufferObject.getId()); gl3.glUniformBlockBinding(GL3.GL_UNIFORM_BUFFER, blockIndex, bufferObject.getBinding()); break; } case ShaderStorageBufferObject: { final int blockIndex = gl4.glGetProgramResourceIndex(shaderId, GL4.GL_SHADER_STORAGE_BLOCK, bufferBlock.getName()); gl4.glShaderStorageBlockBinding(shaderId, blockIndex, bufferObject.getBinding()); gl4.glBindBufferBase(GL4.GL_SHADER_STORAGE_BUFFER, bufferObject.getBinding(), bufferObject.getId()); break; } default: { throw new IllegalArgumentException("Doesn't support binding of " + bufferType); } } }
gl4.glBindBuffer(GL4.GL_SHADER_STORAGE_BUFFER, bufferId); gl4.glBufferData(GL4.GL_SHADER_STORAGE_BUFFER, data, GL4.GL_DYNAMIC_COPY); gl4.glBindBuffer(GL4.GL_SHADER_STORAGE_BUFFER, 0); break;
public void renderMesh(Mesh mesh, int lod, int count, VertexBuffer[] instanceData) { if (mesh.getVertexCount() == 0 || mesh.getTriangleCount() == 0 || count == 0) { return; } if (count > 1 && !caps.contains(Caps.MeshInstancing)) { throw new RendererException("Mesh instancing is not supported by the video hardware"); } if (mesh.getLineWidth() != 1f && context.lineWidth != mesh.getLineWidth()) { gl.glLineWidth(mesh.getLineWidth()); context.lineWidth = mesh.getLineWidth(); } if (gl4 != null && mesh.getMode().equals(Mode.Patch)) { gl4.glPatchParameter(mesh.getPatchVertexCount()); } statistics.onMeshDrawn(mesh, lod, count); // if (ctxCaps.GL_ARB_vertex_array_object){ // renderMeshVertexArray(mesh, lod, count); // }else{ renderMeshDefault(mesh, lod, count, instanceData); // } }
@Override public void glPatchParameter(int count) { gl4.glPatchParameter(count); checkError(); }
public void renderMesh(Mesh mesh, int lod, int count, VertexBuffer[] instanceData) { if (mesh.getVertexCount() == 0 || mesh.getTriangleCount() == 0 || count == 0) { return; } if (count > 1 && !caps.contains(Caps.MeshInstancing)) { throw new RendererException("Mesh instancing is not supported by the video hardware"); } if (mesh.getLineWidth() != 1f && context.lineWidth != mesh.getLineWidth()) { gl.glLineWidth(mesh.getLineWidth()); context.lineWidth = mesh.getLineWidth(); } if (gl4 != null && mesh.getMode().equals(Mode.Patch)) { gl4.glPatchParameter(mesh.getPatchVertexCount()); } statistics.onMeshDrawn(mesh, lod, count); // if (ctxCaps.GL_ARB_vertex_array_object){ // renderMeshVertexArray(mesh, lod, count); // }else{ renderMeshDefault(mesh, lod, count, instanceData); // } }