List of usage examples for org.lwjgl.opengl GL11 glVertex2f
public static native void glVertex2f(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y);
From source file:net.phatcode.rel.multimedia.Graphics.java
License:Open Source License
private void drawScrolledSprite(float x, float y, float scaleX, float scaleY, float u, float v, int flipmode, SpriteGL sprite) {// w w w .jav a2s .c o m flipmode = getflipMode(flipmode); float x2 = x + sprite.width; float y2 = y + sprite.height; float u1 = ((flipmode & SpriteGL.FLIP_H) == 0) ? sprite.u1 : sprite.u2; float v1 = ((flipmode & SpriteGL.FLIP_V) == 0) ? sprite.v1 : sprite.v2; float u2 = ((flipmode & SpriteGL.FLIP_H) == 0) ? sprite.u2 : sprite.u1; float v2 = ((flipmode & SpriteGL.FLIP_V) == 0) ? sprite.v2 : sprite.v1; if (sprite.textureID != currentTexture) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, sprite.textureID); currentTexture = sprite.textureID; } GL11.glPushMatrix(); GL11.glScalef(scaleX, scaleY, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(u1 + u, v1 + v); GL11.glVertex2f(x, y); GL11.glTexCoord2f(u1 + u, v2 + v); GL11.glVertex2f(x, y2); GL11.glTexCoord2f(u2 + u, v2 + v); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2 + u, v1 + v); GL11.glVertex2f(x2, y); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:net.phatcode.rel.multimedia.Graphics.java
License:Open Source License
private void drawScrolledSprite(float x, float y, float scaleX, float scaleY, float u, float v, float r, float g, float b, float a, int flipmode, SpriteGL sprite) { flipmode = getflipMode(flipmode);/* w ww . j a va 2s . com*/ float x2 = x + sprite.width; float y2 = y + sprite.height; float u1 = ((flipmode & SpriteGL.FLIP_H) == 0) ? sprite.u1 : sprite.u2; float v1 = ((flipmode & SpriteGL.FLIP_V) == 0) ? sprite.v1 : sprite.v2; float u2 = ((flipmode & SpriteGL.FLIP_H) == 0) ? sprite.u2 : sprite.u1; float v2 = ((flipmode & SpriteGL.FLIP_V) == 0) ? sprite.v2 : sprite.v1; if (sprite.textureID != currentTexture) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, sprite.textureID); currentTexture = sprite.textureID; } GL11.glColor4f(r, g, b, a); GL11.glPushMatrix(); GL11.glScalef(scaleX, scaleY, 1.0f); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(u1 + u, v1 + v); GL11.glVertex2f(x, y); GL11.glTexCoord2f(u1 + u, v2 + v); GL11.glVertex2f(x, y2); GL11.glTexCoord2f(u2 + u, v2 + v); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2 + u, v1 + v); GL11.glVertex2f(x2, y); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:net.smert.frameworkgl.opengl.helpers.LegacyRenderHelper.java
License:Apache License
public void vertex(float x, float y) { GL11.glVertex2f(x, y); }
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 ww. j a v a2 s. com*/ @OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated") public static void compileTwoPointList(int listID, @BeginMode int beginMode, @CompileMode int compileMode, float... values) { GL11.glNewList(listID, compileMode); GL11.glBegin(beginMode); for (int i = 0; i < values.length - 1; i += 2) GL11.glVertex2f(values[i], values[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. * 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 *//* w w w . j a v a 2s .co m*/ @OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated") public static void compileTwoPointList(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 - 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(); 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 a v a 2s . 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 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 */// ww w . j a va 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[] 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.Immediate.java
License:Open Source License
/** * Draws a shape using glBegin / Primitive mode. * @param beginMode - OpenGL begin mode//from w ww . j a v a2 s . c om * @param vertexValues - Array of vertices */ @OpenGLInfo(fwdCompatible = false, openGLVersion = "1.1", status = "Deprecated") public static void twoPointdraw(@BeginMode int beginMode, float... vertexValues) { GL11.glBegin(beginMode); for (int i = 0; i < vertexValues.length - 1; i += 2) 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 and color to it. * Note that {@code colorValues} should have four values per vertex. * @param beginMode - OpenGL begin mode/*from w ww . j a va 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 a texture to it. * @param beginMode - OpenGL begin mode// www . j av a 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(); }