Example usage for com.badlogic.gdx.graphics GL20 GL_DYNAMIC_DRAW

List of usage examples for com.badlogic.gdx.graphics GL20 GL_DYNAMIC_DRAW

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics GL20 GL_DYNAMIC_DRAW.

Prototype

int GL_DYNAMIC_DRAW

To view the source code for com.badlogic.gdx.graphics GL20 GL_DYNAMIC_DRAW.

Click Source Link

Usage

From source file:com.watabou.glwrap.Vertexbuffer.java

License:Open Source License

public void updateGLData() {
    if (updateStart == -1)
        return;//  www .j  a  v  a  2s  .  com

    vertices.position(updateStart);
    bind();

    if (updateStart == 0 && updateEnd == vertices.limit()) {
        Gdx.gl.glBufferData(GL20.GL_ARRAY_BUFFER, vertices.limit() * 4, vertices, GL20.GL_DYNAMIC_DRAW);
    } else {
        Gdx.gl.glBufferSubData(GL20.GL_ARRAY_BUFFER, updateStart * 4, (updateEnd - updateStart) * 4, vertices);
    }

    release();
    updateStart = updateEnd = -1;
}