List of usage examples for org.lwjgl.opengl GL11 glDepthFunc
public static void glDepthFunc(@NativeType("GLenum") int func)
From source file:de.ikosa.mars.viewer.glviewer.engine.GLRendererForward.java
License:Open Source License
public static void clientSetup() { // setup opengl GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w ww. j a va2 s . c om*/ errorCheck("setting up client state GL_DEPTH_TEST"); GL11.glDepthFunc(GL11.GL_LEQUAL); errorCheck("setting depth test function"); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); errorCheck("enabling back face culling"); }
From source file:de.mineformers.robots.client.gui.util.render.ModelDrawingHelper.java
License:LGPL
public void render(int par0, int par1, int par2) { GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glPushMatrix();/*ww w.j a v a 2 s. c o m*/ GL11.glTranslatef((float) par0, (float) par1, 50.0F); GL11.glScalef((float) (-par2), (float) par2, (float) par2); GL11.glRotatef(180F, 0, 1, 0); /*current = System.currentTimeMillis(); if(current - last >= 0) { last = current; rotation += 0.1F; }*/ rotation += 0.3F; GL11.glRotatef(rotation, 0, 1, 0); RenderHelper.bindTexture(texture); model.justRender(false); if (tile.getStackInSlot(0) != null) { Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix(); GL11.glTranslatef(0, 0.35F, -0.1F); GL11.glRotatef(180, 1, 0, 0); GL11.glScalef(0.5F, 0.5F, 1F); Icon icon = ModItems.module.getIcon(tile.getStackInSlot(0), 0); float f4 = icon.getMinU(); float f5 = icon.getMaxU(); float f6 = icon.getMinV(); float f7 = icon.getMaxV(); float f9 = 0.5F; float f10 = 0.25F; float f12 = 0.0625F; float f11 = 0.021875F; ItemStack itemstack = tile.getStackInSlot(0); int j = itemstack.stackSize; byte b0 = customRenderItem.getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... GL11.glTranslatef(0f, 0f, f12 + f11); if (itemstack.getItemSpriteNumber() == 0) { RenderHelper.bindTexture(TextureMap.locationBlocksTexture); } else { RenderHelper.bindTexture(TextureMap.locationItemsTexture); } GL11.glColor4f(1, 1, 1, 1.0F); ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(), f12); if (itemstack.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); } GL11.glPopMatrix(); net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); }
From source file:de.mineformers.robots.client.renderer.entity.RenderRobot.java
License:LGPL
@Override protected void renderModel(EntityLivingBase par1EntityLivingBase, float par2, float par3, float par4, float par5, float par6, float par7) { super.renderModel(par1EntityLivingBase, par2, par3, par4, par5, par6, par7); EntityRobot robot = ((EntityRobot) par1EntityLivingBase); RenderHelper.bindTexture(robot.getChipset().getHeadTexture()); ((ModelRobot) mainModel).renderEye(false); Tessellator tessellator = Tessellator.instance; GL11.glPushMatrix();/*from w w w .j av a 2 s.c om*/ GL11.glTranslatef(0, 0.35F, -0.1F); GL11.glRotatef(180, 1, 0, 0); GL11.glScalef(0.5F, 0.5F, 1F); ItemStack itemstack = PrivateRobotHelper.createModuleStack(robot.getModule()); Icon icon = ModItems.module.getIcon(itemstack, 0); float f4 = icon.getMinU(); float f5 = icon.getMaxU(); float f6 = icon.getMinV(); float f7 = icon.getMaxV(); float f9 = 0.5F; float f10 = 0.25F; float f12 = 0.0625F; float f11 = 0.021875F; int j = itemstack.stackSize; byte b0 = customRenderItem.getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { // Makes items offset when in 3D, like when in 2D, looks much better. Considered a vanilla bug... GL11.glTranslatef(0f, 0f, f12 + f11); if (itemstack.getItemSpriteNumber() == 0) { RenderHelper.bindTexture(TextureMap.locationBlocksTexture); } else { RenderHelper.bindTexture(TextureMap.locationItemsTexture); } GL11.glColor4f(1, 1, 1, 1.0F); GL11.glRotatef(180, 0, 1, 0); GL11.glTranslatef(-1, 0, 0.05F); ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, icon.getIconWidth(), icon.getIconHeight(), f12); if (itemstack.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java
License:Creative Commons License
private static void renderItemIn3D(IIcon icon, boolean withEffect, int spriteIndex) { GL11.glPushMatrix();/* www . jav a2 s . co m*/ if (icon == null) { GL11.glPopMatrix(); return; } float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); Tessellator tessellator = Tessellator.instance; Minecraft.getMinecraft().renderEngine .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex)); GL11.glEnable(GL12.GL_RESCALE_NORMAL); renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F, false); if (withEffect) { float baseClr = 0.76F; float glintScale = 0.125F; float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glScalef(glintScale, glintScale, glintScale); GL11.glTranslatef(glintTransX, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(glintScale, glintScale, glintScale); glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-glintTransX, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:de.sanandrew.core.manpack.util.client.helpers.ItemRenderHelper.java
License:Creative Commons License
/** * Renders an IIcon in 2D.//from w w w .j av a 2 s . c o m * * @param icon the icon to be rendered * @param spriteIndex the index of the texture to be used (0 = blocks, 1 = items) * @param hasEffect if it has an enchantment effect * @param isGlowing if it should glow in the dark */ public static void renderIcon(IIcon icon, int spriteIndex, boolean hasEffect, boolean isGlowing) { GL11.glPushMatrix(); if (icon == null) { GL11.glPopMatrix(); return; } float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); float transX = 0.0F; float transY = 0.3F; float scale = 1.5F; Tessellator tessellator = Tessellator.instance; Minecraft.getMinecraft().renderEngine .bindTexture(Minecraft.getMinecraft().renderEngine.getResourceLocation(spriteIndex)); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glTranslatef(-transX, -transY, 0.0F); GL11.glScalef(scale, scale, scale); 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); renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F, isGlowing); if (hasEffect) { float baseClr = 0.76F; float glintScale = 0.125F; float glintTransX = Minecraft.getSystemTime() % 3000L / 3000.0F * 8.0F; GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); Minecraft.getMinecraft().renderEngine.bindTexture(GLINT_PNG); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glColor4f(0.5F * baseClr, 0.25F * baseClr, 0.8F * baseClr, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); GL11.glScalef(glintScale, glintScale, glintScale); GL11.glTranslatef(glintTransX, 0.0F, 0.0F); GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(glintScale, glintScale, glintScale); glintTransX = Minecraft.getSystemTime() % 4873L / 4873.0F * 8.0F; GL11.glTranslatef(-glintTransX, 0.0F, 0.0F); GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); renderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, false); GL11.glPopMatrix(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); }
From source file:edu.csun.ecs.cs.multitouchj.ui.graphic.WindowManager.java
License:Apache License
protected void initializeOpenGl() { DisplayMode displayMode = displayManager.getCurrentDisplayMode(); GL11.glEnable(GL11.GL_DEPTH_TEST);/*from w ww . j ava2 s . c o m*/ GL11.glClearDepth(1.0f); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glViewport(0, 0, displayMode.getWidth(), displayMode.getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); //GLU.gluPerspective(45.0f, (float)SCREEN_WIDTH/(float)SCREEN_HEIGHT, 4.0f, 4000.0f); GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 1.0f, 100.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //GL11.glClearDepth(1.0f); //GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); //GL11.glHint(GL11.GL_POLYGON_SMOOTH_HINT, GL11.GL_NICEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
/** * Renders a dropped item/*from ww w . j ava 2 s. co m*/ */ private void renderDroppedItem(EntityItem par1EntityItem, Icon par2Icon, int par3, float par4, float par5, float par6, float par7) { Tessellator tessellator = Tessellator.instance; if (par2Icon == null) { par2Icon = this.renderManager.renderEngine .getMissingIcon(par1EntityItem.getEntityItem().getItemSpriteNumber()); } float f4 = par2Icon.getMinU(); float f5 = par2Icon.getMaxU(); float f6 = par2Icon.getMinV(); float f7 = par2Icon.getMaxV(); float f8 = 1.0F; float f9 = 0.5F; float f10 = 0.25F; float f11; GL11.glPushMatrix(); if (renderInFrame) { GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F); } else { GL11.glRotatef((((float) par1EntityItem.age + par4) / 20.0F + par1EntityItem.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F); } float f12 = 0.0625F; f11 = 0.021875F; ItemStack itemstack = par1EntityItem.getEntityItem(); int j = itemstack.stackSize; byte b0 = getMiniItemCount(itemstack); GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F)); for (int k = 0; k < b0; ++k) { GL11.glTranslatef(0.0F, 0.0F, f12 + f11); // Makes items offset when in 3D, like when in 2D, looks much // better. Considered a vanilla bug... if (k > 0 && shouldSpreadItems()) { float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F; GL11.glTranslatef(x, y, f12 + f11); } else { GL11.glTranslatef(0f, 0f, f12 + f11); } if (itemstack.getItemSpriteNumber() == 0) { this.loadTexture("/terrain.png"); } else { this.loadTexture("/gui/items.png"); } GL11.glColor4f(par5, par6, par7, 1.0F); ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, par2Icon.getSheetWidth(), par2Icon.getSheetHeight(), f12); if (itemstack != null && itemstack.hasEffect()) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); this.renderManager.renderEngine.bindTexture("%blur%/misc/glint.png"); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 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, 255, 255, f12); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } GL11.glPopMatrix(); }
From source file:eplus.renders.TableEntityItemRenderer.java
License:LGPL
/** * Render the item's icon or block into the GUI, including the glint effect. *///from w w w.java 2 s . c om public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, RenderEngine par2RenderEngine, ItemStack par3ItemStack, int par4, int par5) { if (par3ItemStack != null) { if (!ForgeHooksClient.renderInventoryItem(renderBlocks, par2RenderEngine, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) par5)) { this.renderItemIntoGUI(par1FontRenderer, par2RenderEngine, par3ItemStack, par4, par5); } if (par3ItemStack.hasEffect()) { GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); par2RenderEngine.bindTexture("%blur%/misc/glint.png"); this.zLevel -= 50.0F; GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F); this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); this.zLevel += 50.0F; GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } } }
From source file:espresso3d.engine.E3DEngine.java
License:Open Source License
private void initGL() { logger.writeLine(E3DEngineLogger.SEVERITY_INFO, "Initializing OpenGL"); GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background GL11.glClearDepth(1.0); // Depth Buffer Setup GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); // Set Perspective Calculations To Most Accurate }
From source file:espresso3d.engine.renderer.E3DGeometryRenderer.java
License:Open Source License
public void initSolidAndLineRendering() { GL11.glDepthMask(true);/*from w w w .j a va2 s. co m*/ GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); // Set Perspective Calculations To Most Accurate disableAllTextureUnits(); GL11.glDisableClientState(GL11.GL_TEXTURE_COORD_ARRAY); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_COLOR_ARRAY); }