本文整理汇总了Java中com.jogamp.opengl.GL4.glBindBufferBase方法的典型用法代码示例。如果您正苦于以下问题:Java GL4.glBindBufferBase方法的具体用法?Java GL4.glBindBufferBase怎么用?Java GL4.glBindBufferBase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.jogamp.opengl.GL4
的用法示例。
在下文中一共展示了GL4.glBindBufferBase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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 mvp = projection.mul(viewMat4()).mul(new Mat4(1.0f));
uniformPointer.asFloatBuffer().put(mvp.toFa_());
}
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glActiveTexture(GL_TEXTURE0 + Semantic.Sampler.DIFFUSE);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindBufferBase(GL_SHADER_STORAGE_BUFFER, Semantic.Storage.VERTEX, bufferName.get(Buffer.VERTEX));
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
return true;
}
示例2: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufferName.get(Buffer.ATOMIC_COUNTER));
int[] data = {0};
IntBuffer dataBuffer = GLBuffers.newDirectIntBuffer(data);
gl4.glClearBufferSubData(GL_ATOMIC_COUNTER_BUFFER, GL_R8UI, 0, Integer.BYTES, GL_RGBA, GL_UNSIGNED_INT,
dataBuffer);
BufferUtils.destroyDirectBuffer(dataBuffer);
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBufferBase(GL_ATOMIC_COUNTER_BUFFER, 0, bufferName.get(Buffer.ATOMIC_COUNTER));
gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, 3, 1, 0);
return true;
}
示例3: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(
GL_UNIFORM_BUFFER, 0, 2 * 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 modelA = new Mat4(1.0f).translate(new Vec3(-1.1f, 0.0f, 0.0f));
Mat4 modelB = new Mat4(1.0f).translate(new Vec3(1.1f, 0.0f, 0.0f));
pointer.asFloatBuffer().put(projection.mul_(viewMat4()).mul(modelA).toFa_());
pointer.position(Mat4.SIZE);
pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(modelB).toFa_());
pointer.rewind();
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glViewport(0, 0, windowSize.x, windowSize.y);
float[] depth = new float[]{1.0f};
gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0);
gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0);
gl4.glUseProgram(programName);
gl4.glUniformBlockBinding(programName, uniformTransform, Semantic.Uniform.TRANSFORM0);
gl4.glUniformBlockBinding(programName, uniformMaterial, Semantic.Uniform.MATERIAL);
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.MATERIAL, bufferName.get(Buffer.MATERIAL));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 2);
return true;
}
示例4: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
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);
projection.mul(viewMat4()).mul(model).toDbb(pointer);
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
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));
// Bind rendering objects
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
return true;
}
示例5: 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;
}
示例6: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
// Update of the uniform buffer
{
ByteBuffer pointer = gl4.glMapNamedBufferRange(bufferName.get(Buffer.TRANSFORM),
0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f);
Mat4 model = new Mat4(1.0f);
pointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_());
// Make sure the uniform buffer is uploaded
gl4.glUnmapNamedBuffer(bufferName.get(Buffer.TRANSFORM));
}
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, clearColor);
int locationDiffuse = 0;
gl4.glProgramUniformHandleui64ARB(programName, locationDiffuse, textureHandle.get(0));
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
return true;
}
示例7: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, (float) windowSize.x, windowSize.y, 0.1f, 100.0f);
Mat4 model = new Mat4(1.0f);
uniformPointer.asFloatBuffer().put(projection.mul(viewMat4()).mul(model).toFa_());
}
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, black);
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 0, bufferName.get(Buffer.VERTEX));
gl4.glBindTextures(Semantic.Sampler.DIFFUSE, 1, textureName);
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName.get(Buffer.INDIRECT));
gl4.glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT, null, 1, DrawElementsIndirectCommand.SIZE);
return true;
}
示例8: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(
GL_UNIFORM_BUFFER, 0, Mat4.SIZE,
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_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.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, clearColor);
// Bind rendering objects
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
return true;
}
示例9: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(
GL_UNIFORM_BUFFER, 0, Mat4.SIZE,
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_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);
projection.mul(viewMat4()).mul(model).toDbb(pointer);
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glViewportIndexedf(0, 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.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT));
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT,
1 * Integer.BYTES, // indices offset
5, // instance count
2, // base vertex
5); // base instance
return true;
}
示例10: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(
GL_UNIFORM_BUFFER, 0, Mat4.SIZE,
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
Mat4 projection = glm.perspectiveFov_((float) Math.PI * 0.25f, windowSize.x, windowSize.y, 0.1f, 100.0f);
Mat4 model = new Mat4(1.0f);
projection.mul(viewMat4()).mul(model).toDbb(pointer);
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 0.5f).put(2, 0.0f).put(3, 1.0f));
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glDrawElementsInstancedBaseVertexBaseInstance(GL_TRIANGLES, elementCount, GL_UNSIGNED_SHORT, 0, 1, 0, 0);
return true;
}
示例11: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
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);
projection.mul(viewMat4()).mul(model).toDbb(pointer);
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glViewportIndexedf(0, 0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1.0f).put(1, 1.0f).put(2, 1.0f).put(3, 1.0f));
gl4.glUseProgram(programName);
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(0));
gl4.glBindSampler(0, samplerName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glDrawArraysInstancedBaseInstance(GL_TRIANGLES, 0, vertexCount, 15, 0);
return true;
}
示例12: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
float[] depth = {1.0f};
gl4.glClearBufferfv(GL_DEPTH, 0, depth, 0);
gl4.glClearBufferfv(GL_COLOR, 0, new float[]{1.0f, 1.0f, 1.0f, 1.0f}, 0);
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE * 3,
GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
Mat4 projection = glm.perspective_((float) Math.PI * 0.25f, windowSize.x / 3.0f / windowSize.y, 0.1f, 100.0f);
Mat4 view = viewMat4();
pointer.position(Mat4.SIZE * 0);
pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, +0.5f)).toFa_());
pointer.position(Mat4.SIZE * 1);
pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, +0.0f)).toFa_());
pointer.position(Mat4.SIZE * 2);
pointer.asFloatBuffer().put(projection.mul_(view).translate(new Vec3(0.0f, 0.0f, -0.5f)).toFa_());
pointer.rewind();
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.A));
gl4.glActiveTexture(GL_TEXTURE1);
gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.B));
gl4.glActiveTexture(GL_TEXTURE2);
gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.C));
gl4.glBindProgramPipeline(pipelineName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.INDIRECTION, bufferName.get(Buffer.VERTEX_INDIRECTION));
gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName.get(Buffer.INDIRECT));
validate(gl4);
// LongBuffer buffer = GLBuffers.newDirectLongBuffer(1);
for (int i = 0; i < indirectBufferCount; ++i) {
gl4.glViewportIndexedfv(0, viewport[i].toFloatArray(), 0);
// buffer.put(5 * Integer.BYTES * drawOffset[i]).rewind();
// buffer.asIntBuffer().put(0).rewind();
// buffer.rewind();
gl4.glMultiDrawElementsIndirect(GL_TRIANGLES, GL_UNSIGNED_SHORT,
null,
drawCount[i],
DrawElementsIndirectCommand.SIZE);
}
return true;
}
示例13: 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;
}
示例14: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
diffuseIndex++;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
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);
}
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.glUniform1ui(uniformDiffuseIndex, (diffuseIndex / 100) % 2);
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(Texture.RGB));
gl4.glBindSampler(0, samplerName.get(0));
gl4.glActiveTexture(GL_TEXTURE1);
gl4.glBindTexture(GL_TEXTURE_2D_ARRAY, textureName.get(Texture.BGR));
gl4.glBindSampler(1, samplerName.get(0));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glDrawElementsInstancedBaseVertex(GL_TRIANGLES, elementCount, GL_UNSIGNED_INT, 0, 2, 0);
return true;
}
示例15: render
import com.jogamp.opengl.GL4; //导入方法依赖的package包/类
@Override
protected boolean render(GL gl) {
GL4 gl4 = (GL4) gl;
{
gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM));
ByteBuffer pointer = gl4.glMapBufferRange(
GL_UNIFORM_BUFFER, 0, Transform.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, 1000.0f);
Mat4 view = viewMat4();
Mat4 model = new Mat4(1.0f);
Mat4 mvp = projection.mul(view).mul(model);
Mat4 mv = view.mul(model);
Transform transform = new Transform(mvp, mv, new Vec3(0.0f, 0.0f, -cameraDistance()));
mvp.toDbb(pointer, 0);
mv.toDbb(pointer, Mat4.SIZE);
transform.camera.toDbb(pointer, Mat4.SIZE * 2);
// Make sure the uniform buffer is uploaded
gl4.glUnmapBuffer(GL_UNIFORM_BUFFER);
}
gl4.glViewport(0, 0, windowSize.x, windowSize.y);
gl4.glClearBufferfv(GL_COLOR, 0, clearColor.put(0, 1).put(1, 1).put(2, 1).put(3, 1));
gl4.glUseProgram(programName);
gl4.glActiveTexture(GL_TEXTURE0);
gl4.glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY, textureName.get(0));
gl4.glBindSampler(0, samplerName.get(0));
gl4.glBindBufferBase(GL_UNIFORM_BUFFER, Semantic.Uniform.TRANSFORM0, bufferName.get(Buffer.TRANSFORM));
gl4.glBindVertexArray(vertexArrayName.get(0));
gl4.glDrawArraysInstanced(GL_TRIANGLES, 0, vertexCount, 1);
return true;
}