Java Code Examples for com.jogamp.opengl.GL4#glGetIntegerv()
The following examples show how to use
com.jogamp.opengl.GL4#glGetIntegerv() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Gl_440_atomic_counter.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL4 gl4) { boolean validated = true; int[] maxVertexAtomicCounterBuffers = {0}; int[] maxControlAtomicCounterBuffers = {0}; int[] maxEvaluationAtomicCounterBuffers = {0}; int[] maxGeometryAtomicCounterBuffers = {0}; int[] maxFragmentAtomicCounterBuffers = {0}; int[] maxCombinedAtomicCounterBuffers = {0}; gl4.glGetIntegerv(GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS, maxVertexAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS, maxControlAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS, maxEvaluationAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, maxGeometryAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS, maxFragmentAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS, maxCombinedAtomicCounterBuffers, 0); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufferName.get(Buffer.ATOMIC_COUNTER)); gl4.glBufferStorage(GL_ATOMIC_COUNTER_BUFFER, Integer.BYTES, null, GL_MAP_WRITE_BIT); gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0); return validated; }
Example 2
Source File: Gl_430_texture_buffer.java From jogl-samples with MIT License | 6 votes |
private boolean initTexture(GL4 gl4) { int[] textureBufferOffsetAlignment = {0}; gl4.glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, textureBufferOffsetAlignment, 0); gl4.glGenTextures(Texture.MAX, textureName); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.DISPLACEMENT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGB32F, bufferName.get(Buffer.DISPLACEMENT), textureBufferOffsetAlignment[0], Vec3.SIZE * 5); gl4.glBindTexture(GL_TEXTURE_BUFFER, 0); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.DIFFUSE)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGB32F, bufferName.get(Buffer.DIFFUSE), textureBufferOffsetAlignment[0], Vec3.SIZE * 5); gl4.glBindTexture(GL_TEXTURE_BUFFER, 0); return true; }
Example 3
Source File: Gl_430_draw_without_vertex_attrib.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL4 gl4) { FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferData(GL_SHADER_STORAGE_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); BufferUtils.destroyDirectBuffer(vertexBuffer); BufferUtils.destroyDirectBuffer(uniformBufferOffset); return true; }
Example 4
Source File: Gl_430_query_occlusion.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL4 gl4) { gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData); gl4.glBufferData(GL_ARRAY_BUFFER, positionSize, positionBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(positionBuffer); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); return true; }
Example 5
Source File: Gl_450_texture_derivative.java From jogl-samples with MIT License | 6 votes |
private boolean initBuffer(GL4 gl4) { gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(elementBuffer); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(vertexBuffer); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); return true; }
Example 6
Source File: Gl_430_draw_vertex_attrib_binding.java From jogl-samples with MIT License | 5 votes |
private boolean initBuffer(GL4 gl4) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); boolean validated = true; gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(vertexBuffer); BufferUtils.destroyDirectBuffer(uniformBufferOffset); return validated; }
Example 7
Source File: Gl_420_interface_matching.java From jogl-samples with MIT License | 5 votes |
private boolean initMax(GL4 gl4) { final int maxVertexAttribs = 0, maxVertexOutput = 1, maxControlInput = 2, maxControlOutput = 3, maxControlTotalOutput = 4, maxEvaluationInput = 5, maxEvaluationOutput = 6, maxGeometryInput = 7, maxGeometryOutput = 8, maxFragmentInput = 9, max = 10; IntBuffer data = GLBuffers.newDirectIntBuffer(max); data.position(maxVertexAttribs); gl4.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, data); //GL_MAX_DRAW_BUFFERS 8 //GL_MAX_COLOR_ATTACHMENTS 8 data.position(maxVertexOutput); gl4.glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, data); data.position(maxControlInput); gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_INPUT_COMPONENTS, data); data.position(maxControlOutput); gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS, data); data.position(maxControlTotalOutput); gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS, data); data.position(maxEvaluationInput); gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS, data); data.position(maxEvaluationOutput); gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS, data); data.position(maxGeometryInput); gl4.glGetIntegerv(GL_MAX_GEOMETRY_INPUT_COMPONENTS, data); data.position(maxGeometryOutput); gl4.glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, data); data.position(maxFragmentInput); gl4.glGetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, data); return true; }
Example 8
Source File: Gl_430_interface_matching.java From jogl-samples with MIT License | 5 votes |
private boolean initMax(GL4 gl4) { int[] maxVertexAttribs = {0}; gl4.glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, maxVertexAttribs, 0); //GL_MAX_DRAW_BUFFERS 8 //GL_MAX_COLOR_ATTACHMENTS 8 int[] maxVertexOutput = {0}; gl4.glGetIntegerv(GL_MAX_VERTEX_OUTPUT_COMPONENTS, maxVertexOutput, 0); int[] maxControlInput = {0}; gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_INPUT_COMPONENTS, maxControlInput, 0); int[] maxControlOutput = {0}; gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS, maxControlOutput, 0); int[] maxControlTotalOutput = {0}; gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS, maxControlTotalOutput, 0); int[] maxEvaluationInput = {0}; gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS, maxEvaluationInput, 0); int[] maxEvaluationOutput = {0}; gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS, maxEvaluationOutput, 0); int[] maxGeometryInput = {0}; gl4.glGetIntegerv(GL_MAX_GEOMETRY_INPUT_COMPONENTS, maxGeometryInput, 0); int[] maxGeometryOutput = {0}; gl4.glGetIntegerv(GL_MAX_GEOMETRY_OUTPUT_COMPONENTS, maxGeometryOutput, 0); int[] maxFragmentInput = {0}; gl4.glGetIntegerv(GL_MAX_FRAGMENT_INPUT_COMPONENTS, maxFragmentInput, 0); return true; }
Example 9
Source File: Gl_500_primitive_shading_nv.java From jogl-samples with MIT License | 5 votes |
private boolean initBuffer(GL4 gl4) { IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); BufferUtils.destroyDirectBuffer(uniformBufferOffset); gl4.glCreateBuffers(Buffer.MAX, bufferName); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); ByteBuffer vertexBuffer = GLBuffers.newDirectByteBuffer(vertexSize); for (int i = 0; i < vertexCount; i++) { vertexData[i].toBb(vertexBuffer, i); } vertexBuffer.rewind(); if (bug1287) { gl4.glNamedBufferStorage(bufferName.get(Buffer.TRANSFORM), uniformBlockSize, null, GL_MAP_WRITE_BIT); gl4.glNamedBufferStorage(bufferName.get(Buffer.ELEMENT), elementSize, elementBuffer, 0); gl4.glNamedBufferStorage(bufferName.get(Buffer.VERTEX), vertexSize, vertexBuffer, 0); } else { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferStorage(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_MAP_WRITE_BIT); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferStorage(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, 0); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferStorage(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); } return true; }
Example 10
Source File: Gl_500_conservative_raster_nv.java From jogl-samples with MIT License | 5 votes |
@Override protected boolean begin(GL gl) { GL4 gl4 = (GL4) gl; boolean validated = gl4.isExtensionAvailable("GL_NV_conservative_raster"); Caps caps = new Caps(gl4, Profile.CORE); if (validated) { validated = initProgram(gl4); } if (validated) { validated = initBuffer(gl4); } if (validated) { validated = initVertexArray(gl4); } if (validated) { validated = initTexture(gl4); } if (validated) { validated = initFramebuffer(gl4); } IntBuffer subPixelBiasX = GLBuffers.newDirectIntBuffer(1); IntBuffer subPixelBiasY = GLBuffers.newDirectIntBuffer(1); IntBuffer maxSubPixelBias = GLBuffers.newDirectIntBuffer(1); gl4.glGetIntegerv(GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV, subPixelBiasX); gl4.glGetIntegerv(GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV, subPixelBiasY); gl4.glGetIntegerv(GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV, maxSubPixelBias); System.out.println("GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV " + subPixelBiasX.get(0)); System.out.println("GL_SUBPIXEL_PRECISION_BIAS_Z_BITS_NV " + subPixelBiasY.get(0)); System.out.println("GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV " + maxSubPixelBias.get(0)); BufferUtils.destroyDirectBuffer(subPixelBiasX); BufferUtils.destroyDirectBuffer(subPixelBiasY); BufferUtils.destroyDirectBuffer(maxSubPixelBias); return validated; }
Example 11
Source File: Gl_450_culling.java From jogl-samples with MIT License | 5 votes |
private boolean initBuffer(GL4 gl4) { boolean validated = true; gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(elementBuffer); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); return validated; }
Example 12
Source File: Gl_410_glsl_block.java From jogl-samples with MIT License | 5 votes |
private boolean initBuffer(GL4 gl4) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glGetIntegerv( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(vertexBuffer); BufferUtils.destroyDirectBuffer(uniformBufferOffset); return checkError(gl4, "initBuffer"); }
Example 13
Source File: Gl_420_fbo.java From jogl-samples with MIT License | 5 votes |
private boolean initBuffer(GL4 gl4) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glGetIntegerv( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(vertexBuffer); BufferUtils.destroyDirectBuffer(uniformBufferOffset); return true; }
Example 14
Source File: Gl_430_program_compute_image.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer positionBuffer = GLBuffers.newDirectFloatBuffer(positionData); FloatBuffer texCoordBuffer = GLBuffers.newDirectFloatBuffer(texCoordData); FloatBuffer colorBuffer = GLBuffers.newDirectFloatBuffer(colorData); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.POSITION_INPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, positionSize * 2, null, GL_STATIC_DRAW); gl4.glBufferSubData(GL_ARRAY_BUFFER, 0, positionSize, positionBuffer); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.TEXCOORD_INPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, texCoordSize * 2, texCoordBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.COLOR_INPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, colorSize * 2, colorBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.POSITION_OUTPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, positionSize * 2, null, GL_STATIC_COPY); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.TEXCOORD_OUTPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, texCoordSize * 2, null, GL_STATIC_COPY); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.COLOR_OUTPUT)); gl4.glBufferData(GL_ARRAY_BUFFER, colorSize * 2, null, GL_STATIC_COPY); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGetIntegerv( GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(positionBuffer); BufferUtils.destroyDirectBuffer(texCoordBuffer); BufferUtils.destroyDirectBuffer(colorBuffer); BufferUtils.destroyDirectBuffer(uniformBufferOffset); return checkError(gl4, "initBuffer"); }
Example 15
Source File: Gl_430_program_compute_image.java From jogl-samples with MIT License | 4 votes |
private boolean initTexture(GL4 gl4) { try { jgli.Texture2d texture = new Texture2d(jgli.Load.load(TEXTURE_ROOT + "/" + TEXTURE_DIFFUSE)); assert (!texture.empty()); jgli.Gl.Format format = jgli.Gl.translate(texture.format()); gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); gl4.glGenTextures(Texture.MAX, textureName); gl4.glActiveTexture(GL_TEXTURE0); gl4.glBindTexture(GL_TEXTURE_2D, textureName.get(Texture.DIFFUSE)); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_RED); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_G, GL_GREEN); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_BLUE); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_A, GL_ALPHA); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, 0); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, texture.levels() - 1); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); gl4.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gl4.glTexStorage2D(GL_TEXTURE_2D, texture.levels(), format.internal.value, texture.dimensions(0)[0], texture.dimensions(0)[1]); for (int level = 0; level < texture.levels(); ++level) { gl4.glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, texture.dimensions(level)[0], texture.dimensions(level)[1], format.external.value, format.type.value, texture.data(level)); } gl4.glPixelStorei(GL_UNPACK_ALIGNMENT, 4); int[] textureBufferOffset = {0}; gl4.glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, textureBufferOffset, 0); int textureBufferRange = Math.max(positionSize, textureBufferOffset[0]); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.POSITION_INPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.POSITION_INPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.TEXCOORD_INPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.TEXCOORD_INPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.COLOR_INPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.COLOR_INPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.POSITION_OUTPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.POSITION_OUTPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.TEXCOORD_OUTPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.TEXCOORD_OUTPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, textureName.get(Texture.COLOR_OUTPUT)); gl4.glTexBufferRange(GL_TEXTURE_BUFFER, GL_RGBA32F, bufferName.get(Buffer.COLOR_OUTPUT), 0, textureBufferRange); gl4.glBindTexture(GL_TEXTURE_BUFFER, 0); } catch (IOException ex) { Logger.getLogger(Gl_430_program_compute_image.class.getName()).log(Level.SEVERE, null, ex); } return checkError(gl4, "initTexture"); }
Example 16
Source File: Gl_500_buffer_sparse_arb.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { int alignement = 256; IntBuffer bufferPageSize = GLBuffers.newDirectIntBuffer(1); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); gl4.glGetIntegerv(GL_SPARSE_BUFFER_PAGE_SIZE_ARB, bufferPageSize); boolean validated = true; int copyBufferSize = glm.ceilMultiple(vertexSize, alignement) + glm.ceilMultiple(elementSize, alignement); gl4.glCreateBuffers(Buffer.MAX, bufferName); if (!bug1287) { gl4.glNamedBufferStorage(bufferName.get(Buffer.COPY), copyBufferSize, null, GL_MAP_WRITE_BIT); } else { gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName.get(Buffer.COPY)); gl4.glBufferStorage(GL_SHADER_STORAGE_BUFFER, copyBufferSize, null, GL_MAP_WRITE_BIT); gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); } ByteBuffer copyBufferPointer = gl4.glMapNamedBufferRange(bufferName.get(Buffer.COPY), 0, copyBufferSize, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT); copyBufferPointer.asFloatBuffer().put(vertexBuffer); copyBufferPointer.position(glm.ceilMultiple(vertexSize, alignement)); copyBufferPointer.asShortBuffer().put(elementBuffer); gl4.glUnmapNamedBuffer(bufferName.get(Buffer.COPY)); gl4.glBindBuffer(GL_COPY_READ_BUFFER, bufferName.get(Buffer.COPY)); gl4.glBindBuffer(GL_COPY_WRITE_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferStorage(GL_COPY_WRITE_BUFFER, glm.ceilMultiple(elementSize, bufferPageSize.get(0)), null, GL_SPARSE_STORAGE_BIT_ARB); gl4.glBufferPageCommitmentARB(GL_COPY_WRITE_BUFFER, 0, bufferPageSize.get(0), true); gl4.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, glm.ceilMultiple(vertexSize, alignement), 0, glm.ceilMultiple(elementSize, alignement)); gl4.glBindBuffer(GL_COPY_WRITE_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferStorage(GL_COPY_WRITE_BUFFER, glm.ceilMultiple(vertexSize, bufferPageSize.get(0)), null, GL_SPARSE_STORAGE_BIT_ARB); gl4.glBufferPageCommitmentARB(GL_COPY_WRITE_BUFFER, 0, bufferPageSize.get(0), true); gl4.glCopyBufferSubData(GL_COPY_READ_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, glm.ceilMultiple(vertexSize, alignement)); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); if (!bug1287) { gl4.glNamedBufferStorage(bufferName.get(Buffer.TRANSFORM), uniformBlockSize, null, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); } else { gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferStorage(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); } BufferUtils.destroyDirectBuffer(vertexBuffer); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(bufferPageSize); return validated; }
Example 17
Source File: Gl_500_texture_bindless_arb.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementSize); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferStorage(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, 0); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferStorage(GL_SHADER_STORAGE_BUFFER, vertexSize, vertexBuffer, 0); gl4.glBindBuffer(GL_SHADER_STORAGE_BUFFER, 0); IntBuffer uniformBufferOffset = GLBuffers.newDirectIntBuffer(1); gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset.get(0)); BufferUtils.destroyDirectBuffer(uniformBufferOffset); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferStorage(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); uniformPointer = gl4.glMapBufferRange(GL_UNIFORM_BUFFER, 0, Mat4.SIZE, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.MATERIAL)); gl4.glBufferStorage(GL_UNIFORM_BUFFER, Long.BYTES, textureHandle, 0); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); DrawElementsIndirectCommand command = new DrawElementsIndirectCommand(elementCount, 1, 0, 0, 0); IntBuffer commandBuffer = GLBuffers.newDirectIntBuffer(command.toIa_()); gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, bufferName.get(Buffer.INDIRECT)); gl4.glBufferStorage(GL_DRAW_INDIRECT_BUFFER, DrawElementsIndirectCommand.SIZE, commandBuffer, 0); gl4.glBindBuffer(GL_DRAW_INDIRECT_BUFFER, 0); BufferUtils.destroyDirectBuffer(commandBuffer); return true; }
Example 18
Source File: Gl_440_buffer_type.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { // Generate a buffer object gl4.glGenBuffers(Buffer.MAX, bufferName); // Allocate and copy buffers memory byte[] data = new byte[positionSizeF32 + positionSizeI8 + positionSizeI32 + positionSizeRGB10A2 + positionSizeF16 + positionSizeRG11FB10F]; ByteBuffer dataBuffer = GLBuffers.newDirectByteBuffer(data); int currentOffset = 0; dataBuffer.asFloatBuffer().put(positionDataF32); currentOffset += positionSizeF32; dataBuffer.position(currentOffset); dataBuffer.put(positionDataI8); currentOffset += positionSizeI8; dataBuffer.position(currentOffset); dataBuffer.asIntBuffer().put(positionDataI32); currentOffset += positionSizeI32; dataBuffer.position(currentOffset); dataBuffer.asIntBuffer().put(positionDataRGB10A2); currentOffset += positionSizeRGB10A2; dataBuffer.position(currentOffset); dataBuffer.asShortBuffer().put(positionDataF16); currentOffset += positionSizeF16; dataBuffer.position(currentOffset); dataBuffer.asIntBuffer().put(positionDataRG11FB10F); dataBuffer.rewind(); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferStorage(GL_ARRAY_BUFFER, data.length * Byte.BYTES, dataBuffer, 0); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferStorage(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); return checkError(gl4, "initBuffer"); }
Example 19
Source File: Gl_420_atomic_counter.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { boolean validated = true; int[] maxVertexAtomicCounterBuffers = {0}; int[] maxControlAtomicCounterBuffers = {0}; int[] maxEvaluationAtomicCounterBuffers = {0}; int[] maxGeometryAtomicCounterBuffers = {0}; int[] maxFragmentAtomicCounterBuffers = {0}; int[] maxCombinedAtomicCounterBuffers = {0}; ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl4.glGetIntegerv(GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS, maxVertexAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS, maxControlAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS, maxEvaluationAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS, maxGeometryAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS, maxFragmentAtomicCounterBuffers, 0); gl4.glGetIntegerv(GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS, maxCombinedAtomicCounterBuffers, 0); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, Mat4.SIZE, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, bufferName.get(Buffer.ATOMIC_COUNTER)); gl4.glBufferData(GL_ATOMIC_COUNTER_BUFFER, Integer.BYTES, null, GL_DYNAMIC_COPY); gl4.glBindBuffer(GL_ATOMIC_COUNTER_BUFFER, 0); BufferUtils.destroyDirectBuffer(elementBuffer); BufferUtils.destroyDirectBuffer(vertexBuffer); return validated; }
Example 20
Source File: Gl_430_texture_buffer.java From jogl-samples with MIT License | 4 votes |
private boolean initBuffer(GL4 gl4) { float[] displacement = { +0.1f, +0.3f, -1.0f, -0.5f, +0.0f, -0.5f, -0.2f, -0.2f, +0.0f, +0.3f, +0.2f, +0.5f, +0.1f, -0.3f, +1.0f}; float[] diffuse = { 1.0f, 0.0f, 0.0f, 1.0f, 0.5f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f}; int[] textureBufferOffsetAlignment = {0}; gl4.glGetIntegerv(GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT, textureBufferOffsetAlignment, 0); int displacementSize = Vec3.SIZE * displacement.length; int diffuseSize = Vec3.SIZE * diffuse.length; int displacementMultiple = glm.ceilMultiple(displacementSize, textureBufferOffsetAlignment[0]); int diffuseMultiple = glm.ceilMultiple(diffuseSize, textureBufferOffsetAlignment[0]); gl4.glGenBuffers(Buffer.MAX, bufferName); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, bufferName.get(Buffer.ELEMENT)); ShortBuffer elementBuffer = GLBuffers.newDirectShortBuffer(elementData); gl4.glBufferData(GL_ELEMENT_ARRAY_BUFFER, elementSize, elementBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(elementBuffer); gl4.glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_ARRAY_BUFFER, bufferName.get(Buffer.VERTEX)); FloatBuffer vertexBuffer = GLBuffers.newDirectFloatBuffer(vertexData); gl4.glBufferData(GL_ARRAY_BUFFER, vertexSize, vertexBuffer, GL_STATIC_DRAW); BufferUtils.destroyDirectBuffer(vertexBuffer); gl4.glBindBuffer(GL_ARRAY_BUFFER, 0); gl4.glBindBuffer(GL_TEXTURE_BUFFER, bufferName.get(Buffer.DISPLACEMENT)); gl4.glBufferData(GL_TEXTURE_BUFFER, textureBufferOffsetAlignment[0] + displacementMultiple, null, GL_STATIC_DRAW); FloatBuffer displacementBuffer = GLBuffers.newDirectFloatBuffer(displacement); gl4.glBufferSubData(GL_TEXTURE_BUFFER, textureBufferOffsetAlignment[0], displacementSize, displacementBuffer); BufferUtils.destroyDirectBuffer(displacementBuffer); /* void * PointerDisplacement = glMapBufferRange(GL_TEXTURE_BUFFER, 0, sizeof(Displacement), GL_MAP_WRITE_BIT ); memcpy(PointerDisplacement, &Displacement[0], sizeof(Displacement)); glUnmapBuffer(GL_TEXTURE_BUFFER); */ gl4.glBindBuffer(GL_TEXTURE_BUFFER, 0); gl4.glBindBuffer(GL_TEXTURE_BUFFER, bufferName.get(Buffer.DIFFUSE)); gl4.glBufferData(GL_TEXTURE_BUFFER, textureBufferOffsetAlignment[0] + diffuseMultiple, null, GL_STATIC_DRAW); FloatBuffer diffuseBuffer = GLBuffers.newDirectFloatBuffer(diffuse); gl4.glBufferSubData(GL_TEXTURE_BUFFER, textureBufferOffsetAlignment[0], diffuseSize, diffuseBuffer); BufferUtils.destroyDirectBuffer(diffuseBuffer); gl4.glBindBuffer(GL_TEXTURE_BUFFER, 0); int[] uniformBufferOffset = {0}; gl4.glGetIntegerv(GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT, uniformBufferOffset, 0); int uniformBlockSize = Math.max(Mat4.SIZE, uniformBufferOffset[0]); gl4.glBindBuffer(GL_UNIFORM_BUFFER, bufferName.get(Buffer.TRANSFORM)); gl4.glBufferData(GL_UNIFORM_BUFFER, uniformBlockSize, null, GL_DYNAMIC_DRAW); gl4.glBindBuffer(GL_UNIFORM_BUFFER, 0); return true; }