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("void const *") IntBuffer indices) 

Source Link

Document

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

Usage

From source file:RediscoveredMod.MD3Renderer.java

License:Open Source License

public final void render(int var1, int var2, float var3) {
    if ((this.displayList == 0) || (this.useAnimation)) {
        if (!this.useAnimation) {
            this.displayList = GL11.glGenLists(1);
        }/* ww  w .j a  va2 s . co m*/

        GL11.glEnableClientState(32884);
        GL11.glEnableClientState(32888);
        GL11.glEnableClientState(32885);
        if (!this.useAnimation) {
            GL11.glNewList(this.displayList, 4864);
        }

        for (int i = 0; i < this.model.surfaces.length; i++) {
            MD3Surface surface = this.model.surfaces[i];
            if (this.useAnimation)
                surface.setFrame(var1, var2, var3);
            else {
                surface.setFrame(0, 0, 0.0F);
            }

            surface.triangles.position(0);

            surface.d.position(0);
            GL11.glVertexPointer(3, 0, surface.vertices);
            GL11.glNormalPointer(0, surface.normals);
            GL11.glTexCoordPointer(2, 0, surface.d);
            GL11.glDrawElements(4, surface.triangles);
        }

        if (!this.useAnimation) {
            GL11.glEndList();
        }
        GL11.glDisableClientState(32884);
        GL11.glDisableClientState(32888);
        GL11.glDisableClientState(32885);
    }

    if (!this.useAnimation)
        GL11.glCallList(this.displayList);
}

From source file:taiga.code.opengl.ColoredDrawable.java

License:Open Source License

@Override
public void draw(int x, int y, int w, int h) {
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);

    GL11.glVertexPointer(2, 0, createVertices(x, y, w, h));
    GL11.glColorPointer(4, GL11.GL_UNSIGNED_BYTE, 0, colors);

    GL11.glDrawElements(GL11.GL_QUADS, indices);
}

From source file:taiga.code.opengl.NinePatch.java

License:Open Source License

/**
 * Draws this {@link NinePatch} in the given rectangle.  The {@link NinePatch}
 * will expand to fill the entire area, but the behavior for a rectangle smaller
 * than the {@link NinePatch} is undefined.
 * /*from  www . ja v  a 2s  . co m*/
 * @param x The x coordinate to begin drawing at.
 * @param y The y coordinate to begin drawing at.
 * @param w The width of the drawing area.
 * @param h The height of the drawing area.
 */
public void draw(int x, int y, int w, int h) {
    if (texture == null)
        return;

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    texture.bind();

    setCoords(x, y, w, h);

    GL11.glVertexPointer(2, 0, coordinates);
    GL11.glTexCoordPointer(2, 0, texcoords);

    GL11.glDrawElements(GL11.GL_QUADS, indices);
}

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

License:Open Source License

public static void glDrawElements(int a, IntBuffer b) {
    GL11.glDrawElements(a, b);
}

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

License:Open Source License

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

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

License:Open Source License

public static void glDrawElements(int a, ShortBuffer b) {
    GL11.glDrawElements(a, b);
}

From source file:zildo.fwk.gfx.TilePrimitive.java

License:Open Source License

public void render() {

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    vbo.draw(bufs);/* w w w .  j a v a  2 s .c  om*/

    // Le buffer d'indices contient les indices pour 4096 tiles. On doit le limiter au nombre de tiles
    // rellement utilis.
    bufs.indices.limit(nIndices);
    GL11.glDrawElements(GL11.GL_TRIANGLES, bufs.indices);

}