Java Code Examples for org.lwjgl.opengl.GL11#glAlphaFunc()
The following examples show how to use
org.lwjgl.opengl.GL11#glAlphaFunc() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiResearchRecipeAuraEffects.java From Gadomancy with GNU Lesser General Public License v3.0 | 6 votes |
private void drawAuraAspectPagePre(ResearchPage page, int side, int x, int y, int mx, int my, int thisPage) { GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); String researchName = Gadomancy.MODID.toUpperCase() + ".AURA_EFFECTS"; //We know the name of that research. researchName = StatCollector.translateToLocal(researchName); if ((thisPage == 0) && (side == 0)) { drawTexturedModalRect(x + 4, y - 13, 24, 184, 96, 4); drawTexturedModalRect(x + 4, y + 4, 24, 184, 96, 4); int offset = this.fontRendererObj.getStringWidth(researchName); if (offset <= 130) { this.fontRendererObj.drawString(researchName, x + 52 - offset / 2, y - 6, 3158064); } else { float vv = 130.0F / offset; GL11.glPushMatrix(); GL11.glTranslatef(x + 52 - offset / 2 * vv, y - 6.0F * vv, 0.0F); GL11.glScalef(vv, vv, vv); this.fontRendererObj.drawString(researchName, 0, 0, 3158064); GL11.glPopMatrix(); } y += 25; } GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); drawAuraPage(side, x - 8, y - 8, mx, my, page.aspects); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopAttrib(); }
Example 2
Source File: EmitterRenderer.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
public static void render(RenderQueues render_queues, List emitter_queue, CameraState state) { tmp_camera.set(state); view_matrix.setIdentity(); tmp_camera.setView(view_matrix); float rx = tmp_camera.getModelView().m00; float ry = tmp_camera.getModelView().m10; float rz = tmp_camera.getModelView().m20; float upx = tmp_camera.getModelView().m01; float upy = tmp_camera.getModelView().m11; float upz = tmp_camera.getModelView().m21; right_plus_up.set(rx + upx, ry + upy, rz + upz); right_minus_up.set(rx - upx, ry - upy, rz - upz); GL11.glEnable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(false); for (int i = 0; i < emitter_queue.size(); i++) { Emitter emitter = (Emitter)emitter_queue.get(i); if (Globals.draw_particles) render(render_queues, emitter); } emitter_queue.clear(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); }
Example 3
Source File: LightningRenderer.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
public static void render(RenderQueues render_queues, List emitter_queue, CameraState state) { tmp_camera.set(state); view_matrix.setIdentity(); tmp_camera.setView(view_matrix); float rx = tmp_camera.getModelView().m00; float ry = tmp_camera.getModelView().m10; float rz = tmp_camera.getModelView().m20; right_vector.set(rx, ry, rz); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glDepthMask(false); for (int i = 0; i < emitter_queue.size(); i++) { Lightning emitter = (Lightning)emitter_queue.get(i); if (Globals.draw_particles) render(render_queues, emitter); } emitter_queue.clear(); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); }
Example 4
Source File: TreeRenderer.java From tribaltrouble with GNU General Public License v2.0 | 6 votes |
final void renderAll() { wave_animation.setTime(LocalEventQueue.getQueue().getTime()); List low_detail_render_list = getLowDetailRenderList(); tree_low_detail.setupTrees(); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, .3f); GL11.glDisable(GL11.GL_CULL_FACE); for (int i = 0; i < low_detail_render_list.size(); i++) { AbstractTreeGroup group = (AbstractTreeGroup)low_detail_render_list.get(i); low_detail_render_list.set(i, null); if (Globals.draw_trees && cheat.draw_trees) renderLowDetail(group); } GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_ALPHA_TEST); low_detail_render_list.clear(); List[] render_lists = getRenderLists(); List[] respond_render_lists = getRespondRenderLists(); for (int i = 0; i < render_lists.length; i++) renderList(tree_low_detail.getTrees()[i], render_lists[i], false); for (int i = 0; i < respond_render_lists.length; i++) if (respond_render_lists[i].size() > 0) renderList(tree_low_detail.getTrees()[i], respond_render_lists[i], true); }
Example 5
Source File: DistanceFieldTest.java From slick2d-maven with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see org.newdawn.slick.Game#render(org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics) */ public void render(GameContainer container, Graphics g) throws SlickException { String text = "abc"; font.drawString(610,100,text); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f); font.drawString(610,150,text); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); g.translate(-50,-130); g.scale(10,10); font.drawString(0,0,text); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GEQUAL, 0.5f); font.drawString(0,26,text); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); g.resetTransform(); g.setColor(Color.lightGray); g.drawString("Original Size on Sheet", 620, 210); g.drawString("10x Scale Up", 40, 575); g.setColor(Color.darkGray); g.drawRect(40, 40, 560,530); g.drawRect(610, 105, 150,100); g.setColor(Color.white); g.drawString("512x512 Font Sheet", 620, 300); g.drawString("NEHE Charset", 620, 320); g.drawString("4096x4096 (8x) Source Image", 620, 340); g.drawString("ScanSize = 20", 620, 360); }
Example 6
Source File: FXFlow.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
public static void sheduleRender(Tessellator tessellator) { boolean isLightingEnabled = GL11.glGetBoolean(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); if(isLightingEnabled) GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); for(FXFlowBase fx : fxQueue) { tessellator.startDrawingQuads(); fx.renderEssenceBase(tessellator); tessellator.draw(); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.75F); if(isLightingEnabled) GL11.glEnable(GL11.GL_LIGHTING); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); fxQueue.clear(); }
Example 7
Source File: RenderEventHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.LOWEST) public void renderEntityPre(RenderLivingEvent.Pre event) { if(event.entity instanceof EntityPlayer) { EntityPlayer p = (EntityPlayer) event.entity; if(((DataAchromatic)SyncDataHolder.getDataClient("AchromaticData")).isAchromatic((EntityPlayer) event.entity)) { current = p; GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.15F); GL11.glDepthMask(false); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); } armor = p.inventory.armorInventory; p.inventory.armorInventory = new ItemStack[armor.length]; System.arraycopy(armor, 0, p.inventory.armorInventory, 0, armor.length); boolean changed = false; for(int i = 0; i < armor.length; i++) { if(armor[i] != null && NBTHelper.hasPersistentData(armor[i])) { NBTTagCompound compound = NBTHelper.getPersistentData(armor[i]); if(compound.hasKey("disguise")) { NBTBase base = compound.getTag("disguise"); if(base instanceof NBTTagCompound) { p.inventory.armorInventory[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) base); } else { p.inventory.armorInventory[i] = null; } changed = true; } } } if(!changed) { p.inventory.armorInventory = armor; armor = null; } } }
Example 8
Source File: RenderEventHandler.java From Gadomancy with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true) public void onSetArmor(RenderPlayerEvent.SetArmorModel event) { if(event.entityPlayer == current) { GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthMask(true); } }
Example 9
Source File: LWJGL15DrawContext.java From settlers-remake with MIT License | 5 votes |
void init() { GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.5f); GL11.glEnable(GL11.GL_TEXTURE_2D); }
Example 10
Source File: GUIRoot.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
public final void setupGUIView() { GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(Globals.FOV, LocalInput.getViewAspect(), Globals.VIEW_MIN, Globals.VIEW_MAX); GL11.glMultMatrix(matrix_buf); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glEnable(GL11.GL_BLEND); }
Example 11
Source File: Sprite.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
private final void doSetup(FloatBuffer color, int tex_index, boolean respond, boolean modulate_color) { int gl_flags = setupBasic(); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textures[tex_index][TEXTURE_NORMAL].getHandle()); if (modulate_color) { GL11.glAlphaFunc(GL11.GL_GREATER, 0f); GL11.glEnable(GL11.GL_BLEND); GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); } else if (Globals.draw_light && lighted) { gl_flags = gl_flags | GLState.NORMAL_ARRAY; GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE); GL11.glEnable(GL11.GL_LIGHTING); GL11.glMaterial(GL11.GL_FRONT, GL11.GL_DIFFUSE, color); } GL11.glColor4f(color.get(0), color.get(1), color.get(2), color.get(3)); if (!modulate_color && (hasTeamDecal() || respond)) { gl_flags = gl_flags | GLState.TEXCOORD1_ARRAY; setupTeamDecal(); if (respond) { GL11.glBindTexture(GL11.GL_TEXTURE_2D, respond_texture.getHandle()); } else { GL11.glBindTexture(GL11.GL_TEXTURE_2D, textures[tex_index][TEXTURE_TEAM].getHandle()); } GLState.clientActiveTexture(GL13.GL_TEXTURE1); texcoords.texCoordPointer(2, 0, 0); GLState.clientActiveTexture(GL13.GL_TEXTURE0); } GLStateStack.switchState(gl_flags); }
Example 12
Source File: Sprite.java From tribaltrouble with GNU General Public License v2.0 | 5 votes |
private final int setupBasic() { int gl_flags = GLState.VERTEX_ARRAY | GLState.TEXCOORD0_ARRAY; if (!culled) { GL11.glDisable(GL11.GL_CULL_FACE); } if (alpha) { GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, .3f); } texcoords.texCoordPointer(2, 0, 0); return gl_flags; }
Example 13
Source File: RocketEventHandler.java From AdvancedRocketry with MIT License | 4 votes |
public static void onPostWorldRender(float partialTicks) { if(!mapReady ) return; if(mapNeedsBinding) { mapNeedsBinding = false; earth.setByteBuffer(table); outerBounds.setByteBuffer(outerBoundsTable); } GL11.glPushMatrix(); GL11.glTranslatef(0, -5, 0); GL11.glPushAttrib(GL11.GL_ALPHA_TEST_FUNC); GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_FOG); GL11.glAlphaFunc(GL11.GL_GREATER, .01f); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float brightness = 16; if(Minecraft.getMinecraft().getRenderViewEntity() != null && Minecraft.getMinecraft().getRenderViewEntity().world != null) brightness = Minecraft.getMinecraft().getRenderViewEntity().world.getSunBrightness(partialTicks); double deltaY = (Minecraft.getMinecraft().getRenderViewEntity().posY - Minecraft.getMinecraft().getRenderViewEntity().lastTickPosY)*partialTicks; double size = (getImgSize*5/(72-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); BufferBuilder buffer = Tessellator.getInstance().getBuffer(); //Less detailed land buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, outerBounds.getTextureId()); double size2 = size*16; float brightness2 =brightness*.43f; GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10.1, size2, size2, -size2, -size2, 0, 1, 0, 1); Tessellator.getInstance().draw(); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX); GL11.glBindTexture(GL11.GL_TEXTURE_2D, earth.getTextureId()); float opacityFromHeight = MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/100f, 0f, 1f); //Detailed Land GlStateManager.color(brightness2, brightness2, brightness2, MathHelper.clamp(((float)Minecraft.getMinecraft().getRenderViewEntity().posY -200f)/50f, 0f, 1f)); RenderHelper.renderTopFaceWithUV(buffer, -10 , size, size, -size, -size, 0f, 1f, 0f, 1f); Tessellator.getInstance().draw(); //AtmosphereGlow Vec3d skyColor = Minecraft.getMinecraft().getRenderViewEntity().world.provider.getSkyColor(Minecraft.getMinecraft().getRenderViewEntity(), partialTicks); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glBindTexture(GL11.GL_TEXTURE_2D,0); buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_NORMAL); GlStateManager.color((float)skyColor.x, (float)skyColor.y, (float)skyColor.z, 0.05f); size = (getImgSize*100/(180-Minecraft.getMinecraft().getRenderViewEntity().posY - deltaY)); for(int i = 0; i < 5 * MathHelper.clamp(( ( DimensionManager.getInstance().getDimensionProperties(Minecraft.getMinecraft().getRenderViewEntity().world.provider.getDimension()).getAtmosphereDensity() *.01f * (float)Minecraft.getMinecraft().getRenderViewEntity().posY -280f) )/150f, 0f, 2f); i++) { RenderHelper.renderTopFace(buffer, -9 + i*.6, size, size, -size , -size); } // GL11.glEnable(GL11.GL_TEXTURE_2D); Tessellator.getInstance().draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_FOG); GL11.glPopAttrib(); GL11.glPopMatrix(); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 0, 0); }
Example 14
Source File: RenderCarvableBeacon.java From Chisel-2 with GNU General Public License v2.0 | 4 votes |
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) { float f1 = beacon.func_146002_i(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); if(f1 > 0.1F){ Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]); Tessellator tessellator = Tessellator.instance; this.bindTexture(texture); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F); GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); OpenGlHelper.glBlendFunc(770, 1, 1, 0); float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks; float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F); byte b0 = 1; double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d5 = (double) b0 * 0.2D; double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5; double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5; double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5; double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5; double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5; double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5; double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5; double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5; double d23 = (double) (256.0F * f1); double d25 = 0.0D; double d27 = 1.0D; double d28 = (double) (-1.0F + f3); double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28; tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29); tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28); tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29); tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28); tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29); tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29); tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28); tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28); tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29); tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29); tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28); tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28); tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29); tessellator.draw(); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(770, 771, 1, 0); GL11.glDepthMask(false); tessellator.startDrawingQuads(); tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32); double d30 = 0.2D; double d4 = 0.2D; double d6 = 0.8D; double d8 = 0.2D; double d10 = 0.2D; double d12 = 0.8D; double d14 = 0.8D; double d16 = 0.8D; double d18 = (double) (256.0F * f1); double d20 = 0.0D; double d22 = 1.0D; double d24 = (double) (-1.0F + f3); double d26 = (double) (256.0F * f1) + d24; tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26); tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24); tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26); tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24); tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26); tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26); tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24); tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24); tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26); tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26); tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24); tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24); tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26); tessellator.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDepthMask(true); } }
Example 15
Source File: Renderer.java From AnyaBasic with MIT License | 4 votes |
Renderer( int screenWidth, int screenHeight ) { try { Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight)); Display.create(); Display.setTitle( "AnyaBasic 0.4.0 beta" ); } catch( LWJGLException e ) { e.printStackTrace(); } this.screenWidth = screenWidth; this.screenHeight = screenHeight; GL11.glViewport( 0, 0, screenWidth, screenHeight ); GL11.glMatrixMode( GL11.GL_PROJECTION ); GL11.glLoadIdentity(); GL11.glOrtho( 0, screenWidth, screenHeight, 0, 1, -1 ); GL11.glMatrixMode( GL11.GL_MODELVIEW ); GL11.glLoadIdentity(); GL11.glShadeModel(GL11.GL_SMOOTH); //set shading to smooth(try GL_FLAT) GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set Clear color to BLACK GL11.glClearDepth(1.0f); //Set Depth buffer to 1(z-Buffer) GL11.glDisable(GL11.GL_DEPTH_TEST); //Disable Depth Testing so that our z-buffer works GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable( GL11.GL_ALPHA_TEST ); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glEnable( GL11.GL_BLEND ); GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA ); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glMatrixMode( GL11.GL_MODELVIEW ); GL11.glLoadIdentity(); GL11.glTranslatef( 0.375f, 0.375f, 0 ); // magic trick }
Example 16
Source File: RenderGravityMachine.java From AdvancedRocketry with MIT License | 4 votes |
@Override public void render(TileEntity tile, double x, double y, double z, float f, int damage, float a) { TileGravityController multiBlockTile = (TileGravityController)tile; if(!multiBlockTile.canRender()) return; GL11.glPushMatrix(); //Initial setup GL11.glTranslated(x + 0.5, y - .5f, z + .5); //Rotate and move the model into position EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0); //GL11.glTranslated(2f, 0, 0f); bindTexture(texture); model.renderOnly("Base"); GL11.glDisable(GL11.GL_LIGHTING); int maxSize = 5; //Render blur GL11.glDisable(GL11.GL_TEXTURE_2D); GlStateManager.color(0f, 1f, 1f, Math.max(((float)multiBlockTile.getGravityMultiplier() - 0.1f)*0.2f,0f)); GL11.glEnable(GL11.GL_BLEND); GL11.glDepthMask(false); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glAlphaFunc(GL11.GL_GREATER, 0f); GL11.glPushMatrix(); GL11.glScaled(1.1, 1, 1.1); for(int i = 0; i < 4; i++) { GL11.glScaled(.93, 1, .93); model.renderOnly("Blur"); } GL11.glPopMatrix(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthMask(true); GL11.glDisable(GL11.GL_BLEND); GlStateManager.color(1f, 1f, 1f,1f); GL11.glEnable(GL11.GL_TEXTURE_2D); // END render blur GL11.glRotated(multiBlockTile.getArmRotation(), 0, 1, 0); for(int i = 0; i < maxSize; i++) { GL11.glRotated(360/maxSize, 0, 1, 0); model.renderOnly("Arm"); } GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
Example 17
Source File: OpenGLHelper.java From Et-Futurum with The Unlicense | 4 votes |
public static void alphaFunc(int func, float ref) { GL11.glAlphaFunc(func, ref); }
Example 18
Source File: ItemNodeRenderer.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
public static void renderItemNode(INode node) { if (node.getAspects().size() > 0) { EntityLivingBase viewer = Minecraft.getMinecraft().renderViewEntity; float alpha = 0.5F; if (node.getNodeModifier() != null) { switch (node.getNodeModifier()) { case BRIGHT: alpha *= 1.5F; break; case PALE: alpha *= 0.66F; break; case FADING: alpha *= (MathHelper.sin(viewer.ticksExisted / 3.0F) * 0.25F + 0.33F); } } GL11.glPushMatrix(); GL11.glAlphaFunc(516, 0.003921569F); GL11.glDepthMask(false); GL11.glDisable(2884); long nt = System.nanoTime(); long time = nt / 5000000L; float bscale = 0.25F; GL11.glPushMatrix(); float rad = 6.283186F; GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha); UtilsFX.bindTexture(TileNodeRenderer.nodetex); int frames = 32; int i = (int) ((nt / 40000000L + 1L) % frames); int count = 0; float scale = 0.0F; float average = 0.0F; for (Aspect aspect : node.getAspects().getAspects()) { if (aspect.getBlend() == 771) { alpha = (float) (alpha * 1.5D); } average += node.getAspects().getAmount(aspect); GL11.glPushMatrix(); GL11.glEnable(3042); GL11.glBlendFunc(770, aspect.getBlend()); scale = MathHelper.sin(viewer.ticksExisted / (14.0F - count)) * bscale + bscale * 2.0F; scale = 0.2F + scale * (node.getAspects().getAmount(aspect) / 50.0F); UtilsFX.renderAnimatedQuadStrip(scale, alpha / node.getAspects().size(), frames, 0, i, 0.0F, aspect.getColor()); GL11.glDisable(3042); GL11.glPopMatrix(); count++; if (aspect.getBlend() == 771) { alpha = (float) (alpha / 1.5D); } } average /= node.getAspects().size(); GL11.glPushMatrix(); GL11.glEnable(3042); i = (int) ((nt / 40000000L + 1L) % frames); scale = 0.1F + average / 150.0F; int strip = 1; switch (node.getNodeType()) { case NORMAL: GL11.glBlendFunc(770, 1); break; case UNSTABLE: GL11.glBlendFunc(770, 1); strip = 6; break; case DARK: GL11.glBlendFunc(770, 771); strip = 2; break; case TAINTED: GL11.glBlendFunc(770, 771); strip = 5; break; case PURE: GL11.glBlendFunc(770, 1); strip = 4; break; case HUNGRY: scale *= 0.75F; GL11.glBlendFunc(770, 1); strip = 3; } GL11.glColor4f(1.0F, 0.0F, 1.0F, alpha); UtilsFX.renderAnimatedQuadStrip(scale, alpha, frames, strip, i, 0.0F, 16777215); GL11.glDisable(3042); GL11.glPopMatrix(); GL11.glPopMatrix(); GL11.glEnable(2884); GL11.glDepthMask(true); GL11.glAlphaFunc(516, 0.1F); GL11.glPopMatrix(); } }
Example 19
Source File: FXVortex.java From Gadomancy with GNU Lesser General Public License v3.0 | 4 votes |
private void render(Tessellator tessellator, float pTicks) { float arX = ActiveRenderInfo.rotationX; float arXZ = ActiveRenderInfo.rotationXZ; float arZ = ActiveRenderInfo.rotationZ; float arYZ = ActiveRenderInfo.rotationYZ; float arXY = ActiveRenderInfo.rotationXY; GL11.glPushMatrix(); GL11.glAlphaFunc(GL11.GL_GREATER, 0.003921569F); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); float agescale = (float) (ClientHandler.ticks % 800) / 400F; if(agescale >= 1.0F) agescale = 2 - agescale; float size = 0.2F + 0.1F * agescale; if(parent != null) { size += size * (((float) parent.getSizeStage()) * 0.04F); } float anglePerc = (float) (ClientHandler.ticks % 300) / 300F; float angle = RAD - RAD * anglePerc; Vector3 iV = MiscUtils.interpolateEntityPosition(Minecraft.getMinecraft().renderViewEntity, pTicks); if(parent != null && parent.getSizeStage() > 4) { float mult = 0.001F * (parent.getSizeStage() - 4F); Vector3 shake = new Vector3( RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1), RAND.nextFloat() * mult * (RAND.nextBoolean() ? 1 : -1)); iV.add(shake); } GL11.glTranslated(-iV.getX(), -iV.getY(), -iV.getZ()); UtilsFX.bindTexture(TC_VORTEX_TEXTURE); tessellator.startDrawingQuads(); tessellator.setBrightness(220); tessellator.setColorRGBA_F(1F, 1F, 1F, 1F); Vec3 v1 = Vec3.createVectorHelper(-arX * size - arYZ * size, -arXZ * size, -arZ * size - arXY * size); Vec3 v2 = Vec3.createVectorHelper(-arX * size + arYZ * size, arXZ * size, -arZ * size + arXY * size); Vec3 v3 = Vec3.createVectorHelper(arX * size + arYZ * size, arXZ * size, arZ * size + arXY * size); Vec3 v4 = Vec3.createVectorHelper(arX * size - arYZ * size, -arXZ * size, arZ * size - arXY * size); if (angle != 0.0F) { Vec3 pvec = Vec3.createVectorHelper(iV.getX(), iV.getY(), iV.getZ()); Vec3 tvec = Vec3.createVectorHelper(x, y, z); Vec3 qvec = pvec.subtract(tvec).normalize(); QuadHelper.setAxis(qvec, angle).rotate(v1); QuadHelper.setAxis(qvec, angle).rotate(v2); QuadHelper.setAxis(qvec, angle).rotate(v3); QuadHelper.setAxis(qvec, angle).rotate(v4); } tessellator.setNormal(0.0F, 0.0F, -1.0F); tessellator.addVertexWithUV(x + v1.xCoord, y + v1.yCoord, z + v1.zCoord, 0, 1); tessellator.addVertexWithUV(x + v2.xCoord, y + v2.yCoord, z + v2.zCoord, 1, 1); tessellator.addVertexWithUV(x + v3.xCoord, y + v3.yCoord, z + v3.zCoord, 1, 0); tessellator.addVertexWithUV(x + v4.xCoord, y + v4.yCoord, z + v4.zCoord, 0, 0); tessellator.draw(); GL11.glDisable(GL11.GL_BLEND); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glPopMatrix(); }