Example usage for org.lwjgl.opengl GL11 glDisableClientState

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

Introduction

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

Prototype

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

Source Link

Document

Disables a client-side capability.

Usage

From source file:im.bci.jnuit.lwjgl.sprite.SpriteBatcher.java

License:Open Source License

public void end() {
    flush();
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
}

From source file:io.root.gfx.glutils.GL.java

License:Apache License

public static void glDisableClientState(int cap) {
    GL11.glDisableClientState(cap);
}

From source file:ion2d.INDirector.java

License:Open Source License

protected void disableDefaultGLStates() {
    if (Display.isCreated() == false)
        return;//from w  ww.ja  va 2 s . c om
    GL11.glDisableClientState(GL11.GL_VERTEX_ARRAY);
    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
}

From source file:ion2d.INGrid3D.java

License:Open Source License

/**
 * Draw the Grid3D to the output/* ww w.j ava  2 s .c o m*/
 */
public void blit() {
    // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
    // Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY
    // Unneeded states: GL_COLOR_ARRAY
    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);

    GL11.glVertexPointer(3, 0, this.vertices);
    GL11.glTexCoordPointer(2, 0, this.textureCoordinates);
    GL11.glDrawElements(GL11.GL_TRIANGLES, this.indices);

    //Restore GL Default State
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
}

From source file:ion2d.INTiledGrid3D.java

License:Open Source License

/**
 * Draws the Grid3D to the output/*from  w w w . j a  v a2 s .com*/
 */
public void blit() {
    // Default GL states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_COLOR_ARRAY, GL_TEXTURE_COORD_ARRAY
    // Needed states: GL_TEXTURE_2D, GL_VERTEX_ARRAY, GL_TEXTURE_COORD_ARRAY
    // Unneeded states: GL_COLOR_ARRAY
    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);

    GL11.glVertexPointer(3, 0, this.vertices);
    GL11.glTexCoordPointer(2, 0, this.textureCoordinates);
    GL11.glDrawElements(GL11.GL_QUADS, this.indices);

    //Restore GL Default State
    GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
}

From source file:jake2.desktop.LWJGLAdapter.java

License:Open Source License

public void glDisableClientState(int state) {
    GL11.glDisableClientState(state);
}

From source file:jpcsp.graphics.RE.RenderingEngineLwjgl.java

License:Open Source License

@Override
public void disableClientState(int type) {
    GL11.glDisableClientState(clientStateToGL[type]);
}

From source file:kuake2.render.lwjgl.Main.java

License:Open Source License

/**
 * R_DrawParticles// w  w  w  . jav a  2s  . c o  m
 */
void R_DrawParticles() {

    if (gl_ext_pointparameters.value != 0.0f && qglPointParameterfEXT) {

        //GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY);
        GL11.glVertexPointer(3, 0, particle_t.vertexArray);
        GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
        GL11.glColorPointer(4, true, 0, particle_t.getColorAsByteBuffer());

        GL11.glDepthMask(false);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        GL11.glPointSize(gl_particle_size.value);

        GL11.glDrawArrays(GL11.GL_POINTS, 0, r_newrefdef.num_particles);

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

        GL11.glDisable(GL11.GL_BLEND);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glDepthMask(true);
        GL11.glEnable(GL11.GL_TEXTURE_2D);

    } else {
        GL_DrawParticles(r_newrefdef.num_particles);
    }
}

From source file:kuake2.render.lwjgl.Mesh.java

License:Open Source License

/**
 * GL_DrawAliasFrameLerp//from   ww  w  .j av  a 2 s . c  o m
 * <p/>
 * interpolates between two frames and origins
 * FIXME: batch lerp all vertexes
 */
