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:rtype.Prototyp.java
License:Open Source License
private void applyDistorsions() { if (player1 == null) return;/*w w w .j av a 2 s . com*/ float chargeP = player1.power / PlayerShip.MAX_POWER; float R_WIDTH = 350 * chargeP; float R_HEIGHT = 200 * chargeP; float MIDDLE_X_ON_SCREEN = R_WIDTH / 2 * chargeP; float R_POSITION_X = player1.position.x + 25; float R_POSITION_Y = player1.position.y - R_HEIGHT / 2; float TEXT_OUT_X_LOW = (R_POSITION_X + (SCREEN_WIDTH / 2f)) / 1024f; float TEXT_OUT_X_HIGH = (R_POSITION_X + R_WIDTH + (SCREEN_WIDTH / 2f)) / 1024; float TEXT_OUT_Y_LOW = (R_POSITION_Y + (SCREEN_HEIGHT / 2f)) / 1024; float TEXT_OUT_Y_HIGH = (R_POSITION_Y + R_HEIGHT + (SCREEN_HEIGHT / 2f)) / 1024; float TEXT_IN_X_LOW = (R_POSITION_X + R_WIDTH / 2 + (SCREEN_WIDTH / 2f)) / 1024f; float TEXT_IN_X_HIGH = (R_POSITION_X + R_WIDTH / 2 + 1 + (SCREEN_WIDTH / 2f)) / 1024; float TEXT_IN_Y_LOW = (R_POSITION_Y + R_HEIGHT / 2 + (SCREEN_HEIGHT / 2f)) / 1024f; float TEXT_IN_Y_HIGH = (R_POSITION_Y + R_HEIGHT / 2 + 1 + (SCREEN_HEIGHT / 2f)) / 1024; float SCR_OUT_X_LOW = R_POSITION_X; float SCR_OUT_X_HIGH = R_POSITION_X + R_WIDTH; float SCR_OUT_Y_LOW = R_POSITION_Y; float SCR_OUT_Y_HIGH = R_POSITION_Y + R_HEIGHT; float SCR_IN_X_LOW = R_POSITION_X + MIDDLE_X_ON_SCREEN; float SCR_IN_X_HIGH = R_POSITION_X + MIDDLE_X_ON_SCREEN + 1; float SCR_IN_Y_LOW = R_POSITION_Y + R_HEIGHT / 2; float SCR_IN_Y_HIGH = R_POSITION_Y + R_HEIGHT / 2 + 1; GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 0.75f); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(TEXT_IN_X_HIGH, TEXT_IN_Y_HIGH); GL11.glVertex2f(SCR_IN_X_HIGH, SCR_IN_Y_HIGH); // Lower right GL11.glTexCoord2f(TEXT_OUT_X_HIGH, TEXT_OUT_Y_HIGH); GL11.glVertex2f(SCR_OUT_X_HIGH, SCR_OUT_Y_HIGH); //Lower left GL11.glTexCoord2f(TEXT_OUT_X_HIGH, TEXT_OUT_Y_LOW); GL11.glVertex2f(SCR_OUT_X_HIGH, SCR_OUT_Y_LOW); //upper left GL11.glTexCoord2f(TEXT_IN_X_HIGH, TEXT_IN_Y_LOW); GL11.glVertex2f(SCR_IN_X_HIGH, SCR_IN_Y_LOW); // //upper right } GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(TEXT_IN_X_HIGH, TEXT_IN_Y_LOW); GL11.glVertex2f(SCR_IN_X_HIGH, SCR_IN_Y_LOW); // Lower right GL11.glTexCoord2f(TEXT_OUT_X_HIGH, TEXT_OUT_Y_LOW); GL11.glVertex2f(SCR_OUT_X_HIGH, SCR_OUT_Y_LOW); //Lower left GL11.glTexCoord2f(TEXT_OUT_X_LOW, TEXT_OUT_Y_LOW); GL11.glVertex2f(SCR_OUT_X_LOW, SCR_OUT_Y_LOW); //upper left GL11.glTexCoord2f(TEXT_IN_X_LOW, TEXT_IN_Y_LOW); GL11.glVertex2f(SCR_IN_X_LOW, SCR_IN_Y_LOW); // //upper right } GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(TEXT_IN_X_LOW, TEXT_IN_Y_LOW); GL11.glVertex2f(SCR_IN_X_LOW, SCR_IN_Y_LOW); // Lower right GL11.glTexCoord2f(TEXT_OUT_X_LOW, TEXT_OUT_Y_HIGH); GL11.glVertex2f(SCR_OUT_X_LOW, SCR_OUT_Y_HIGH); //Lower left GL11.glTexCoord2f(TEXT_OUT_X_HIGH, TEXT_OUT_Y_HIGH); GL11.glVertex2f(SCR_OUT_X_HIGH, SCR_OUT_Y_HIGH); //upper left GL11.glTexCoord2f(TEXT_IN_X_HIGH, TEXT_IN_Y_HIGH); GL11.glVertex2f(SCR_IN_X_HIGH, SCR_IN_Y_HIGH); // //upper right } GL11.glEnd(); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(TEXT_IN_X_LOW, TEXT_IN_Y_LOW); GL11.glVertex2f(SCR_IN_X_LOW, SCR_IN_Y_LOW); // Lower right GL11.glTexCoord2f(TEXT_OUT_X_LOW, TEXT_OUT_Y_LOW); GL11.glVertex2f(SCR_OUT_X_LOW, SCR_OUT_Y_LOW); //Lower left GL11.glTexCoord2f(TEXT_OUT_X_LOW, TEXT_OUT_Y_HIGH); GL11.glVertex2f(SCR_OUT_X_LOW, SCR_OUT_Y_HIGH); //upper left GL11.glTexCoord2f(TEXT_IN_X_LOW, TEXT_IN_Y_HIGH); GL11.glVertex2f(SCR_IN_X_LOW, SCR_IN_Y_HIGH); // //upper right } GL11.glEnd(); //GL11.glBlendFunc(GL11.GL_SRC_ALPHA,GL11.GL_ONE); GL11.glColor4f(1, 1, 1, 1); }
From source file:rtype.Prototyp.java
License:Open Source License
public void fadeScreen(boolean draw_fb) // draw_fb is a quick and dirty fix, fb should be in a specificl layer "postFadeEffect" or something { if (fadeAlpha > 0.1) { GL11.glLoadIdentity();/*from w w w.ja v a 2 s. co m*/ GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z); GL11.glColor4f(0, 0, 0, fadeAlpha / 1.2f); GL11.glDisable(GL11.GL_TEXTURE_2D); //GL11.glColor4f(0.5f,0.5f,0.5f,0.5f); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2f(Prototyp.SCREEN_WIDTH / 2, -Prototyp.SCREEN_HEIGHT / 2); GL11.glVertex2f(-Prototyp.SCREEN_WIDTH / 2, -Prototyp.SCREEN_HEIGHT / 2); GL11.glVertex2f(-Prototyp.SCREEN_WIDTH / 2, Prototyp.SCREEN_HEIGHT / 2); GL11.glVertex2f(Prototyp.SCREEN_WIDTH / 2, Prototyp.SCREEN_HEIGHT / 2); } GL11.glEnd(); GL11.glColor4f(1, 1, 1, 1); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); } if (player1 != null && player1.orb != null && player1.orb.fb != null && player1.orb.fb.displayAnimation && draw_fb) { player1.orb.fb.updateTick(); player1.orb.fb.draw(fadeAlpha * 2); } }
From source file:rtype.Prototyp.java
License:Open Source License
private void drawPowerBar() { GL11.glLoadIdentity();// ww w .j a v a 2s . c om GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z); GL11.glColor4f(0, 0, 1, 1f); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(0, -0); GL11.glVertex2f(0, -0 - 100); GL11.glVertex2f(0 + player1.power * 10 / 4, 0); GL11.glVertex2f(0 + player1.power * 10 / 4, 0 - 100); GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glColor4f(1, 1, 1, 1f); }
From source file:rtype.Prototyp.java
License:Open Source License
private void renderScanLines() { GL11.glLoadIdentity();/*from ww w . j a va 2 s . co m*/ GL11.glTranslatef(0, 0, Prototyp.DEFAULT_Z); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureLoader.getTexture(IEntity.SCANLINE).getTextureId()); GL11.glColor4f(1, 1, 1, 1); GL11.glBegin(GL11.GL_QUADS); GL11.glTexCoord2f(20, 0); //Upper right GL11.glVertex2f(SCREEN_WIDTH / 4, -SCREEN_HEIGHT / 4); GL11.glTexCoord2f(0, 0); //Upper left GL11.glVertex2f(-SCREEN_WIDTH / 4, -SCREEN_HEIGHT / 4); GL11.glTexCoord2f(0, 20); //Lower left GL11.glVertex2f(-SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4); GL11.glTexCoord2f(20, 20); // Lower right GL11.glVertex2f(SCREEN_WIDTH / 4, SCREEN_HEIGHT / 4); GL11.glEnd(); }
From source file:shadowmage.ancient_structures.client.render.RenderTools.java
License:Open Source License
public static void renderTexturedQuad(float x1, float y1, float x2, float y2, float u1, float v1, float u2, float v2) { GL11.glBegin(GL11.GL_QUADS);//from w ww .ja v a 2 s . c o m GL11.glTexCoord2f(u1, v1); GL11.glVertex2f(x1, y1); GL11.glTexCoord2f(u1, v2); GL11.glVertex2f(x1, y2); GL11.glTexCoord2f(u2, v2); GL11.glVertex2f(x2, y2); GL11.glTexCoord2f(u2, v1); GL11.glVertex2f(x2, y1); GL11.glEnd(); }
From source file:spaceshooter.entities.bullets.EntityPlayerBullet.java
License:Creative Commons License
@Override public void draw() { GL11.glPushMatrix();/*www .j a v a 2 s .com*/ GL11.glColor3d(0, 100, 100); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:spaceshooter.entities.EntityEnemy.java
License:Creative Commons License
@Override public void draw() { GL11.glPushMatrix();/*from w w w . j av a 2 s . co m*/ GL11.glColor3d(100, 0, 0); GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); GL11.glPopMatrix(); }
From source file:spaceshooter.entities.EntityPlayer.java
License:Creative Commons License
@Override public void draw() { GL11.glColor3d(0, 0, 100);/* w ww . ja va 2s . co m*/ GL11.glBegin(GL11.GL_QUADS); GL11.glVertex2f(x, y); GL11.glVertex2f(x + width, y); GL11.glVertex2f(x + width, y + height); GL11.glVertex2f(x, y + height); GL11.glEnd(); }
From source file:src.user.Minimap.java
License:Open Source License
private void renderTex(float fadeVal) { ///* www . j av a 2s . c o m*/ //You draw a diamond-shaped area around the four points- final float w = xdim(), h = ydim(), x = xpos(), y = ypos(); GL11.glBegin(GL11.GL_QUADS); if (fadeVal == -1) GL11.glTexCoord2f(0, 0); else GL11.glTexCoord3f(0, 0, fadeVal); GL11.glVertex2f(x, y + (h / 2)); if (fadeVal == -1) GL11.glTexCoord2f(0, 1); else GL11.glTexCoord3f(0, 1, fadeVal); GL11.glVertex2f(x + (w / 2), y + h); if (fadeVal == -1) GL11.glTexCoord2f(1, 1); else GL11.glTexCoord3f(1, 1, fadeVal); GL11.glVertex2f(x + w, y + (h / 2)); if (fadeVal == -1) GL11.glTexCoord2f(1, 0); else GL11.glTexCoord3f(1, 0, fadeVal); GL11.glVertex2f(x + (w / 2), y); GL11.glEnd(); }
From source file:tileengine.MenuItem.java
public void drawBox() { for (int x = 0; x < 3; x++) { int selectedTexture = 197, selectedColumn = 0, selectedRow = 0; //Selvitetn milloin piirretn textboxin reunoja if (x == 0) { selectedTexture = 196;//w ww.ja v a 2 s . c om } if (x == 2) { selectedTexture = 198; } if (selected) { selectedTexture += 3; } //pieni hksi for loopin avulla valitun texturen selvittmiseksi for (selectedColumn = selectedTexture; selectedColumn >= GameHandler.spriteSheetX / GameHandler.spriteSheetScale; selectedColumn -= 32) { selectedRow++; } float textureXOffSet = ((float) 1 / GameHandler.spriteSheetScale) * selectedColumn; float textureYOffSet = ((float) 1 / GameHandler.spriteSheetScale) * selectedRow; GL11.glTexCoord2f(textureXOffSet + (float) 1 / GameHandler.spriteSheetScale, textureYOffSet + (float) 1 / GameHandler.spriteSheetScale); GL11.glVertex2f(posX + 64 + x * 64, posY); GL11.glTexCoord2f(textureXOffSet, textureYOffSet + (float) 1 / GameHandler.spriteSheetScale); GL11.glVertex2f(posX + x * 64, posY); GL11.glTexCoord2f(textureXOffSet, textureYOffSet); GL11.glVertex2f(posX + x * 64, posY + 64); GL11.glTexCoord2f(textureXOffSet + (float) 1 / GameHandler.spriteSheetScale, textureYOffSet); GL11.glVertex2f(posX + 64 + x * 64, posY + 64); } }