Example usage for org.lwjgl.opengl GL11 glBegin

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

Introduction

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

Prototype

public static native void glBegin(@NativeType("GLenum") int mode);

Source Link

Document

Begins the definition of vertex attributes of a sequence of primitives to be transferred to the GL.

Usage

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  ww .j a va 2s.c om
 * @param vertexValues - Array of vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void fourPointdraw(@BeginMode int beginMode, float... vertexValues) {
    GL11.glBegin(beginMode);
    for (int i = 0; i < vertexValues.length - 3; i += 4)
        GL11.glVertex4f(vertexValues[i], vertexValues[i + 1], vertexValues[i + 2], vertexValues[i + 3]);
    GL11.glEnd();
}

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

License:Open Source License

/**
 * Draws a shape using glBegin / Primitive mode. adds and color to it. 
 * Note that {@code colorValues} should have four values per vertex.
 * @param beginMode - OpenGL begin mode/*www  .ja v a  2  s  .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 twoPointdraw(@BeginMode int beginMode, float[] vertexValues, float[] colorValues) {
    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.glVertex2f(vertexValues[i], vertexValues[i + 1]);
    }
    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//ww  w  . j a v a 2 s.  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 color to it. 
 * Note that {@code colorValues} should have four values per vertex.
 * @param beginMode - OpenGL begin mode/* w  w  w  .j  a v a2  s  .  c om*/
 * @param vertexValues - Array of vertices
 * @param colorValues - Array of color vertices
 */
@OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated")
public static void fourPointdraw(@BeginMode int beginMode, float[] vertexValues, float[] colorValues) {
    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();
}

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//from   w  ww .  j a va 2 s  .  c  o m
 * @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 twoPointdraw(@BeginMode int beginMode, int textureID, float[] vertexValues,
        float[] textureValues) {
    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();
}

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/*from w w  w . ja  v a2 s.com*/
 * @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. And adds a texture to it.
 * @param beginMode - OpenGL begin mode/*from ww  w .  j  ava 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 fourPointdraw(@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 - 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();
}

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//from ww w .  j  a  va  2s. 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 twoPointdraw(@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; 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();
}

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//  w w w .  j  av  a2  s . c  o  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.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//from   ww w .  j  a va2 s. com
 * @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 fourPointdraw(@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 - 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();
}