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:hellfirepvp.astralsorcery.client.render.tile.TESRRitualPedestal.java
License:Open Source License
private void renderCrystalStack(TileRitualPedestal te, double x, double y, double z) { ItemStack i = te.getInventoryHandler().getStackInSlot(0); if (!i.isEmpty()) { Item it = i.getItem();/*ww w. j a v a 2s.c o m*/ if (it instanceof ItemTunedCrystalBase) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glPushMatrix(); boolean celestial = it instanceof ItemTunedCelestialCrystal; Color c = celestial ? BlockCollectorCrystalBase.CollectorCrystalType.CELESTIAL_CRYSTAL.displayColor : BlockCollectorCrystalBase.CollectorCrystalType.ROCK_CRYSTAL.displayColor; long sBase = 1553015L; sBase ^= (long) te.getPos().getX(); sBase ^= (long) te.getPos().getY(); sBase ^= (long) te.getPos().getZ(); RenderingUtils.renderLightRayEffects(x + 0.5, y + 1.3, z + 0.5, c, sBase, ClientScheduler.getClientTick(), 20, 50, 25); GL11.glTranslated(x + 0.5, y + 1, z + 0.5); GL11.glScaled(0.6, 0.6, 0.6); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); TESRCollectorCrystal.renderCrystal(celestial, true); GL11.glPopMatrix(); GL11.glPopAttrib(); } } }
From source file:hellfirepvp.astralsorcery.client.util.Blending.java
License:Open Source License
public void apply() { GL11.glBlendFunc(sfactor, dfactor); }
From source file:hellfirepvp.astralsorcery.client.util.RenderingUtils.java
License:Open Source License
public static void renderLightRayEffects(double x, double y, double z, Color effectColor, long seed, long continuousTick, int dstJump, float scale, int countFancy, int countNormal) { rand.setSeed(seed);/*from w w w. j a va2 s . c o m*/ GL11.glPushMatrix(); GL11.glTranslated(x, y, z); int fancy_count = !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics ? countNormal : countFancy; Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); RenderHelper.disableStandardItemLighting(); float f1 = continuousTick / 400.0F; float f2 = 0.4F; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(false); GL11.glPushMatrix(); for (int i = 0; i < fancy_count; i++) { GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(rand.nextFloat() * 360.0F + f1 * 360.0F, 0.0F, 0.0F, 1.0F); vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR); float fa = rand.nextFloat() * 20.0F + 5.0F + f2 * 10.0F; float f4 = rand.nextFloat() * 2.0F + 1.0F + f2 * 2.0F; fa /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F); f4 /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F); vb.pos(0, 0, 0).color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), (int) (255.0F * (1.0F - f2))).endVertex(); vb.pos(-0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(0.0D, fa, 1.0F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); vb.pos(-0.7D * f4, fa, -0.5F * f4) .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0).endVertex(); tes.draw(); } GL11.glPopMatrix(); GL11.glDepthMask(true); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); RenderHelper.enableStandardItemLighting(); GL11.glPopMatrix(); }
From source file:hellfirepvp.astralsorcery.client.util.RenderingUtils.java
License:Open Source License
public static void drawGradientRect(int x, int y, float z, int toX, int toY, Color color, Color colorFade) { GL11.glDisable(GL11.GL_TEXTURE_2D);//from w ww .java 2s .c o m GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator tes = Tessellator.getInstance(); VertexBuffer vb = tes.getBuffer(); vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR); vb.pos(toX, y, z).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex(); vb.pos(x, y, z).color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()).endVertex(); vb.pos(x, toY, z).color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha()) .endVertex(); vb.pos(toX, toY, z) .color(colorFade.getRed(), colorFade.getGreen(), colorFade.getBlue(), colorFade.getAlpha()) .endVertex(); tes.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:hexagonalminesweeper.HexagonalMinesweeper.java
public static void renderGL() { try {//from www. ja v a 2 s. c o m Display.setDisplayMode(new org.lwjgl.opengl.DisplayMode(800, 600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, 800, 600); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 600, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); Display.setVSyncEnabled(true); }
From source file:illarion.graphics.lwjgl.RenderDisplayLWJGL.java
License:Open Source License
/** * Setup the openGL render environment. Such as the view port the matrix for * the orthogonal view and so on./*from w ww .j av a 2 s.c om*/ */ protected void setupOpenGL() { if (!Display.isCreated()) { return; } // set the basic view port of the game. This should be the full size of // the client window GL11.glViewport(0, 0, resWidth, resHeight); // enable alpha blending based on the picture alpha channel GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // disable death test, we work in 2D anyway, there is no depth GL11.glDisable(GL11.GL_DEPTH_TEST); // switch to projection matrix to set up the orthogonal view that we // need GL11.glMatrixMode(GL11.GL_PROJECTION); // load the identity matrix to we have a clean start GL11.glLoadIdentity(); // setup the orthogonal view GLU.gluOrtho2D(0, resWidth, 0, resHeight); // set clear color to black GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // sync frame (only works on windows) if (Graphics.NO_SLOWDOWN) { Display.setVSyncEnabled(false); } else { Display.setVSyncEnabled(true); } // clean up the screen GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); // switch to model view matrix, so we can place the sprites correctly GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void render(Root root) { GL11.glPushAttrib(GL11.GL_ENABLE_BIT | GL11.GL_TRANSFORM_BIT | GL11.GL_HINT_BIT | GL11.GL_COLOR_BUFFER_BIT | GL11.GL_SCISSOR_BIT | GL11.GL_LINE_BIT | GL11.GL_TEXTURE_BIT); GL11.glViewport(0, 0, LwjglHelper.getWidth(), LwjglHelper.getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();/* ww w. j a v a 2 s .c o m*/ GL11.glLoadIdentity(); GL11.glOrtho(root.getX(), root.getWidth(), root.getHeight(), root.getY(), -1.0, 1.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LINE_SMOOTH); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_SCISSOR_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_LINE_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_TEXTURE_2D); drawBackgroundAndBorder(root); drawStack(root); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glPopAttrib(); }
From source file:info.plugmania.novacraft.event.gui.Render3DHUDEvent.java
License:GNU General Public License
public void enable() { GL11.glPushMatrix();//from w ww .jav a 2 s . c o m GL11.glDepthMask(true); //GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glEnable(GL11.GL_LINE_SMOOTH); Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D); }
From source file:info.plugmania.novacraft.event.gui.Render3DOverlayEvent.java
License:GNU General Public License
public void enable() { GL11.glPushMatrix();/* w w w.j a v a2 s . c o m*/ GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); ; GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(770, 771); GL11.glEnable(GL11.GL_LINE_SMOOTH); Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D); }
From source file:info.plugmania.novacraft.event.gui.Render3DUnderlayEvent.java
License:GNU General Public License
public void enable() { GL11.glPushMatrix();/*from ww w .ja v a 2s. c o m*/ GL11.glDepthMask(true); //GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); GL11.glEnable(GL11.GL_LINE_SMOOTH); Minecraft.getMinecraft().entityRenderer.disableLightmap(1.0D); }