List of usage examples for org.lwjgl.opengl GL11 glCullFace
public static void glCullFace(@NativeType("GLenum") int mode)
From source file:appeng.client.render.blocks.RenderBlockInscriber.java
License:Open Source License
@Override public void renderTile(final BlockInscriber block, final TileInscriber tile, final Tessellator tess, final double x, final double y, final double z, final float f, final RenderBlocks renderer) { GL11.glPushMatrix();//from w w w .jav a2 s.c o m this.applyTESRRotation(x, y, z, tile.getForward(), tile.getUp()); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL12.GL_RESCALE_NORMAL); // render sides of stamps GL11.glCullFace(GL11.GL_FRONT); final Minecraft mc = Minecraft.getMinecraft(); mc.renderEngine.bindTexture(TextureMap.locationBlocksTexture); // << 20 | light << 4; final int br = tile.getWorldObj().getLightBrightnessForSkyBlocks(tile.xCoord, tile.yCoord, tile.zCoord, 0); final int var11 = br % 65536; final int var12 = br / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, var11, var12); long absoluteProgress = 0; if (tile.isSmash()) { final long currentTime = System.currentTimeMillis(); absoluteProgress = currentTime - tile.getClientStart(); if (absoluteProgress > 800) { tile.setSmash(false); } } final float relativeProgress = absoluteProgress % 800 / 400.0f; float progress = relativeProgress; if (progress > 1.0f) { progress = 1.0f - (progress - 1.0f); } float press = 0.2f; press -= progress / 5.0f; final IIcon ic = ExtraBlockTextures.BlockInscriberInside.getIcon(); tess.startDrawingQuads(); float middle = 0.5f; middle += 0.02f; final float TwoPx = 2.0f / 16.0f; tess.addVertexWithUV(TwoPx, middle + press, TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(2)); tess.addVertexWithUV(1.0 - TwoPx, middle + press, TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(2)); tess.addVertexWithUV(1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(13)); tess.addVertexWithUV(TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(13)); tess.addVertexWithUV(TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(3)); tess.addVertexWithUV(1.0 - TwoPx, middle + press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(3)); final float base = 0.4f; tess.addVertexWithUV(1.0 - TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(3 - 16 * (press - base))); tess.addVertexWithUV(TwoPx, middle + base, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(3 - 16 * (press - base))); middle -= 2.0f * 0.02f; tess.addVertexWithUV(1.0 - TwoPx, middle - press, TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(2)); tess.addVertexWithUV(TwoPx, middle - press, TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(2)); tess.addVertexWithUV(TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(13)); tess.addVertexWithUV(1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(13)); tess.addVertexWithUV(1.0 - TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(3)); tess.addVertexWithUV(TwoPx, middle - press, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(3)); tess.addVertexWithUV(TwoPx, middle - base, 1.0 - TwoPx, ic.getInterpolatedU(14), ic.getInterpolatedV(3 - 16 * (press - base))); tess.addVertexWithUV(1.0 - TwoPx, middle + -base, 1.0 - TwoPx, ic.getInterpolatedU(2), ic.getInterpolatedV(3 - 16 * (press - base))); tess.draw(); GL11.glCullFace(GL11.GL_BACK); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix(); int items = 0; if (tile.getStackInSlot(0) != null) { items++; } if (tile.getStackInSlot(1) != null) { items++; } if (tile.getStackInSlot(2) != null) { items++; } if (relativeProgress > 1.0f || items == 0) { ItemStack is = tile.getStackInSlot(3); if (is == null) { final IInscriberRecipe ir = tile.getTask(); if (ir != null) { is = ir.getOutput().copy(); } } this.renderItem(is, 0.0f, block, tile, tess, x, y, z, f, renderer); } else { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL12.GL_RESCALE_NORMAL); this.renderItem(tile.getStackInSlot(0), press, block, tile, tess, x, y, z, f, renderer); this.renderItem(tile.getStackInSlot(1), -press, block, tile, tess, x, y, z, f, renderer); this.renderItem(tile.getStackInSlot(2), 0.0f, block, tile, tess, x, y, z, f, renderer); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL12.GL_RESCALE_NORMAL); } }
From source file:appeng.client.render.blocks.RenderBlockSkyChest.java
License:Open Source License
@Override public void renderTile(final BlockSkyChest block, final TileSkyChest skyChest, final Tessellator tess, final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer) { if (skyChest == null) { return;/*from w w w . j a v a2s . c o m*/ } if (!skyChest.hasWorldObj()) { return; } GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); final int metaData = skyChest.getWorldObj().getBlockMetadata(skyChest.xCoord, skyChest.yCoord, skyChest.zCoord); final ResourceLocation loc = METADATA_TO_TEXTURE[metaData]; Minecraft.getMinecraft().getTextureManager().bindTexture(loc); this.applyTESRRotation(x, y, z, skyChest.getForward(), skyChest.getUp()); GL11.glScalef(1.0F, -1F, -1F); GL11.glTranslatef(-0.0F, -1.0F, -1.0F); final long now = System.currentTimeMillis(); final long distance = now - skyChest.getLastEvent(); if (skyChest.getPlayerOpen() > 0) { skyChest.setLidAngle(skyChest.getLidAngle() + distance * 0.0001f); } else { skyChest.setLidAngle(skyChest.getLidAngle() - distance * 0.0001f); } if (skyChest.getLidAngle() > 0.5f) { skyChest.setLidAngle(0.5f); } if (skyChest.getLidAngle() < 0.0f) { skyChest.setLidAngle(0.0f); } float lidAngle = skyChest.getLidAngle(); lidAngle = 1.0F - lidAngle; lidAngle = 1.0F - lidAngle * lidAngle * lidAngle; this.model.chestLid.offsetY = -(1.01f / 16.0f); this.model.chestLid.rotateAngleX = -((lidAngle * 3.141593F) / 2.0F); // The vanilla chests wants culling reversed... GL11.glCullFace(GL11.GL_FRONT); this.model.renderAll(); GL11.glCullFace(GL11.GL_BACK); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:appeng.client.render.blocks.RenderBlockSkyCompass.java
License:Open Source License
@Override public void renderTile(final BlockSkyCompass block, final TileSkyCompass skyCompass, final Tessellator tess, final double x, final double y, final double z, final float partialTick, final RenderBlocks renderer) { if (skyCompass == null) { return;/*from ww w.j av a2 s.co m*/ } if (!skyCompass.hasWorldObj()) { return; } GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glCullFace(GL11.GL_FRONT); final ResourceLocation loc = new ResourceLocation("appliedenergistics2", "textures/models/compass.png"); Minecraft.getMinecraft().getTextureManager().bindTexture(loc); this.applyTESRRotation(x, y, z, skyCompass.getUp(), skyCompass.getForward()); GL11.glScalef(1.0F, -1F, -1F); GL11.glTranslatef(0.5F, -1.5F, -0.5F); long now = System.currentTimeMillis(); CompassResult cr = null; if (skyCompass.getForward() == ForgeDirection.UP || skyCompass.getForward() == ForgeDirection.DOWN) { cr = CompassManager.INSTANCE.getCompassDirection(0, skyCompass.xCoord, skyCompass.yCoord, skyCompass.zCoord); } else { cr = new CompassResult(false, true, 0); } if (cr.isValidResult()) { if (cr.isSpin()) { now %= 100000; this.model.renderAll((now / 50000.0f) * (float) Math.PI * 500.0f); } else { this.model.renderAll( (float) (skyCompass.getForward() == ForgeDirection.DOWN ? this.flipidiy(cr.getRad()) : cr.getRad())); } } else { now %= 1000000; this.model.renderAll((now / 500000.0f) * (float) Math.PI * 500.0f); } GL11.glCullFace(GL11.GL_BACK); GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); }
From source file:ar.com.quark.backend.lwjgl.opengl.DesktopGLES20.java
License:Apache License
/** * {@inheritDoc} */ @Override public void glCullFace(int mode) { GL11.glCullFace(mode); }
From source file:cn.academy.terminal.client.TerminalUI.java
License:GNU General Public License
@Override public void draw(ScaledResolution sr) { //Frame update selection = (int) ((mouseY - 0.01) / MAX_MY * 3) * 3 + (int) ((mouseX - 0.01) / MAX_MX * 3); if (mouseY == 0) { mouseY = 1;/*from w ww.j av a 2 s . c om*/ if (scroll > 0) scroll--; } if (mouseY == MAX_MY) { mouseY -= 1; if (scroll < getMaxScroll()) scroll++; } //Draw Minecraft mc = Minecraft.getMinecraft(); long time = GameTimer.getTime(); if (lastFrameTime == 0) lastFrameTime = time; long dt = time - lastFrameTime; mouseX += helper.dx * SENSITIVITY; mouseY -= helper.dy * SENSITIVITY; mouseX = Math.max(0, Math.min(MAX_MX, mouseX)); mouseY = Math.max(0, Math.min(MAX_MY, mouseY)); buffX = balance(dt, buffX, mouseX); buffY = balance(dt, buffY, mouseY); helper.dx = helper.dy = 0; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); float aspect = (float) mc.displayWidth / mc.displayHeight; GLU.gluPerspective(50, aspect, 1f, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glColor4d(1, 1, 1, 1); double scale = 1.0 / 310; GL11.glTranslated(.35 * aspect, 1.2, -4); GL11.glTranslated(1, -1.8, 0); GL11.glRotated(-1.6, 0, 0, 1); GL11.glRotated(-18 - 4 * (buffX / MAX_MX - 0.5) + 1 * Math.sin(time / 1000.0), 0, 1, 0); GL11.glRotated(7 + 4 * (buffY / MAX_MY - 0.5), 1, 0, 0); //DEBUG CODE // GL11.glPointSize(20); // GL11.glColor4d(1, 1, 1, 1); // GL11.glDisable(GL11.GL_TEXTURE_2D); // GL11.glBegin(GL11.GL_POINTS); // GL11.glVertex3f(0, 0, 0); // GL11.glEnd(); // GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glTranslated(-1, 1.8, 0); GL11.glScaled(scale, -scale, scale); gui.draw(mouseX, mouseY); { GL11.glPushMatrix(); double csize = (getSelectedApp() == null ? 1 : 1.3) * (20 + Math.sin(time / 300.0) * 2); RenderUtils.loadTexture(CURSOR); GL11.glColor4d(1, 1, 1, .4); GL11.glTranslated(0, 0, -2); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE); HudUtils.rect(-csize / 2 + buffX, -csize / 2 + buffY + 120, csize, csize); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glPopMatrix(); } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glCullFace(GL11.GL_BACK); }
From source file:com.a2client.corex.Render.java
License:Open Source License
static public void setCullFace(Const.CULL_FACE v) { if (cull_face != v) { if (cull_face == Const.CULL_FACE.cfNone) GL11.glEnable(GL11.GL_CULL_FACE); cull_face = v;//from w w w. j a va 2 s .co m switch (v) { case cfFront: GL11.glCullFace(GL11.GL_FRONT); break; case cfBack: GL11.glCullFace(GL11.GL_BACK); break; default: GL11.glDisable(GL11.GL_CULL_FACE); } } }
From source file:com.ardor3d.scene.state.lwjgl.LwjglCullStateUtil.java
License:Open Source License
private static void setCull(final int face, final CullStateRecord record) { if (!record.isValid() || record.face != face) { GL11.glCullFace(face); record.face = face;// ww w . j a va 2 s . com } }
From source file:com.badlogic.gdx.backends.jglfw.JglfwGL20.java
License:Apache License
public void glCullFace(int mode) { GL11.glCullFace(mode); }
From source file:com.badlogic.gdx.backends.lwjgl.LwjglGL10.java
License:Apache License
public final void glCullFace(int mode) { GL11.glCullFace(mode); }
From source file:com.bossletsplays.duthorix.utils.Util.java
License:Apache License
public static void enableCulling() { GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); }