@Override public void release() { GLES20.glDeleteBuffers(vbo.length, vbo, 0); GLES20.glDeleteBuffers(ibo.length, ibo, 0); // vbo[0] = 0; // for (int i = 0; i < 3; i++) { // ibo[i] = 0; // } }
public void dispose() { loaded = false; int[] vboIDs = {vertexBufferID, indexBufferID}; GLES20.glDeleteBuffers(2, vboIDs, 0); vertexBufferID = 0; indexBufferID = 0; // material.dispose(); }
public void setResource(int id) { loaded = false; int[] vboIDs = {vertexBufferID, indexBufferID}; GLES20.glDeleteBuffers(2, vboIDs, 0); vertexBufferID = 0; indexBufferID = 0; boolean b = loadModel(id); if (vertices != null && indices != null && b) { bindBuffers(); loaded = true; } else loaded = false; }
private void loadVBO() { GLES20.glGenBuffers(1, VBO, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, VBO[0]); // GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER,((totalPoints*3)*4 + // (totalPoints*3)*4),null,GLES20.GL_STATIC_DRAW); GLES20.glBufferData( GLES20.GL_ARRAY_BUFFER, sizeBuffer, buffer.position(0), GLES20.GL_STATIC_DRAW); if (GLES20.glGetError() == GLES20.GL_OUT_OF_MEMORY) { GLES20.glDeleteBuffers(1, VBO, 0); Log.e(TAG, "No memory!!"); buffer.limit(0); buffer = null; System.gc(); // Toast.makeText(Global.getContext(),"No Memory!!",Toast.LENGTH_LONG).show(); System.exit(1); } GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); }
public void update() { if (buffer != null) { buffer.limit(0); buffer = null; } initSomePoints(); mMediumPointThread = new MediumPoint(); mMediumPointThread.start(); if (problemBufferInterleaved) { vertexBuffer.limit(0); vertexBuffer = null; colorBuffer.limit(0); colorBuffer = null; separateBuffers(); loadVBO2(); } else { GLES20.glDeleteBuffers(VBO.length, VBO, 0); VBO = new int[1]; loadVBO(); } enable(); }
// Deleta o antigo VBO e carrega 2 VBO separados. Um para o buffer de vertices e o outro para // o buffer de cor. // Esse metodo so e chamado caso tenha ocorrido GL_INVALID_OPERATION na chamada do comando // glDrawArrays no metodo draw(). private void loadVBO2() { if (problemBufferInterleaved) { GLES20.glDeleteBuffers(VBO.length, VBO, 0); VBO = new int[2]; GLES20.glGenBuffers(2, VBO, 0); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, VBO[0]); GLES20.glBufferData( GLES20.GL_ARRAY_BUFFER, vertexBuffer.array().length, vertexBuffer.position(0), GLES20.GL_STATIC_DRAW); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, VBO[1]); GLES20.glBufferData( GLES20.GL_ARRAY_BUFFER, colorBuffer.array().length, colorBuffer.position(0), GLES20.GL_STATIC_DRAW); GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0); buffer.limit(0); buffer = null; } }
@Override public void glDeleteBuffers(int n, IntBuffer buffers) { GLES20.glDeleteBuffers(n, buffers); }
@Override public void glDeleteBuffers(int n, int[] buffers, int offset) { GLES20.glDeleteBuffers(n, buffers, offset); }
@Override public void glDeleteBuffers(GL11 gl, int n, int[] buffers, int offset) { GLES20.glDeleteBuffers(n, buffers, offset); GLES20Canvas.checkError(); }