List of usage examples for org.lwjgl.opengl GL11 glDepthFunc
public static void glDepthFunc(@NativeType("GLenum") int func)
From source file:org.terasology.rendering.opengl.GraphicState.java
License:Apache License
/** * Sets the state to render the First Person View. * * This generally comprises the objects held in hand, i.e. a pick, an axe, a torch and so on. *///from w ww . j av a 2s. c o m public void preRenderSetupFirstPerson() { GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDepthFunc(GL11.GL_ALWAYS); }
From source file:org.terasology.rendering.opengl.GraphicState.java
License:Apache License
/** * Resets the state after the render of the First Person View. * * See preRenderSetupFirstPerson() for some more information. *//*from www . ja v a2 s .c o m*/ public void postRenderClenaupFirstPerson() { GL11.glDepthFunc(GL_LEQUAL); GL11.glPopMatrix(); }
From source file:processing.opengl.PLWJGL.java
License:Open Source License
@Override public void depthFunc(int func) { GL11.glDepthFunc(func); }
From source file:RediscoveredMod.RenderRedDragon.java
License:Open Source License
/** * Renders the dragon model. Called by renderModel. *//*from ww w.ja va 2s.co m*/ protected void renderDragonModel(EntityGoodDragon par1EntityGoodDragon, float par2, float par3, float par4, float par5, float par6, float par7) { if (par1EntityGoodDragon.deathTicks > 0) { float f6 = (float) par1EntityGoodDragon.deathTicks / 200.0F; GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, f6); this.bindTexture(field_110842_f); this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); GL11.glDepthFunc(GL11.GL_EQUAL); } this.bindEntityTexture(par1EntityGoodDragon); this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7); if (par1EntityGoodDragon.hurtTime > 0) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.5F); this.mainModel.render(par1EntityGoodDragon, par2, par3, par4, par5, par6, par7); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } }
From source file:RediscoveredMod.RenderRedDragon.java
License:Open Source License
/** * Renders the overlay for glowing eyes and the mouth. Called by shouldRenderPass. */// w w w. ja va2 s. c om protected int renderGlow(EntityGoodDragon par1EntityGoodDragon, int par2, float par3) { if (par2 == 1) { GL11.glDepthFunc(GL11.GL_LEQUAL); } if (par2 != 0) { return -1; } else { this.bindTexture(field_110845_h); float f1 = 1.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_EQUAL); char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_LIGHTING); GL11.glColor4f(1.0F, 1.0F, 1.0F, f1); return 1; } }
From source file:sqr.client.render.RenderSpiderQueen.java
License:Open Source License
@Override public void doRender(AbstractClientPlayer clientPlayer, double posX, double posY, double posZ, float rotationYaw, float rotationPitch) { GL11.glColor3f(1.0F, 1.0F, 1.0F);/*from ww w .j ava2 s. com*/ if (clientPlayer.isSneaking() && !(clientPlayer instanceof EntityPlayerSP)) { } GL11.glPushMatrix(); { final EntityLivingBase entity = clientPlayer; GL11.glDisable(GL11.GL_CULL_FACE); mainModel.onGround = renderSwingProgress(entity, rotationPitch); if (renderPassModel != null) { renderPassModel.onGround = mainModel.onGround; } mainModel.isRiding = entity.isRiding(); if (renderPassModel != null) { renderPassModel.isRiding = mainModel.isRiding; } if (clientPlayer != Minecraft.getMinecraft().thePlayer) { GL11.glTranslatef(0, 1.7F, 0); } try { final float unknownConstant = -0.0925F; final float realRotationPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * rotationPitch; float realRenderYaw = interpolateRotation(entity.prevRenderYawOffset, entity.renderYawOffset, rotationPitch); final float realRenderYawHead = interpolateRotation(entity.prevRotationYawHead, entity.rotationYawHead, rotationPitch); float wrappedRotation = handleRotationFloat(entity, rotationPitch); if (entity.isRiding() && entity.ridingEntity instanceof EntityLivingBase) { final EntityLivingBase entityRiding = (EntityLivingBase) entity.ridingEntity; realRenderYaw = interpolateRotation(entityRiding.prevRenderYawOffset, entityRiding.renderYawOffset, rotationPitch); wrappedRotation = MathHelper.wrapAngleTo180_float(realRenderYawHead - realRenderYaw); if (wrappedRotation < -85.0F) { wrappedRotation = -85.0F; } if (wrappedRotation >= 85.0F) { wrappedRotation = 85.0F; } realRenderYaw = realRenderYawHead - wrappedRotation; if (wrappedRotation * wrappedRotation > 2500.0F) { realRenderYaw += wrappedRotation * 0.2F; } } renderLivingAt(entity, posX, posY, posZ); rotateCorpse(entity, wrappedRotation, realRenderYaw, rotationPitch); GL11.glTranslatef(0.0F, -0.10F, 0.0F); // Move the model down // slightly so that it // touches the ground. GL11.glScalef(0.7F, 0.7F, -0.7F); // Scale and flip the new // model. float limbSwing = entity.prevLimbSwingAmount + (entity.limbSwingAmount - entity.prevLimbSwingAmount) * rotationPitch; final float limbAngle = entity.limbSwing - entity.limbSwingAmount * (1.0F - rotationPitch); if (limbSwing > 1.0F) { limbSwing = 1.0F; } mainModel.setLivingAnimations(entity, limbAngle, limbSwing, rotationPitch); renderModel(entity, limbAngle, limbSwing, wrappedRotation, realRenderYawHead - realRenderYaw, realRotationPitch, unknownConstant); try { renderEquippedItems(entity, limbSwing); } catch (Throwable e) { e.printStackTrace(); } final float brightness = entity.getBrightness(rotationPitch); final int colorMultiplier = getColorMultiplier(entity, brightness, rotationPitch); if ((colorMultiplier >> 24 & 255) > 0 || entity.hurtTime > 0 || entity.deathTime > 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_EQUAL); if (entity.hurtTime > 0 || entity.deathTime > 0) { GL11.glColor4f(brightness, 0.0F, 0.0F, 0.4F); mainModel.render(entity, limbAngle, limbSwing, wrappedRotation, realRenderYawHead - realRenderYaw, realRotationPitch, unknownConstant); } if ((colorMultiplier >> 24 & 255) > 0) { final float colorR = (colorMultiplier >> 16 & 255) / 255.0F; final float colorG = (colorMultiplier >> 8 & 255) / 255.0F; final float colorB = (colorMultiplier & 255) / 255.0F; final float colorA = (colorMultiplier >> 24 & 255) / 255.0F; GL11.glColor4f(colorR, colorG, colorB, colorA); mainModel.render(entity, limbAngle, limbSwing, wrappedRotation, realRenderYawHead - realRenderYaw, realRotationPitch, unknownConstant); } GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); } } catch (final Exception exception) { System.out.println("Failure to render entity. " + exception.getMessage()); } } GL11.glPopMatrix(); }
From source file:src.graphics.common.Rendering.java
License:Open Source License
/** A generalised interface for stuff that wants to be rendered- *///from w ww . j ava2s . c om void initSettings() { GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_NORMAL_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glEnable(GL11.GL_NORMALIZE); // IF MISSING, COLOURS ARE TOO BRIGHT. GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1f); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glColorMaterial(GL11.GL_FRONT_AND_BACK, GL11.GL_AMBIENT_AND_DIFFUSE); }
From source file:stevekung.mods.moreplanets.planets.fronos.render.items.ItemRendererCandyBow.java
License:Creative Commons License
private void renderItem(EntityLivingBase par1EntityLiving, ItemStack par2ItemStack, int par3) { IIcon iicon = par1EntityLiving.getItemIcon(par2ItemStack, par3); if (iicon == null) { return;//w w w .j a v a2 s . co m } this.mc.getTextureManager() .bindTexture(this.mc.getTextureManager().getResourceLocation(par2ItemStack.getItemSpriteNumber())); TextureUtil.func_152777_a(false, false, 1.0F); Tessellator tessellator = Tessellator.instance; float f = iicon.getMinU(); float f1 = iicon.getMaxU(); float f2 = iicon.getMinV(); float f3 = iicon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(32826); GL11.glTranslatef(-f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef(f6, f6, f6); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625F); if (par2ItemStack.hasEffect(par3)) { GL11.glDepthFunc(514); GL11.glDisable(2896); this.mc.getTextureManager().bindTexture(RES_ITEM_GLINT); GL11.glEnable(3042); GL11.glBlendFunc(768, 1); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(5890); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glTranslatef(f9, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f8, f8, f8); f9 = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-f9, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); ItemRenderer.renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F); GL11.glPopMatrix(); GL11.glMatrixMode(5888); GL11.glDisable(3042); GL11.glEnable(2896); GL11.glDepthFunc(515); } GL11.glDisable(32826); }
From source file:tectonicus.rasteriser.lwjgl.LwjglRasteriser.java
License:BSD License
@Override public void resetState() { GL11.glColorMask(true, true, true, true); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_DEPTH_TEST);//from w ww .j a v a2 s . c o m GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glFrontFace(GL11.GL_CW); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glDepthFunc(int a) { GL11.glDepthFunc(a); }