Example usage for org.lwjgl.opengl GL11 glListBase

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

Introduction

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

Prototype

public static native void glListBase(@NativeType("GLuint") int base);

Source Link

Document

Sets the display list base.

Usage

From source file:com.ardor3d.renderer.lwjgl.LwjglFont.java

License:Open Source License

/**
 * <code>print</code> renders the specified string to a given (x,y) location. The x, y location is in terms of
 * screen coordinates. There are currently two sets of fonts supported: NORMAL and ITALICS.
 * //  ww w .java2s  . c o  m
 * @param r
 * 
 * @param x
 *            the x screen location to start the string render.
 * @param y
 *            the y screen location to start the string render.
 * @param text
 *            the String to render.
 * @param set
 *            the mode of font: NORMAL or ITALICS.
 */
public void print(final Renderer r, final double x, final double y, final ReadOnlyVector3 scale,
        final StringBuffer text, int set) {
    final RendererRecord matRecord = ContextManager.getCurrentContext().getRendererRecord();
    if (set > 1) {
        set = 1;
    } else if (set < 0) {
        set = 0;
    }

    final boolean alreadyOrtho = r.isInOrthoMode();
    if (!alreadyOrtho) {
        r.setOrtho();
    } else {
        LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
        GL11.glPushMatrix();
        GL11.glLoadIdentity();
    }
    GL11.glTranslated(x, y, 0);
    GL11.glScaled(scale.getX(), scale.getY(), scale.getZ());
    GL11.glListBase(base - 32 + (128 * set));

    // Put the string into a "pointer"
    if (text.length() > scratch.capacity()) {
        scratch = BufferUtils.createByteBuffer(text.length());
    } else {
        scratch.clear();
    }

    final int charLen = text.length();
    for (int z = 0; z < charLen; z++) {
        scratch.put((byte) text.charAt(z));
    }
    scratch.flip();
    GL11.glColor4f(fontColor.getRed(), fontColor.getGreen(), fontColor.getBlue(), fontColor.getAlpha());
    // call the list for each letter in the string.
    GL11.glCallLists(scratch);
    // set color back to white
    GL11.glColor4f(1, 1, 1, 1);

    if (!alreadyOrtho) {
        r.unsetOrtho();
    } else {
        LwjglRendererUtil.switchMode(matRecord, GL11.GL_MODELVIEW);
        GL11.glPopMatrix();
    }
}

From source file:org.ajgl.graphics.DisplayList.java

License:Open Source License

/**
 * Draws many display Lists//from w  w w.  j ava2  s  .c om
 * @param listID - The display list handler
 * @param number - The number of lists to draw
 * @param dataType - The OpenGL Data type
 * @param lists - The lists to draw
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void drawLists(int listID, int number, @GLDataType int dataType, ByteBuffer lists) {
    GL11.glListBase(listID);
    GL11.glCallLists(number, dataType, lists);
}

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

License:Open Source License

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

From source file:yk.myengine.optiseq.states.LWJGLFont.java

/**
 * <code>print</code> renders the specified string to a given (x,y)
 * location. The x, y location is in terms of screen coordinates. There are
 * currently two sets of fonts supported: NORMAL and ITALICS.
 *
 * @param x      the x screen location to start the string render.
 * @param y      the y screen location to start the string render.
 * @param scale  scale/*from  w w  w  .  j  a v  a2 s.  c o  m*/
 * @param text   the String to render.
 * @param italic the mode of font: NORMAL or ITALICS.
 */
public void print(final int x, final int y, final Vector3f scale, final String text, int italic) {
    //        RendererRecord matRecord = (RendererRecord) DisplaySystem.getDisplaySystem().getCurrentContext().getRendererRecord();
    if (italic > 1) {
        italic = 1;
    } else if (italic < 0) {
        italic = 0;
    }

    //        if (!alreadyOrtho){
    //todo move to outer function
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
    //        }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPushMatrix();
    GL11.glLoadIdentity();
    GL11.glTranslatef(x, y, 0);
    GL11.glScalef(scale.x, scale.y, scale.z);
    //todo: make italic by matrix, instead of additional data!! (matter of principle)
    //also it must be realized in transformation state together with scale factor!
    GL11.glListBase(base - 32 + (128 * italic));

    //Put the string into a "pointer"
    if (text.length() > scratch.capacity()) {
        scratch = BufferUtils.createByteBuffer(text.length());
    } else {
        scratch.clear();
    }

    final int charLen = text.length();
    for (int z = 0; z < charLen; z++) {
        scratch.put((byte) text.charAt(z));
    }
    scratch.flip();
    GL11.glColor4f(fontColor.x, fontColor.y, fontColor.z, fontColor.w);
    //todo move to right place
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_DEPTH_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    //call the list for each letter in the string.
    GL11.glCallLists(scratch);
    GL11.glDisable(GL11.GL_BLEND);
    //        set color back to white
    //        GL11.glColor4f(fontColor.x, fontColor.y, fontColor.z, fontColor.w);

    //        if (!alreadyOrtho) {
    //todo move to outer function
    GL11.glMatrixMode(GL11.GL_PROJECTION);
    GL11.glPopMatrix();
    //        }
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glPopMatrix();
}