Example usage for org.lwjgl.opengl GL11 glDrawElements

List of usage examples for org.lwjgl.opengl GL11 glDrawElements

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glDrawElements.

Prototype

public static void glDrawElements(@NativeType("GLenum") int mode, @NativeType("GLsizei") int count,
        @NativeType("GLenum") int type, @NativeType("void const *") long indices) 

Source Link

Document

Constructs a sequence of geometric primitives by successively transferring elements for count vertices to the GL.

Usage

From source file:playn.java.JavaGL20.java

License:Apache License

@Override
public void glDrawElements(int mode, int count, int type, int indices) {
    GL11.glDrawElements(mode, count, type, indices);
}

From source file:processing.lwjgl.PGL.java

License:Open Source License

public void drawElements(int mode, int count, int type, int offset) {
    GL11.glDrawElements(mode, count, type, offset);
}

From source file:processing.opengl.PLWJGL.java

License:Open Source License

@Override
public void drawElements(int mode, int count, int type, int offset) {
    GL11.glDrawElements(mode, count, type, offset);
}

From source file:ru.axialshift.vram.gl.IndicesVBO.java

License:Apache License

public void draw() {
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, glpointer);
    GL11.glDrawElements(GL11.GL_TRIANGLES, indicesCount, GL11.GL_UNSIGNED_BYTE, 0);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
}

From source file:se.angergard.engine.graphics.Mesh.java

License:Apache License

public void draw() {
    GL20.glEnableVertexAttribArray(0);/*  ww w.j  ava2  s .  c  o m*/
    GL20.glEnableVertexAttribArray(1);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vbo);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, ibo);

    GL20.glVertexAttribPointer(0, 2, GL11.GL_FLOAT, false, Vertex2D.SIZE_BYTES, 0);
    GL20.glVertexAttribPointer(1, 2, GL11.GL_FLOAT, false, Vertex2D.SIZE_BYTES, 8);
    GL11.glDrawElements(GL11.GL_TRIANGLES, INDICES_LENGTH, GL11.GL_UNSIGNED_INT, 0);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    GL20.glDisableVertexAttribArray(0);
    GL20.glDisableVertexAttribArray(1);
}

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

License:Open Source License

public static void glDrawElements(int a, int b, int c, long d) {
    GL11.glDrawElements(a, b, c, d);
}

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

License:Open Source License

public static void glDrawElements(int a, int b, int c, ByteBuffer d) {
    GL11.glDrawElements(a, b, c, d);
}

From source file:uk.co.ifs_studios.engine.geometry.BasicDrawElement.java

License:Open Source License

/**
 * Render DrawElement./*from   w  ww.  j a  v a2  s. co  m*/
 */
public void render() {
    this.shader.getShaderProgram().use();

    Engine.getInstance().getWindow().getProjectionMatrix().store(this.matrixBuffer);
    this.matrixBuffer.flip();
    GL20.glUniformMatrix4(this.shader.getProjectionMatrixLocation(), false, this.matrixBuffer);

    Engine.getInstance().getGame().getCurrentState().getCamera().getViewMatrix().store(this.matrixBuffer);
    this.matrixBuffer.flip();
    GL20.glUniformMatrix4(this.shader.getViewMatrixLocation(), false, this.matrixBuffer);

    this.modelMatrix.store(this.matrixBuffer);
    this.matrixBuffer.flip();
    GL20.glUniformMatrix4(this.shader.getModelMatrixLocation(), false, this.matrixBuffer);

    GL30.glBindVertexArray(this.vao);
    GL20.glEnableVertexAttribArray(0);
    GL20.glEnableVertexAttribArray(1);

    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, this.ibo);

    GL11.glDrawElements(GL11.GL_TRIANGLES, this.indiceCount, GL11.GL_UNSIGNED_BYTE, 0);

    GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);

    GL20.glDisableVertexAttribArray(0);
    GL30.glBindVertexArray(0);

    this.shader.getShaderProgram().unuse();
}

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

License:Open Source License

private void drawShape(Shape obj) {
    // Geometry: VBO and IBO
    if (obj.isDirty(Node.VBO)) {
        processBO(obj);/*from  ww  w  . j  a v  a  2s  .c  o  m*/
        obj.setDirty(Node.VBO, false);
    }

    ShaderProg glshader = obj.getMaterial().getShaderMaterial();
    GL20.glUseProgram(glshader.getHandle());

    updateUniform();
    VBO vbo = null;

    for (Attribute attrib : attribute) {
        if (vbo.getType().equals(attrib.getType())) {
            int alocation = GL20.glGetAttribLocation(glshader.getHandle(), attrib.getName());
            GL20.glEnableVertexAttribArray(alocation);
            GL20.glVertexAttribPointer(alocation, attrib.getSize(), GL11.GL_FLOAT, false, vbo.getStride() << 2,
                    0L);
        }
    }

    if (isIndexed) {
        // draw with index
        GL11.glDrawElements(getOpenGLStyle(obj.getDrawingStyle()), /* elements */ ibo.getSize(),
                GL_UNSIGNED_INT, 0L);
        GL15.glBindBuffer(GL15.GL_ELEMENT_ARRAY_BUFFER, 0);
        GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
        GL20.glDisableVertexAttribArray(0);
    } else {
        // draw without index
        GL11.glDrawArrays(getOpenGLStyle(obj.getDrawingStyle()), 0, capacity / vbo3f.getStride());
        GL20.glDisableVertexAttribArray(0);
        GL30.glBindVertexArray(0);
    }

    GL20.glUseProgram(0);
}

From source file:wrath.client.graphics.Model.java

License:Open Source License

@Override
public void render(boolean consolidated) {
    if (!shader.isFinalized())
        shader.finish();/*from w ww  .  j av a  2 s  .  c o m*/
    if (consolidated)
        renderSetup();

    GL11.glDrawElements(GL11.GL_TRIANGLES, indiciesLen, GL11.GL_UNSIGNED_INT, 0);

    if (consolidated)
        renderStop();
}