void GL_DrawAliasFrameLerp(qfiles.dmdl_t paliashdr, float backlerp) {
    qfiles.daliasframe_t frame = paliashdr.aliasFrames[currententity.frame];

    int[] verts = frame.verts;

    qfiles.daliasframe_t oldframe = paliashdr.aliasFrames[currententity.oldframe];

    int[] ov = oldframe.verts;

    float alpha;
    if ((currententity.flags & Defines.RF_TRANSLUCENT) != 0)
        alpha = currententity.alpha;
    else
        alpha = 1.0f;

    // PMM - added double shell
    if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
            | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0)
        GL11.glDisable(GL11.GL_TEXTURE_2D);

    float frontlerp = 1.0f - backlerp;

    // move should be the delta back to the previous frame * backlerp
    Math3D.VectorSubtract(currententity.oldorigin, currententity.origin, frontv);
    Math3D.AngleVectors(currententity.angles, vectors[0], vectors[1], vectors[2]);

    move[0] = Math3D.DotProduct(frontv, vectors[0]); // forward
    move[1] = -Math3D.DotProduct(frontv, vectors[1]); // left
    move[2] = Math3D.DotProduct(frontv, vectors[2]); // up

    Math3D.VectorAdd(move, oldframe.translate, move);

    for (int i = 0; i < 3; i++) {
        move[i] = backlerp * move[i] + frontlerp * frame.translate[i];
        frontv[i] = frontlerp * frame.scale[i];
        backv[i] = backlerp * oldframe.scale[i];
    }

    // ab hier wird optimiert

    GL_LerpVerts(paliashdr.num_xyz, ov, verts, move, frontv, backv);

    //GL11.glEnableClientState( GL11.GL_VERTEX_ARRAY );
    GL11.glVertexPointer(3, 0, vertexArrayBuf);

    // PMM - added double damage shell
    if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
            | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0) {
        GL11.glColor4f(shadelight[0], shadelight[1], shadelight[2], alpha);
    } else {
        GL11.glEnableClientState(GL11.GL_COLOR_ARRAY);
        GL11.glColorPointer(4, 0, colorArrayBuf);

        //
        // pre light everything
        //
        FloatBuffer color = colorArrayBuf;
        float l;
        int size = paliashdr.num_xyz;
        int j = 0;
        for (int i = 0; i < size; i++) {
            l = shadedots[(verts[i] >>> 24) & 0xFF];
            color.put(j, l * shadelight[0]);
            color.put(j + 1, l * shadelight[1]);
            color.put(j + 2, l * shadelight[2]);
            color.put(j + 3, alpha);
            j += 4;
        }
    }

    ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE0);
    GL11.glTexCoordPointer(2, 0, textureArrayBuf);
    //GL11.glEnableClientState( GL11.GL_TEXTURE_COORD_ARRAY);

    int pos = 0;
    int[] counts = paliashdr.counts;

    IntBuffer srcIndexBuf = null;

    FloatBuffer dstTextureCoords = textureArrayBuf;
    FloatBuffer srcTextureCoords = paliashdr.textureCoordBuf;

    int dstIndex = 0;
    int srcIndex = 0;
    int count;
    int mode;
    int size = counts.length;
    for (int j = 0; j < size; j++) {

        // get the vertex count and primitive type
        count = counts[j];
        if (count == 0)
            break; // done

        srcIndexBuf = paliashdr.indexElements[j];

        mode = GL11.GL_TRIANGLE_STRIP;
        if (count < 0) {
            mode = GL11.GL_TRIANGLE_FAN;
            count = -count;
        }
        srcIndex = pos << 1;
        srcIndex--;
        for (int k = 0; k < count; k++) {
            dstIndex = srcIndexBuf.get(k) << 1;
            dstTextureCoords.put(dstIndex, srcTextureCoords.get(++srcIndex));
            dstTextureCoords.put(++dstIndex, srcTextureCoords.get(++srcIndex));
        }

        GL11.glDrawElements(mode, srcIndexBuf);
        pos += count;
    }

    // PMM - added double damage shell
    if ((currententity.flags & (Defines.RF_SHELL_RED | Defines.RF_SHELL_GREEN | Defines.RF_SHELL_BLUE
            | Defines.RF_SHELL_DOUBLE | Defines.RF_SHELL_HALF_DAM)) != 0)
        GL11.glEnable(GL11.GL_TEXTURE_2D);

    GL11.glDisableClientState(GL11.GL_COLOR_ARRAY);
}

From source file:kuake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawBrushModel//from   w ww .  j av a  2s  .c  o  m
 */
void R_DrawBrushModel(entity_t e) {
    if (currentmodel.nummodelsurfaces == 0)
        return;

    currententity = e;
    gl_state.currenttextures[0] = gl_state.currenttextures[1] = -1;

    boolean rotated;
    if (e.angles[0] != 0 || e.angles[1] != 0 || e.angles[2] != 0) {
        rotated = true;
        for (int i = 0; i < 3; i++) {
            mins[i] = e.origin[i] - currentmodel.radius;
            maxs[i] = e.origin[i] + currentmodel.radius;
        }
    } else {
        rotated = false;
        Math3D.VectorAdd(e.origin, currentmodel.mins, mins);
        Math3D.VectorAdd(e.origin, currentmodel.maxs, maxs);
    }

    if (R_CullBox(mins, maxs))
        return;

    GL11.glColor3f(1, 1, 1);

    // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));

    // TODO wird beim multitexturing nicht gebraucht
    //gl_lms.clearLightmapSurfaces();

    Math3D.VectorSubtract(r_newrefdef.vieworg, e.origin, modelorg);
    if (rotated) {
        Math3D.VectorCopy(modelorg, org);
        Math3D.AngleVectors(e.angles, forward, right, up);
        modelorg[0] = Math3D.DotProduct(org, forward);
        modelorg[1] = -Math3D.DotProduct(org, right);
        modelorg[2] = Math3D.DotProduct(org, up);
    }

    GL11.glPushMatrix();

    e.angles[0] = -e.angles[0]; // stupid quake bug
    e.angles[2] = -e.angles[2]; // stupid quake bug
    R_RotateForEntity(e);
    e.angles[0] = -e.angles[0]; // stupid quake bug
    e.angles[2] = -e.angles[2]; // stupid quake bug

    GL_EnableMultitexture(true);
    GL_SelectTexture(GL_TEXTURE0);
    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);
    GL_SelectTexture(GL_TEXTURE1);
    GL_TexEnv(GL11.GL_MODULATE);
    GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    R_DrawInlineBModel();

    ARBMultitexture.glClientActiveTextureARB(GL_TEXTURE1);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL_EnableMultitexture(false);

    GL11.glPopMatrix();
}