Example usage for org.lwjgl.opengl GL15 glGenBuffers

List of usage examples for org.lwjgl.opengl GL15 glGenBuffers

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL15 glGenBuffers.

Prototype

public static void glGenBuffers(@NativeType("GLuint *") int[] buffers) 

Source Link

Document

Array version of: #glGenBuffers GenBuffers

Usage

From source file:org.oscim.gdx.LwjglGL20.java

License:Apache License

public void genBuffers(int n, IntBuffer buffers) {
    GL15.glGenBuffers(buffers);
}

From source file:org.terasology.engine.subsystem.lwjgl.GLBufferPool.java

License:Apache License

public int get(String forUseBy) {
    if (pool.isEmpty()) {
        IntBuffer buffer = BufferUtils.createIntBuffer(BUFFER_FETCH_SIZE);
        GL15.glGenBuffers(buffer);
        for (int i = 0; i < BUFFER_FETCH_SIZE; ++i) {
            pool.add(buffer.get(i));//w w w . j  a  va  2s  . co  m
        }
        totalPoolSize += BUFFER_FETCH_SIZE;
    }

    int result = pool.removeAt(pool.size() - 1);
    if (traceBufferUsage) {
        usageTracker.put(result, forUseBy);
    }
    return result;
}

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glGenBuffers(int n, IntBuffer buffers) {
    GL15.glGenBuffers(buffers);
}

From source file:processing.lwjgl.PGL.java

License:Open Source License

public void genBuffers(int n, IntBuffer ids) {
    GL15.glGenBuffers(ids);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void genBuffers(int n, IntBuffer buffers) {
    GL15.glGenBuffers(buffers);
}

From source file:tk.ivybits.engine.gl.GL.java

License:Open Source License

public static void glGenBuffers(IntBuffer a) {
    GL15.glGenBuffers(a);
}

From source file:vertigo.graphics.lwjgl.LWJGL_Renderer.java

License:Open Source License

/**
  * Process the BO.//from w w w  .  j  a v a  2 s . com
  * @param obj shape
  */
private void initVBO(Shape obj) {
    int nbBO = obj.getGeometry().getNumberBO(); //return 2 for the cube (1 vbo + 1 ibo)
    ib = BufferTools.newIntBuffer(nbBO);
    GL15.glGenBuffers(ib);
    int i = 0;
    for (BO bo : obj.getGeometry().getAllBO()) {
        int boHandle = ib.get(i);
        bo.setHandle(boHandle);
        if (bo instanceof IBO) {
            isIndexed = true;
            ibo = (IBO) bo;
            GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, boHandle);
            GL15.glBufferData(GL15.GL_ELEMENT_ARRAY_BUFFER, ibo.getIntBuffer(), GL15.GL_STATIC_DRAW);
            GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
        } else {
            VBO vbo = (VBO) bo;
            //if (!vbo.getBuffer().isLoaded() ) {
            GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, boHandle);
            GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vbo.getFloatBuffer(), GL15.GL_STATIC_DRAW);
            GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
            //}
        }
        i++;
    }
    GL15.glDeleteBuffers(ib);
}

From source file:view.renderer.GridRenderer.java

/**
 * Inits this renderer./*from   ww w. jav  a 2 s.  c o m*/
 *
 * @param mapSizeX The absolute width of the map in pixels.
 * @param mapSizeY the absolute height of the map in pixels.
 * @param screenSizeX The width of the screen.
 * @param screenSizeY The height of the screen.
 */
public void init(int mapSizeX, int mapSizeY, int screenSizeX, int screenSizeY) {
    linesX = mapSizeX;
    linesY = mapSizeY;
    this.screenSizeX = screenSizeX;
    this.screenSizeY = screenSizeY;
    vB = BufferUtils.createIntBuffer((linesX + linesY) * 4 * 2);
    cB = BufferUtils.createFloatBuffer((linesX + linesY) * 4 * 3);

    for (int i = 0; i < (linesX + linesY) * 4; i++) {
        cB.put(Globals.GRID_COLOR.r).put(Globals.GRID_COLOR.g).put(Globals.GRID_COLOR.b);
    }
    cB.flip();

    for (int i = 0; i < linesX; i++) {
        vB.put(0).put(i * Globals.TILE_SIZE - Globals.GRID_STRENGTH / 2);
        vB.put(mapSizeX * Globals.TILE_SIZE).put(i * Globals.TILE_SIZE - Globals.GRID_STRENGTH / 2);
        vB.put(mapSizeX * Globals.TILE_SIZE).put(i * Globals.TILE_SIZE + Globals.GRID_STRENGTH / 2);
        vB.put(0).put(i * Globals.TILE_SIZE + Globals.GRID_STRENGTH / 2);
    }

    for (int i = 0; i < linesY; i++) {
        vB.put(i * Globals.TILE_SIZE - Globals.GRID_STRENGTH / 2).put(0);
        vB.put(i * Globals.TILE_SIZE + Globals.GRID_STRENGTH / 2).put(0);
        vB.put(i * Globals.TILE_SIZE - Globals.GRID_STRENGTH / 2).put(mapSizeY * Globals.TILE_SIZE);
        vB.put(i * Globals.TILE_SIZE + Globals.GRID_STRENGTH / 2).put(mapSizeY * Globals.TILE_SIZE);
    }
    vB.flip();

    IntBuffer ib = BufferUtils.createIntBuffer(2);
    GL15.glGenBuffers(ib);
    vID = ib.get(0);
    cID = ib.get(1);
}