private void createVAO () { tmpHandle.clear(); Gdx.gl30.glGenVertexArrays(1, tmpHandle); vaoHandle = tmpHandle.get(); }
private void createVAO () { tmpHandle.clear(); Gdx.gl30.glGenVertexArrays(1, tmpHandle); vaoHandle = tmpHandle.get(); }
private void createVAO () { tmpHandle.clear(); Gdx.gl30.glGenVertexArrays(1, tmpHandle); vaoHandle = tmpHandle.get(); }
private void createVAO () { tmpHandle.clear(); Gdx.gl30.glGenVertexArrays(1, tmpHandle); vaoHandle = tmpHandle.get(); }
private IntBuffer toIntBuffer (int v[], int offset, int count) { ensureBufferCapacity(count << 2); intBuffer.clear(); intBuffer.limit(count); intBuffer.put(v, offset, count); intBuffer.position(0); return intBuffer; }
private IntBuffer toIntBuffer (int v[], int offset, int count) { ensureBufferCapacity(count << 2); intBuffer.clear(); intBuffer.limit(count); intBuffer.put(v, offset, count); intBuffer.position(0); return intBuffer; }
private void deleteVAO () { if (vaoHandle != -1) { tmpHandle.clear(); tmpHandle.put(vaoHandle); tmpHandle.flip(); Gdx.gl30.glDeleteVertexArrays(1, tmpHandle); vaoHandle = -1; } } }
private void deleteVAO () { if (vaoHandle != -1) { tmpHandle.clear(); tmpHandle.put(vaoHandle); tmpHandle.flip(); Gdx.gl30.glDeleteVertexArrays(1, tmpHandle); vaoHandle = -1; } } }
private void deleteVAO () { if (vaoHandle != -1) { tmpHandle.clear(); tmpHandle.put(vaoHandle); tmpHandle.flip(); Gdx.gl30.glDeleteVertexArrays(1, tmpHandle); vaoHandle = -1; } } }
private void deleteVAO () { if (vaoHandle != -1) { tmpHandle.clear(); tmpHandle.put(vaoHandle); tmpHandle.flip(); Gdx.gl30.glDeleteVertexArrays(1, tmpHandle); vaoHandle = -1; } } }
private int getInteger(int en) { intBuf16.clear(); gl.glGetInteger(en, intBuf16); return intBuf16.get(0); }
private IntBuffer toIntBuffer (int v[], int offset, int count) { ensureBufferCapacity(count << 2); intBuffer.clear(); com.badlogic.gdx.utils.BufferUtils.copy(v, count, offset, intBuffer); return intBuffer; }
private IntBuffer toIntBuffer (int v[], int offset, int count) { ensureBufferCapacity(count << 2); intBuffer.clear(); com.badlogic.gdx.utils.BufferUtils.copy(v, count, offset, intBuffer); return intBuffer; }
private void fetchUniforms () { params.clear(); Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_UNIFORMS, params); int numUniforms = params.get(0); uniformNames = new String[numUniforms]; for (int i = 0; i < numUniforms; i++) { params.clear(); params.put(0, 1); type.clear(); String name = Gdx.gl20.glGetActiveUniform(program, i, params, type); int location = Gdx.gl20.glGetUniformLocation(program, name); uniforms.put(name, location); uniformTypes.put(name, type.get(0)); uniformSizes.put(name, params.get(0)); uniformNames[i] = name; } }
private void fetchAttributes () { params.clear(); Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_ATTRIBUTES, params); int numAttributes = params.get(0); attributeNames = new String[numAttributes]; for (int i = 0; i < numAttributes; i++) { params.clear(); params.put(0, 1); type.clear(); String name = Gdx.gl20.glGetActiveAttrib(program, i, params, type); int location = Gdx.gl20.glGetAttribLocation(program, name); attributes.put(name, location); attributeTypes.put(name, type.get(0)); attributeSizes.put(name, params.get(0)); attributeNames[i] = name; } }
private void fetchUniforms () { params.clear(); Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_UNIFORMS, params); int numUniforms = params.get(0); uniformNames = new String[numUniforms]; for (int i = 0; i < numUniforms; i++) { params.clear(); params.put(0, 1); type.clear(); String name = Gdx.gl20.glGetActiveUniform(program, i, params, type); int location = Gdx.gl20.glGetUniformLocation(program, name); uniforms.put(name, location); uniformTypes.put(name, type.get(0)); uniformSizes.put(name, params.get(0)); uniformNames[i] = name; } }
private void fetchAttributes () { params.clear(); Gdx.gl20.glGetProgramiv(program, GL20.GL_ACTIVE_ATTRIBUTES, params); int numAttributes = params.get(0); attributeNames = new String[numAttributes]; for (int i = 0; i < numAttributes; i++) { params.clear(); params.put(0, 1); type.clear(); String name = Gdx.gl20.glGetActiveAttrib(program, i, params, type); int location = Gdx.gl20.glGetAttribLocation(program, name); attributes.put(name, location); attributeTypes.put(name, type.get(0)); attributeSizes.put(name, params.get(0)); attributeNames[i] = name; } }
@Override public void deleteBuffer(final BufferObject bo) { int bufferId = bo.getId(); if (bufferId == -1) { return; } intBuf1.clear(); intBuf1.put(bufferId); intBuf1.flip(); gl.glDeleteBuffers(intBuf1); bo.resetObject(); }
@Override public void dispose() { GL30 gl = Gdx.gl30; gl.glBindBuffer(GL20.GL_ARRAY_BUFFER, 0); gl.glDeleteBuffer(bufferHandle); bufferHandle = 0; BufferUtils.disposeUnsafeByteBuffer(byteBuffer); if (gl.glIsVertexArray(vaoHandle)) { tmpHandle.clear(); tmpHandle.put(vaoHandle); tmpHandle.flip(); gl.glDeleteVertexArrays(1, tmpHandle); } } }
@Override public void bind(ShaderProgram shader, int[] locations) { GL30 gl = Gdx.gl30; if (vaoDirty || !gl.glIsVertexArray(vaoHandle)) { //initialize the VAO with our vertex attributes and buffer: tmpHandle.clear(); gl.glGenVertexArrays(1, tmpHandle); vaoHandle = tmpHandle.get(0); gl.glBindVertexArray(vaoHandle); vaoDirty = false; } else { //else simply bind the VAO. gl.glBindVertexArray(vaoHandle); } bindAttributes(shader, locations); //if our data has changed upload it: bindData(gl); isBound = true; }