Example usage for org.lwjgl.opengl GL11 glNewList

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

Introduction

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

Prototype

public static native void glNewList(@NativeType("GLuint") int n, @NativeType("GLenum") int mode);

Source Link

Document

Begins the definition of a display list.

Usage

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

License:Open Source License

/**
 * Compiles or and draws a display list with color.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 *///from  ww  w .  j  a v  a 2s.  c o  m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileFourPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float[] vertexValues, float[] colorValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 3; i += 4, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glVertex4f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2], vertexValues[i + 3]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with a texture.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param textureValues - Array of local texture vertices
 *//*from   w  w  w. java  2 s . c o  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0; i < vertexValues.length - 1; i += 2) {
        GL11.glTexCoord2f(textureValues[i], textureValues[i + 1]);
        GL11.glVertex2f(vertexValues[i], vertexValues[i + 1]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with a texture.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param textureValues - Array of local texture vertices
 *//* w  w w  .  j  ava  2  s.co  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 2; i += 3, j += 2) {
        GL11.glTexCoord2f(textureValues[j], textureValues[j + 1]);
        GL11.glVertex3f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with a texture.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param textureValues - Array of local texture vertices
 *///ww  w .  jav  a  2 s  . com
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileFourPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 3; i += 4, j += 2) {
        GL11.glTexCoord2f(textureValues[j], textureValues[j + 1]);
        GL11.glVertex4f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2], vertexValues[i + 3]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with color and a texture.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 * @param textureValues - Array of local texture vertices
 *//*from   www.j  av  a2s  . co  m*/
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] colorValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 1; i += 2, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glTexCoord2f(textureValues[i], textureValues[i + 1]);
        GL11.glVertex2f(vertexValues[i], vertexValues[i + 1]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with color and a texture.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 * @param textureValues - Array of local texture vertices
 *///w w w  . j a va2  s  .c om
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] colorValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0, k = 0; i < vertexValues.length - 2; i += 3, j += 4, k += 2) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glTexCoord2f(textureValues[k], textureValues[k + 1]);
        GL11.glVertex3f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

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

License:Open Source License

/**
 * Compiles or and draws a display list with color and a texture.
 * Note that {@code colorValues} should have four values per vertex.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param textureID - The texture id to be used
 * @param vertexValues - The array of vertices
 * @param colorValues - The array of color vertices
 * @param textureValues - Array of local texture vertices
 */// w  w  w.j  a va  2 s .  c om
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileFourPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        int textureID, float[] vertexValues, float[] colorValues, float[] textureValues) {
    GL11.glNewList(listID, compileMode);
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID);
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0, k = 0; i < vertexValues.length - 3; i += 4, j += 4, k += 2) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glTexCoord2f(textureValues[k], textureValues[k + 1]);
        GL11.glVertex4f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2], vertexValues[i + 3]);
    }
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.craftmania.blocks.CrossedBlockBrush.java

License:Apache License

@Override
public void create() {
    _callList = GL11.glGenLists(1);//ww  w .ja v  a 2s.c  o m

    GL11.glNewList(_callList, GL11.GL_COMPILE);
    GL11.glBegin(GL11.GL_QUADS);

    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y());
    GL11.glVertex3f(-0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y());
    GL11.glVertex3f(0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(-0.5f, -0.5f, -0.5f);

    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y());
    GL11.glVertex3f(0.5f, 0.5f, -0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y());
    GL11.glVertex3f(-0.5f, 0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x() + _textureSize.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(-0.5f, -0.5f, 0.5f);
    GL11.glTexCoord2f(_texturePosition.x(), _texturePosition.y() + _textureSize.y());
    GL11.glVertex3f(0.5f, -0.5f, -0.5f);
    GL11.glEnd();
    GL11.glEndList();
}

From source file:org.craftmania.world.Sky.java

License:Apache License

private void drawShpere(float x, float y, float z) {
    GL11.glPushMatrix();/*  w w w .j  a v  a  2s.  c  o m*/
    GL11.glTranslatef(x, y, z);
    GL11.glColor3f(_color.x(), _color.y(), _color.z());
    if (_sphereCallList == 0) {
        _sphereCallList = GL11.glGenLists(1);
        GL11.glNewList(_sphereCallList, GL11.GL_COMPILE_AND_EXECUTE);
        GL11.glBegin(GL11.GL_TRIANGLE_FAN);
        GL11.glVertex3f(0, 0, 0);
        for (int i = 0; i <= _vertices; ++i) {
            float angle = MathHelper.f_2PI / _vertices * i;
            float xx = MathHelper.cos(angle) * _radius;
            float zz = MathHelper.sin(angle) * _radius;
            GL11.glVertex3f(xx, -_bend, zz);
        }
        GL11.glEnd();
        GL11.glEndList();
    } else {
        GL11.glCallList(_sphereCallList);
    }
    GL11.glPopMatrix();
}

From source file:org.craftmania.world.Sky.java

License:Apache License

private void drawClouds(float x, float y, float z) {
    GL11.glPushMatrix();//from  www. ja  va2  s.  co m
    GL11.glTranslatef(x, y, z);
    if (_cloudsCallList == 0) {
        _cloudsCallList = GL11.glGenLists(1);
        GL11.glNewList(_cloudsCallList, GL11.GL_COMPILE_AND_EXECUTE);
        float hw = _cloudsTexWidth / 2.0f;
        float hh = _cloudsTexHeight / 2.0f;

        hw *= _cloudsScale;
        hh *= _cloudsScale;

        GL11.glBegin(GL11.GL_QUADS);

        GL11.glTexCoord2f(0, 0);
        GL11.glVertex3f(-hw, 0, -hh);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex3f(+hw, 0, -hh);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex3f(+hw, 0, +hh);

        GL11.glTexCoord2f(0, 1);
        GL11.glVertex3f(-hw, 0, +hh);

        GL11.glEnd();

        GL11.glEndList();
    } else {
        GL11.glCallList(_cloudsCallList);
    }
    GL11.glPopMatrix();
}