Example usage for org.lwjgl.opengl GL11 glInterleavedArrays

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

Introduction

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

Prototype

public static void glInterleavedArrays(@NativeType("GLenum") int format, @NativeType("GLsizei") int stride,
        @NativeType("void const *") double[] pointer) 

Source Link

Document

Array version of: #glInterleavedArrays InterleavedArrays

Usage

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

License:Open Source License

/**
 * R_DrawAlphaSurfaces/*from  ww  w.  ja  va  2  s. c o m*/
 * Draw water surfaces and windows.
 * The BSP tree is waled front to back, so unwinding the chain
 * of alpha_surfaces will draw back to front, giving proper ordering.
 */
void R_DrawAlphaSurfaces() {
    r_world_matrix.clear();
    //
    // go back to the world matrix
    //
    GL11.glLoadMatrix(r_world_matrix);

    GL11.glEnable(GL11.GL_BLEND);
    GL_TexEnv(GL11.GL_MODULATE);

    // the textures are prescaled up for a better lighting range,
    // so scale it back down
    float intens = gl_state.inverse_intensity;

    GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);

    for (msurface_t s = r_alpha_surfaces; s != null; s = s.texturechain) {
        GL_Bind(s.texinfo.image.texnum);
        c_brush_polys++;
        if ((s.texinfo.flags & Defines.SURF_TRANS33) != 0)
            GL11.glColor4f(intens, intens, intens, 0.33f);
        else if ((s.texinfo.flags & Defines.SURF_TRANS66) != 0)
            GL11.glColor4f(intens, intens, intens, 0.66f);
        else
            GL11.glColor4f(intens, intens, intens, 1);
        if ((s.flags & Defines.SURF_DRAWTURB) != 0)
            EmitWaterPolys(s);
        else if ((s.texinfo.flags & Defines.SURF_FLOWING) != 0) // PGM   9/16/98
            DrawGLFlowingPoly(s.polys); // PGM
        else
            DrawGLPoly(s.polys);
    }

    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);

    r_alpha_surfaces = null;
}

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

License:Open Source License

/**
 * R_DrawBrushModel/*from  w w w .j  a  va  2 s  . c om*/
 */
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();
}

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

License:Open Source License

/**
 * R_DrawWorld//from w ww  .  ja  v  a2 s . c o  m
 */
void R_DrawWorld() {
    if (r_drawworld.value == 0)
        return;

    if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0)
        return;

    currentmodel = r_worldmodel;

    Math3D.VectorCopy(r_newrefdef.vieworg, modelorg);

    entity_t ent = worldEntity;
    // auto cycle the world frame for texture animation
    ent.clear();
    ent.frame = (int) (r_newrefdef.time * 2);
    currententity = ent;

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

    GL11.glColor3f(1, 1, 1);
    // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
    // TODO wird bei multitexture nicht gebraucht
    //gl_lms.clearLightmapSurfaces();

    R_ClearSkyBox();

    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);
    GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (gl_lightmap.value != 0)
        GL_TexEnv(GL11.GL_REPLACE);
    else
        GL_TexEnv(GL11.GL_MODULATE);

    R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node

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

    GL_EnableMultitexture(false);

    DrawTextureChains();
    R_DrawSkyBox();
    R_DrawTriangleOutlines();
}

From source file:org.free.jake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawAlphaSurfaces// w ww . j  av a  2s . co m
 * Draw water surfaces and windows.
 * The BSP tree is waled front to back, so unwinding the chain
 * of alpha_surfaces will draw back to front, giving proper ordering.
 */
void R_DrawAlphaSurfaces() {
    r_world_matrix.clear();
    //
    // go back to the world matrix
    //
    GL11.glLoadMatrix(r_world_matrix);

    GL11.glEnable(GL11.GL_BLEND);
    GL_TexEnv(GL11.GL_MODULATE);

    // the textures are prescaled up for a better lighting range,
    // so scale it back down
    float intens = gl_state.inverse_intensity;

    GL11.glInterleavedArrays(GL11.GL_T2F_V3F, Polygon.BYTE_STRIDE, globalPolygonInterleavedBuf);

    for (msurface_t s = r_alpha_surfaces; s != null; s = s.texturechain) {
        GL_Bind(s.texinfo.image.texnum);
        c_brush_polys++;
        if ((s.texinfo.flags & Defines.SURF_TRANS33) != 0) {
            GL11.glColor4f(intens, intens, intens, 0.33f);
        } else if ((s.texinfo.flags & Defines.SURF_TRANS66) != 0) {
            GL11.glColor4f(intens, intens, intens, 0.66f);
        } else {
            GL11.glColor4f(intens, intens, intens, 1);
        }
        if ((s.flags & Defines.SURF_DRAWTURB) != 0) {
            EmitWaterPolys(s);
        } else if ((s.texinfo.flags & Defines.SURF_FLOWING) != 0) // PGM   9/16/98
        {
            DrawGLFlowingPoly(s.polys); // PGM
        } else {
            DrawGLPoly(s.polys);
        }
    }

    GL_TexEnv(GL11.GL_REPLACE);
    GL11.glColor4f(1, 1, 1, 1);
    GL11.glDisable(GL11.GL_BLEND);

    r_alpha_surfaces = null;
}

From source file:org.free.jake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawBrushModel//w  w  w. j  a v  a  2  s  . c  om
 */
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();

    GL13.glClientActiveTexture(GL_TEXTURE1);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL_EnableMultitexture(false);

    GL11.glPopMatrix();
}

From source file:org.free.jake2.render.lwjgl.Surf.java

License:Open Source License

/**
 * R_DrawWorld/*from w  w w.j  a va  2s  .com*/
 */
void R_DrawWorld() {
    if (r_drawworld.value == 0) {
        return;
    }

    if ((r_newrefdef.rdflags & Defines.RDF_NOWORLDMODEL) != 0) {
        return;
    }

    currentmodel = r_worldmodel;

    Math3D.VectorCopy(r_newrefdef.vieworg, modelorg);

    entity_t ent = worldEntity;
    // auto cycle the world frame for texture animation
    ent.clear();
    ent.frame = (int) (r_newrefdef.time * 2);
    currententity = ent;

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

    GL11.glColor3f(1, 1, 1);
    // memset (gl_lms.lightmap_surfaces, 0, sizeof(gl_lms.lightmap_surfaces));
    // TODO wird bei multitexture nicht gebraucht
    //gl_lms.clearLightmapSurfaces();

    R_ClearSkyBox();

    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);
    GL11.glTexCoordPointer(2, Polygon.BYTE_STRIDE, globalPolygonTexCoord1Buf);
    GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    if (gl_lightmap.value != 0) {
        GL_TexEnv(GL11.GL_REPLACE);
    } else {
        GL_TexEnv(GL11.GL_MODULATE);
    }

    R_RecursiveWorldNode(r_worldmodel.nodes[0]); // root node

    GL13.glClientActiveTexture(GL_TEXTURE1);
    GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY);

    GL_EnableMultitexture(false);

    DrawTextureChains();
    R_DrawSkyBox();
    R_DrawTriangleOutlines();
}

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

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

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

License:Open Source License

public static void glInterleavedArrays(int a, int b, FloatBuffer c) {
    GL11.glInterleavedArrays(a, b, c);
}