Pipelined_QuadRenderer() { final GL2 gl = GLContext.getCurrentGL().getGL2(); mVertCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsVerts); mTexCoords = Buffers.newDirectFloatBuffer(kTotalBufferSizeCoordsTex); usingVBOs = getUseVertexArrays() && is15Available(gl); if (usingVBOs) { try { final int[] vbos = new int[2]; gl.glGenBuffers(2, IntBuffer.wrap(vbos)); mVBO_For_ResuableTileVertices = vbos[0]; mVBO_For_ResuableTileTexCoords = vbos[1]; gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesVerts, null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); gl.glBufferData(GL.GL_ARRAY_BUFFER, kTotalBufferSizeBytesTex, null, GL2ES2.GL_STREAM_DRAW); // stream draw because this is a single quad use pipeline } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; usingVBOs = false; } } }
gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); gl.glBufferData(GL_ARRAY_BUFFER, (int) interleavedColorAndPositionsTemp.getValidBytes(), interleavedColorAndPositionsTemp.getByteBuffer(), GL2.GL_DYNAMIC_COPY); gl.glBindBuffer(GL_ARRAY_BUFFER, 0);
@Override public void beginMovement(final Object oldBackingStore, final Object newBackingStore) { // Exit the begin / end pair if necessary if (inBeginEndPair) { // Draw any outstanding glyphs flush(); final GL2 gl = GLContext.getCurrentGL().getGL2(); // Pop client attrib bits used by the pipelined quad renderer gl.glPopClientAttrib(); // The OpenGL spec is unclear about whether this changes the // buffer bindings, so preemptively zero out the GL_ARRAY_BUFFER // binding if (getUseVertexArrays() && is15Available(gl)) { try { gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false; } } if (isOrthoMode) { ((TextureRenderer) oldBackingStore).endOrthoRendering(); } else { ((TextureRenderer) oldBackingStore).end3DRendering(); } } final TextureRenderer newRenderer = (TextureRenderer) newBackingStore; g = newRenderer.createGraphics(); }
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); } catch (final Exception e) { isExtensionAvailable_GL_VERSION_1_5 = false;
@Override public void display(GLAutoDrawable glad) { GL2 gl = (GL2)glad.getGL(); gl.glBlendFunc(GL_SRC_ALPHA, blends[iBlend]); gl.glMatrixMode(GL2.GL_PROJECTION); gl.glLoadIdentity(); new GLU().gluOrtho2D(-width / 2 - 1, width / 2 + 1, -height/2 - 1, height/2 + 1); gl.glMatrixMode(GL2.GL_MODELVIEW); gl.glBindBuffer(GL_ARRAY_BUFFER, vbo[0]); if (useOpenGLContext) { queue.finish(); } else { //interleavedColorAndPositionsMem.map(queue, CLMem.MapFlags.Read); interleavedColorAndPositionsMem.read(queue, interleavedColorAndPositionsTemp, true); gl.glBufferSubData(GL_ARRAY_BUFFER, 0, (int)interleavedColorAndPositionsTemp.getValidBytes(), interleavedColorAndPositionsTemp.getByteBuffer()); //interleavedColorAndPositionsMem.unmap(queue, interleavedColorAndPositionsTemp); } gl.glClear(GL_COLOR_BUFFER_BIT); gl.glColor3f(1.0f, 1.0f, 1.0f); //gl.glEnableClientState(GL_VERTEX_ARRAY); //gl.glEnableClientState(GL_COLOR_ARRAY); //gl.glColorPointer(4, GL_UNSIGNED_BYTE, elementSize, gl.glInterleavedArrays(GL2.GL_C4UB_V2F, elementSize, 0); gl.glDrawArrays(GL_POINTS, 0, particlesCount); gl.glBindBuffer(GL_ARRAY_BUFFER, 0); if (!paused) updateKernelArgs(); }
gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileVertices); gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0, gl.glBindBuffer(GL.GL_ARRAY_BUFFER, mVBO_For_ResuableTileTexCoords); gl.glBufferSubData(GL.GL_ARRAY_BUFFER, 0,
gl.glGenBuffers(1, vbi, 0); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbi[0]); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbi[0]); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbi[0]); gl.glVertexPointer(2, GL.GL_FLOAT, 5 * ByteArrayUtil.SIZE_FLOAT, 0); gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glUnmapBuffer(GL.GL_ARRAY_BUFFER); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, vbi[0]); gl.glEnableClientState(GL2.GL_VERTEX_ARRAY); gl.glVertexPointer(2, GL.GL_FLOAT, 0, 0);
buffer = NIOUtils.directFloats(bufferSize, ByteOrder.nativeOrder()); gl.glGenBuffers(1, VBO, 0); // Get A Valid Name gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBO[0]); // Bind The Buffer gl.glBufferData(GL.GL_ARRAY_BUFFER, bufferSize * 4 /*SIZEOF_FLOAT*/, buffer, GL2.GL_DYNAMIC_READ); ); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, 0); gl.glBindTexture(GL2.GL_TEXTURE_2D, 0); queue.finish(); gl.glBindBuffer(GL.GL_ARRAY_BUFFER, VBO[0]); // Bind The Buffer ByteBuffer mb = gl.glMapBuffer(GL.GL_ARRAY_BUFFER, GL2.GL_READ_ONLY); if (mb != null) {