List of usage examples for org.lwjgl.opengl GL11 glBlendFunc
public static void glBlendFunc(@NativeType("GLenum") int sfactor, @NativeType("GLenum") int dfactor)
From source file:io.flob.blackheart.DisplayDriver.java
License:Open Source License
private void init_GL() { GL11.glClearColor(0.1F, 0.1F, 0.1F, 1.0F); GL11.glEnable(GL11.GL_BLEND);//www . j a va 2 s. c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(60.0f, ((float) Display.getWidth()) / ((float) Display.getHeight()), 0.1f, 40.0f); }
From source file:io.flob.clicker.DisplayDriver.java
License:Open Source License
private void init_GL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();// w ww . j av a 2 s . c o m GL11.glOrtho(0, width, height, 0, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0.1f, 0.1f, 0.1f, 1.0f); GL11.glClearDepth(1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawOval(int x, int y, int width, int height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from www .j a v a 2 s .c om*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POINTS); { for (double angle = 0; angle <= 90; angle += .5) { double xLoc = x + width * Math.cos(angle * (Math.PI / 180)); double yLoc = y + height * Math.sin(angle * (Math.PI / 180)); double distanceY = yLoc - y; double distanceX = xLoc - x; GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2); GL11.glVertex2d(xLoc - distanceX * 2, yLoc - (distanceY) * 2 + distanceY * 2); GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2 + distanceY * 2); GL11.glVertex2d(xLoc + 1, yLoc - (distanceY) * 2); } } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillOval(double x0, double y0, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//w w w. ja va2s. c om GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POLYGON); { for (int i = 360; 0 <= i; i -= 2) GL11.glVertex2d(x0 + width * Math.cos(i * (Math.PI / 180)), y0 + height * Math.sin(i * (Math.PI / 180))); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawCustomPolygon(int[] x, int[] y, Color color) { if (color.getAlpha() != 0 && x.length == y.length) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from w w w.j av a2 s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { for (int i = 0; i < x.length; i++) { if (i < x.length - 1) { GL11.glVertex2f(x[i], y[i]); GL11.glVertex2f(x[i + 1], y[i + 1]); } else { GL11.glVertex2f(x[i], y[i]); GL11.glVertex2f(x[0], y[0]); } } } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillCustomPolygon(double x, double y, double[][] positions, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/* ww w.j a v a 2 s . co m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_POLYGON); { for (int i = 0; i < positions.length; i++) GL11.glVertex2d(x + positions[i][0], y + positions[i][1]); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawLine(int x0, int y0, int x1, int y1, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from ww w . j ava 2 s . c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { GL11.glVertex2f(x0, y0); GL11.glVertex2f(x1, y1); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void fillRectangle(double x, double y, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);/*from w ww . j a v a2 s. c o m*/ GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_QUADS); { GL11.glVertex2d(x, y); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawRectangle(double x, double y, double width, double height, Color color) { if (color.getAlpha() != 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND);//from w w w.j a va 2 s . c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f((color.getRed() / 255.0f), (color.getGreen() / 255.0f), (color.getBlue() / 255.0f), (color.getAlpha() / 255.0f)); GL11.glBegin(GL11.GL_LINES); { GL11.glVertex2d(x, y); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y + height); GL11.glVertex2d(x + width, y); GL11.glVertex2d(x + width, y); GL11.glVertex2d(x, y); } GL11.glEnd(); GL11.glEnable(GL11.GL_TEXTURE_2D); } }
From source file:io.github.minecraftgui.controllers.Render.java
License:Open Source License
public void drawTexture(Texture texture, double x, double y, double width, double height) { GL11.glEnable(GL11.GL_TEXTURE_2D);/*from w w w. ja v a2 s . c om*/ GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture.getTextureID()); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1, 1, 1, 1); GL11.glBegin(GL11.GL_QUADS); { GL11.glTexCoord2f(0, 0); GL11.glVertex2d(x, y); GL11.glTexCoord2f(0, texture.getHeight()); GL11.glVertex2d(x, y + height); GL11.glTexCoord2f(texture.getWidth(), texture.getHeight()); GL11.glVertex2d(x + width, y + height); GL11.glTexCoord2f(texture.getWidth(), 0); GL11.glVertex2d(x + width, y); } GL11.glEnd(); modInterface.bindMinecraftTextures(); }