Example usage for org.lwjgl.opengl GL11 glEnableClientState

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

Introduction

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

Prototype

public static native void glEnableClientState(@NativeType("GLenum") int cap);

Source Link

Document

Enables a client-side capability.

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);
        }/*from   w  ww.  ja  v a 2 s. c  o  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:src.graphics.common.MeshBuffer.java

License:Open Source License

public static void render(float scale, float rotation, Vec3D offset, FloatBuffer vertBuffer,
        FloatBuffer normBuffer, FloatBuffer textBuffer, int numFacets) {
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glLoadIdentity();/*from w ww .  j  a v  a2s.  co  m*/
    if (numFacets < 1)
        numFacets = vertBuffer.capacity() / VFP;
    if (offset != null)
        GL11.glTranslatef(offset.x, offset.y, offset.z);
    else
        GL11.glTranslatef(0, 0, 0);
    GL11.glRotatef(rotation, 0, 0, 1);
    GL11.glScalef(scale, scale, scale);
    //
    //  Only set the texture buffer if one has been provided:
    if (textBuffer == null) {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
    } else {
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
        GL11.glTexCoordPointer(2, 0, textBuffer);
    }
    //
    //  And only set the normal buffer if one has been provided:
    if (normBuffer == null)
        GL11.glDisableClientState(GL11.GL_NORMAL_ARRAY);
    else {
        GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
        GL11.glNormalPointer(0, normBuffer);
    }
    //
    //  Bind the vertex buffer and render-
    GL11.glVertexPointer(3, 0, vertBuffer);
    GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, numFacets * 3);
}

From source file:src.graphics.common.Rendering.java

License:Open Source License

/**  A generalised interface for stuff that wants to be rendered-
  *///  ww  w.j a va2s.  com
void initSettings() {
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glEnable(GL11.GL_LIGHT0);
    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL11.glEnable(GL11.GL_NORMALIZE); //  IF MISSING, COLOURS ARE TOO BRIGHT.
    GL11.glEnable(GL11.GL_DEPTH_TEST);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glCullFace(GL11.GL_BACK);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f);

    GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE);
}

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   ww w  .  j a v  a 2 s .com*/
 * @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:taiga.gpvm.render.ColorTileRenderer.java

License:Open Source License

@Override
public void render(int pass, ReadableMatrix4 proj, ReadableMatrix4 modelview) {
    if (verts == null || color == null || pass != HardcodedValues.OPAQUE_WORLD_LAYER)
        return;//from  w  w  w.  java 2s .c  o m

    simplecolor.bind();

    simplecolor.setUniformMatrix(projloc, proj);
    simplecolor.setUniformMatrix(mvloc, modelview);

    GL11.glPushClientAttrib(GL11.GL_VERTEX_ARRAY | GL11.GL_COLOR_ARRAY);

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);

    GL11.glEnable(GL11.GL_DEPTH_TEST);

    //There are 3 elements to each vertex
    //stride is zero the vertices are tightly packed.
    GL11.glVertexPointer(3, 0, verts);

    //4 elements in each color: alpha, red, green, and blue
    GL11.glColorPointer(4, true, 0, color);

    GL11.glDrawArrays(GL11.GL_QUADS, 0, verts.limit() / 3);

    GL11.glPopClientAttrib();
}

From source file:tectonicus.rasteriser.lwjgl.LwjglMesh.java

License:BSD License

@Override
public void bind() {
    if (vertices == null)
        return;//from  w w w.  j ava  2  s  .co  m

    assert (isFinalised);
    assert (numVertices > 0);

    org.lwjgl.opengl.Util.checkGLError();

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glVertexPointer(3, 0, vertices);

    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glColorPointer(4, true, 0, colours);

    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
    GL11.glTexCoordPointer(2, 0, texCoords);

    if (texture != null) {
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getId());
    } else {
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
    }

    org.lwjgl.opengl.Util.checkGLError();
}

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

License:Open Source License

public static void glEnableClientState(int a) {
    GL11.glEnableClientState(a);
}

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

License:Open Source License

/**
 * Enable the good type of VBO/*from w  w  w.  j  ava 2  s .c  o  m*/
 *
 * @param vbo
 */
private void enable(VBO vbo) {
    if (vbo.getType().contains("V")) {
        vbo3f = vbo;
        capacity = vbo.capacity();
        GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    }
    if (vbo.getType().contains("C")) {
        GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
    }
}

From source file:view.renderer.GridRenderer.java

public void draw() {

    GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, vID);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, vB, GL15.GL_STATIC_DRAW);
    GL11.glVertexPointer(2, GL11.GL_INT, 2 * 4, 0L);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, cID);
    GL15.glBufferData(GL15.GL_ARRAY_BUFFER, cB, GL15.GL_STATIC_DRAW);
    GL11.glColorPointer(3, GL11.GL_FLOAT, 3 * 4, 0L);

    GL11.glDrawArrays(GL11.GL_QUADS, 0, (linesX + linesY) * 4);

    GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);

    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
}