Example usage for org.lwjgl.opengl GL11 glDrawArrays

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

Introduction

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

Prototype

public static void glDrawArrays(@NativeType("GLenum") int mode, @NativeType("GLint") int first,
        @NativeType("GLsizei") int count) 

Source Link

Document

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

Usage

From source file:wrapper.vbo.Vbo.java

License:Open Source License

public void render() {
    if (vertid != -1) {

        shader.bind();/*  www.  j  a  v  a  2s.  c  o  m*/
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texid);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertid);
        GL20.glEnableVertexAttribArray(vertexattrib);
        GL20.glEnableVertexAttribArray(textureattrib);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vertid);
        GL20.glVertexAttribPointer(vertexattrib, 3, GL11.GL_FLOAT, false, 0, 0);
        GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, texcoordid);
        GL20.glVertexAttribPointer(textureattrib, 2, GL11.GL_FLOAT, false, 0, 0);
        GL20.glUniform3f(rotationuniform, rotation_x, rotation_y, rotation_z);
        GL20.glUniform3f(transformuniform, transformation.x, transformation.y, transformation.z);
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, vertcount);

        GL20.glDisableVertexAttribArray(vertexattrib);
        GL20.glDisableVertexAttribArray(textureattrib);

        GL11.glEnable(GL11.GL_BLEND);
        shader.unbind();
    } else {

        System.out.println("Error no bound vertid");
        return;
    }

}

From source file:zildo.platform.opengl.compatibility.VBOHardware.java

License:Open Source License

@Override
public void draw(VBOBuffers p_bufs, int start, int count) {
    preDraw();/*w  ww .  j av  a2s  .  c o  m*/

    int stride = 4 * 4;
    ARBVertexBufferObject.glBindBufferARB(ARBVertexBufferObject.GL_ARRAY_BUFFER_ARB, p_bufs.vertexBufferId);
    GL11.glVertexPointer(2, GL11.GL_FLOAT, stride, 0);
    GL11.glTexCoordPointer(2, GL11.GL_FLOAT, stride, 2 * 4);

    //GL12.glDrawRangeElements(GL11.GL_TRIANGLES, 0, count, count, GL11.GL_UNSIGNED_SHORT, 0);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, start, count);
}

From source file:zildo.platform.opengl.compatibility.VBOSoftware.java

License:Open Source License

/**
 * Render vertices/textures without indices. So one quad is a double triangle represented by 
 * 6 vertices and 6 texcoords.//from  w  ww. j a  v a  2 s.  c  om
 */
@Override
public void draw(VBOBuffers p_bufs, int start, int count) {
    preDraw();
    GL11.glVertexPointer(2, 0, p_bufs.vertices);
    GL11.glTexCoordPointer(2, 0, p_bufs.textures);

    GL11.glDrawArrays(GL11.GL_TRIANGLES, start, count);
}