Example usage for org.lwjgl.opengl GL11 glVertex3f

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

Introduction

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

Prototype

public static native void glVertex3f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y,
        @NativeType("GLfloat") float z);

Source Link

Document

Specifies a single vertex between #glBegin Begin and #glEnd End by giving its coordinates in three dimensions.

Usage

From source file:org.agpu.oc.common.tileentity.AdvancedMonitor.java

public void swapBuffers(NBTTagCompound tag) {
    if (worldObj.isRemote) {
        for (int i = 0; i < tag.getInteger("commands"); i++) {
            NBTTagCompound t = tag.getCompoundTag(String.valueOf(i));
            String type = t.getString("type");
            if (type.equals("startDrawing3D")) {
                startDrawing3D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"),
                        t.getInteger("height"), t.getFloat("fov"), t.getFloat("zNear"), t.getFloat("zFar"));
            } else if (type.equals("startDrawing2D")) {
                startDrawing2D(t.getInteger("x"), t.getInteger("y"), t.getInteger("width"),
                        t.getInteger("height"));
            } else if (type.equals("setColor")) {
                GL11.glColor4f(t.getFloat("r"), t.getFloat("g"), t.getFloat("b"), t.getFloat("a"));
            } else if (type.equals("vertex3f")) {
                GL11.glVertex3f(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("vertex2i")) {
                GL11.glVertex2i(t.getInteger("x"), t.getInteger("y"));
            } else if (type.equals("translate")) {
                GL11.glTranslatef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("rotate")) {
                GL11.glRotatef(t.getFloat("angle"), t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("scale")) {
                GL11.glScalef(t.getFloat("x"), t.getFloat("y"), t.getFloat("z"));
            } else if (type.equals("begin")) {
                GL11.glBegin(t.getInteger("m"));
            } else if (type.equals("end")) {
                GL11.glEnd();/*  w  ww . j ava 2s .co  m*/
            } else if (type.equals("string")) {
                Minecraft.getMinecraft().fontRendererObj.drawString(t.getString("string"), t.getInteger("x"),
                        t.getInteger("y"), t.getInteger("color"));
            } else if (type.equals("enable")) {
                GL11.glEnable(t.getInteger("v"));
            } else if (type.equals("disable")) {
                GL11.glDisable(t.getInteger("v"));
            } else {
                System.out.println("Unknown packet type received: " + type);
            }
        }

        GL30.glBindFramebuffer(GL30.GL_FRAMEBUFFER, 0);

        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glPopMatrix();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);
        GL11.glPopMatrix();
        GL11.glPopAttrib();
    }
}

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

License:Open Source License

/**
 * Compiles or and draws a display list.
 * @param listID - The display list handler
 * @param beginMode - The OpenGL begin mode
 * @param compileMode - The OpenGL compile mode
 * @param values - The array of vertices
 *///from w w w .j av a 2  s. c o  m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode,
        float... values) {
    GL11.glNewList(listID, compileMode);
    GL11.glBegin(beginMode);
    for (int i = 0; i < values.length - 2; i += 3)
        GL11.glVertex3f(values[i], values[i + 1], values[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.
 * 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   w  ww. j  a  va 2  s  .c o m
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void compileThreePointList(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 - 2; i += 3, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        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
 *///w  ww.  j  av a  2  s  .c  o 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 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  ww  .  ja  v a 2 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.Immediate.java

License:Open Source License

/**
 * Draws a shape using glBegin / Primitive mode.
 * @param beginMode - OpenGL begin mode//from   w  w w  . ja v a  2  s. co  m
 * @param vertexValues - Array of vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void threePointdraw(@BeginMode int beginMode, float... vertexValues) {
    GL11.glBegin(beginMode);
    for (int i = 0; i < vertexValues.length - 2; i += 3)
        GL11.glVertex3f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2]);
    GL11.glEnd();
}

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

License:Open Source License

/**
 * Draws a shape using glBegin / Primitive mode. And adds color to it. 
 * Note that {@code colorValues} should have four values per vertex.
 * @param beginMode - OpenGL begin mode//w ww  . ja  v  a 2s  . c o  m
 * @param vertexValues - Array of vertices
 * @param colorValues - Array of color vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void threePointdraw(@BeginMode int beginMode, float[] vertexValues, float[] colorValues) {
    GL11.glBegin(beginMode);
    for (int i = 0, j = 0; i < vertexValues.length - 2; i += 3, j += 4) {
        GL11.glColor4f(colorValues[j], colorValues[j + 1], colorValues[j + 2], colorValues[j + 3]);
        GL11.glVertex3f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2]);
    }
    GL11.glEnd();
}

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

License:Open Source License

/**
 * Draws a shape using glBegin / Primitive mode. And adds a texture to it.
 * @param beginMode - OpenGL begin mode//w w  w.  j  a  v a 2 s .  c  om
 * @param textureID - The texture id to be used
 * @param vertexValues - Array of vertices
 * @param textureValues - Array of local texture vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void threePointdraw(@BeginMode int beginMode, int textureID, float[] vertexValues,
        float[] textureValues) {
    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();
}

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

License:Open Source License

/**
 * Draws a shape using glBegin / Primitive mode. Adds color and texture to it. 
 * Note that {@code colorValues} should have four values per vertex.
 * @param beginMode - OpenGL begin mode/*  ww w. jav a  2 s .  co m*/
 * @param textureID - The texture id to be used
 * @param vertexValues - Array of vertices
 * @param colorValues - Array of color vertices
 * @param textureValues - Array of local texture vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void threePointdraw(@BeginMode int beginMode, int textureID, float[] vertexValues,
        float[] colorValues, float[] textureValues) {
    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();
}

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

License:Apache License

@Override
public void create() {
    _callList = GL11.glGenLists(1);// w w  w .j  a  va 2 s .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();
}