List of usage examples for org.lwjgl.opengl GL11 glPopMatrix
public static native void glPopMatrix();
From source file:com.hea3ven.pandoraschest.client.model.ModelBaseChest.java
License:Open Source License
public void render(TileEntityBaseChest chest, double x, double y, double z) { GL11.glPushMatrix();/*from w ww. ja v a 2 s . c o m*/ GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f); GL11.glRotatef(-90.0f + chest.getRotation() * -90.0f, 0.0f, 1.0f, 0.0f); chest.getAnimationState().render(); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelBaseChest.java
License:Open Source License
public void renderItem() { GL11.glPushMatrix();/* www .j a v a 2 s . c om*/ GL11.glDisable(GL11.GL_LIGHTING); // GL11.glTranslatef(0.0f, -0.5f, 0.0f); GL11.glRotatef(180.0f, 0.0f, 1.0f, 0.0f); ModColladaModel.getModelManager().getModel(openResourceName).renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelFluorecentSpot.java
License:Open Source License
public void render(TileEntityFluorecentBlock chest, double x, double y, double z) { int meta = chest.getBlockMetadata(); GL11.glPushMatrix();/* www. jav a2s .co m*/ GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); if (meta != 0) { GL11.glTranslatef((float) 0.0f, (float) 0.5f, (float) 0.0f); GL11.glRotatef(90.0f * (meta - 1) + 90.0f, 0.0f, 1.0f, 0.0f); GL11.glRotatef(-90.f, 1.0f, 0.0f, 0.0f); GL11.glTranslatef((float) 0.0f, (float) -0.5f, (float) 0.0f); } // GL11.glTranslated((float) 2.0f*x, (float) 2.0f*y, (float) 2.0f*z); // GL11.glTranslatef((float) 0.5f, (float) 0.0f, (float)0.5f); // this.renderAnimation(chest.getAnimationFrame()); ModColladaModel.getModelManager().getModel(modelResource).renderAll(); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelFluorecentSpot.java
License:Open Source License
public void renderItem() { GL11.glPushMatrix();/*from w w w . j a v a 2 s . c o m*/ GL11.glDisable(GL11.GL_LIGHTING); GL11.glTranslatef(0.0f, -0.5f, 0.0f); ModColladaModel.getModelManager().getModel(modelResource).renderAll(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glPopMatrix(); }
From source file:com.hea3ven.pandoraschest.client.model.ModelFluorecentTube.java
License:Open Source License
public void render(TileEntityFluorecentTubeBlock chest, double x, double y, double z) { int meta = chest.getBlockMetadata(); GL11.glPushMatrix();// ww w. j av a 2s .c om GL11.glTranslatef((float) x + 0.5f, (float) y, (float) z + 0.5f); if (meta != 0) { GL11.glTranslatef((float) 0.0f + (chest.getXOffset() / 2.0f), (float) 0.5f + (chest.getYOffset() / 2.0f), (float) 0.0f + (chest.getZOffset() / 2.0f)); GL11.glRotatef(90.0f * (meta - 1) + 90.0f + ((chest.getYOffset() == 0) ? 90.0f : 0.0f), 0.0f, 1.0f, 0.0f); if (chest.getYOffset() != 0) GL11.glRotatef(-90.f, 1.0f, 0.0f, 0.0f); else GL11.glRotatef(-90.f, 0.0f, 0.0f, 1.0f); GL11.glTranslatef((float) 0.0f, (float) -0.5f, (float) 0.0f); } else { GL11.glTranslatef(chest.getXOffset() / 2.0f, chest.getYOffset() / 2.0f, chest.getZOffset() / 2.0f); if (chest.getXOffset() != 0) GL11.glRotatef(90.f, 0.0f, 1.0f, 0.0f); } // GL11.glTranslated((float) 2.0f*x, (float) 2.0f*y, (float) 2.0f*z); // GL11.glTranslatef((float) 0.5f, (float) 0.0f, (float)0.5f); // this.renderAnimation(chest.getAnimationFrame()); ModColladaModel.getModelManager().getModel(modelResource).renderAll(); GL11.glPopMatrix(); }
From source file:com.hilburn.dimensionguard.client.DisabledRenderer.java
License:Open Source License
@Override public void renderItem(ItemRenderType type, ItemStack itemStack, Object... data) { ItemStack thisStack = ItemStack//from w ww . ja v a 2s. c om .loadItemStackFromNBT((NBTTagCompound) itemStack.stackTagCompound.getTag("ItemStack")); boolean isInventory = type == ItemRenderType.INVENTORY; Tessellator tess = Tessellator.instance; FontRenderer fontRenderer = mc.fontRenderer; TextureManager textureManager = mc.getTextureManager(); GL11.glPushMatrix(); Item item = thisStack.getItem(); Block block = Block.getBlockFromItem(item); if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_CULL_FACE); OpenGlHelper.glBlendFunc(770, 771, 1, 0); } IItemRenderer storedRenderer = MinecraftForgeClient.getItemRenderer(thisStack, type); //======Handles Special Blocks and Items====== if (storedRenderer != null) { storedRenderer.renderItem(type, thisStack, data); } else { if (thisStack.getItemSpriteNumber() == 0 && item instanceof ItemBlock && RenderBlocks.renderItemIn3d(block.getRenderType())) { //=====Handles regular blocks====== textureManager.bindTexture(textureManager.getResourceLocation(0)); switch (type) { case EQUIPPED_FIRST_PERSON: case EQUIPPED: case ENTITY: GL11.glTranslatef(0.5F, 0.5F, 0.5F); default: } if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDepthMask(false); renderBlocksIr.renderBlockAsItem(block, thisStack.getItemDamage(), 1.0F); GL11.glDepthMask(true); } else { renderBlocksIr.renderBlockAsItem(block, thisStack.getItemDamage(), 1.0F); } } else { //=======Handles Regular Items====== if (isInventory) { renderItem.renderItemIntoGUI(fontRenderer, textureManager, thisStack, 0, 0); } else { GL11.glEnable(GL12.GL_RESCALE_NORMAL); switch (type) { case EQUIPPED_FIRST_PERSON: //TODO: get items to render in the right place GL11.glRotated(90F, 0F, 1F, 0F); GL11.glTranslatef(-1F, 0.5F, 0F); break; case EQUIPPED: GL11.glRotated(90F, 0F, 1F, 0F); GL11.glTranslatef(-1F, 0.5F, 0F); GL11.glRotated(90F, 1F, 0F, 0F); //GL11.glTranslatef(0, -4 / 16f, 0); break; case ENTITY: //GL11.glTranslatef(-0.5f, 0f, 1f / 16f); // correction of the rotation point when items lie on the ground default: } IIcon icon = thisStack.getIconIndex(); float xMax; float yMin; float xMin; float yMax; float depth = 1f / 16f; float width; float height; float xDiff; float yDiff; float xSub; float ySub; xMin = icon.getMinU(); xMax = icon.getMaxU(); yMin = icon.getMinV(); yMax = icon.getMaxV(); width = icon.getIconWidth(); height = icon.getIconHeight(); xDiff = xMin - xMax; yDiff = yMin - yMax; xSub = 0.5f * (xMax - xMin) / width; ySub = 0.5f * (yMax - yMin) / height; //=====Front and back===== tess.startDrawingQuads(); tess.setNormal(0, 0, 1); tess.addVertexWithUV(0, 0, 0, xMax, yMax); tess.addVertexWithUV(1, 0, 0, xMin, yMax); tess.addVertexWithUV(1, 1, 0, xMin, yMin); tess.addVertexWithUV(0, 1, 0, xMax, yMin); tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, 0, -1); tess.addVertexWithUV(0, 1, -depth, xMax, yMin); tess.addVertexWithUV(1, 1, -depth, xMin, yMin); tess.addVertexWithUV(1, 0, -depth, xMin, yMax); tess.addVertexWithUV(0, 0, -depth, xMax, yMax); tess.draw(); // =========Sides============ tess.startDrawingQuads(); tess.setNormal(-1, 0, 0); float pos; float iconPos; float w = width, m = xMax, d = xDiff, s = xSub; for (int k = 0, e = (int) w; k < e; ++k) { pos = k / w; iconPos = m + d * pos - s; tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax); tess.addVertexWithUV(pos, 0, 0, iconPos, yMax); tess.addVertexWithUV(pos, 1, 0, iconPos, yMin); tess.addVertexWithUV(pos, 1, -depth, iconPos, yMin); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(1, 0, 0); float posEnd; w = width; m = xMax; d = xDiff; s = xSub; float d2 = 1f / w; for (int k = 0, e = (int) w; k < e; ++k) { pos = k / w; iconPos = m + d * pos - s; posEnd = pos + d2; tess.addVertexWithUV(posEnd, 1, -depth, iconPos, yMin); tess.addVertexWithUV(posEnd, 1, 0, iconPos, yMin); tess.addVertexWithUV(posEnd, 0, 0, iconPos, yMax); tess.addVertexWithUV(posEnd, 0, -depth, iconPos, yMax); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, 1, 0); float h = height; m = yMax; d = yDiff; s = ySub; d2 = 1f / h; for (int k = 0, e = (int) h; k < e; ++k) { pos = k / h; iconPos = m + d * pos - s; posEnd = pos + d2; tess.addVertexWithUV(0, posEnd, 0, xMax, iconPos); tess.addVertexWithUV(1, posEnd, 0, xMin, iconPos); tess.addVertexWithUV(1, posEnd, -depth, xMin, iconPos); tess.addVertexWithUV(0, posEnd, -depth, xMax, iconPos); } tess.draw(); tess.startDrawingQuads(); tess.setNormal(0, -1, 0); h = height; m = yMax; d = yDiff; s = ySub; for (int k = 0, e = (int) h; k < e; ++k) { pos = k / h; iconPos = m + d * pos - s; tess.addVertexWithUV(1, pos, 0, xMin, iconPos); tess.addVertexWithUV(0, pos, 0, xMax, iconPos); tess.addVertexWithUV(0, pos, -depth, xMax, iconPos); tess.addVertexWithUV(1, pos, -depth, xMin, iconPos); } tess.draw(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } } if (thisStack != null && block != null && block.getRenderBlockPass() != 0) { GL11.glDisable(GL11.GL_BLEND); } GL11.glPopMatrix(); if (isInventory) { renderItem.renderItemIntoGUI(fontRenderer, textureManager, itemStack, 0, 0); //TODO: only renders on items, not blocks - fix } }
From source file:com.irr310.i3d.scene.element.I3dElement.java
License:Open Source License
/** * Internal public method Mthode principal du rendu d'un lment. Cette * mthode appelle le code de rendu spcifique de l'lment via la mthode * doDisplay si ncessaire.//from ww w. j a v a 2 s . c om * * @param gl * context gl du rendu * @param camera * point de vue */ final public void display(I3dCamera camera) { if (!visible) { return; } if (!inited) { init(); } GL11.glPushMatrix(); if (transformMatrix != null) { GL11.glMultMatrix(transformMatrix); } else { if (rotation.x != 0) { GL11.glRotatef(rotation.x, 1, 0, 0); } if (rotation.y != 0) { GL11.glRotatef(rotation.y, 0, 1, 0); } if (rotation.z != 0) { GL11.glRotatef(rotation.z, 0, 0, 1); } if (position.x != 0 || position.y != 0 || position.z != 0) { GL11.glTranslatef(position.x, position.y, position.z); } } if (scale.x != 1 || scale.y != 1 || scale.z != 1) { GL11.glScalef(scale.x, scale.y, scale.z); } animation.preDisplay(); if (animation.doDisplay()) { if (showShape) { doDisplay(camera); } if (showBoundingBox) { getBoundingBox().display(); } } animation.postDisplay(); GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.element.I3dElement.java
License:Open Source License
/** * Internal public method Mthode principal du rendu de selection d'un * lment. Cette mthode appelle le code de rendu de selection spcifique * de l'lment via la mthode doSelect si ncessaire. Les animations * n'entrent pas en jeu dans le rendu de selection. * /* www.j a v a 2s .com*/ * @param gl * context gl du rendu de selection * @param camera * point de vue */ final public void select(I3dCamera camera, long parentId) { if (!inited) { init(); } if (!isTangible() || !showShape) { return; } GL11.glPushMatrix(); // TODO: verify this cast. Maybe change id from long to int if (selectable) { GL11.glLoadName((int) id); } if (rotation.x != 0) { GL11.glRotatef(rotation.x, 1, 0, 0); } if (rotation.y != 0) { GL11.glRotatef(rotation.y, 0, 1, 0); } if (rotation.z != 0) { GL11.glRotatef(rotation.z, 0, 0, 1); } if (position.x != 0 || position.y != 0 || position.z != 0) { GL11.glTranslatef(position.x, position.y, position.z); } if (scale.x != 1 || scale.y != 1 || scale.z != 1) { GL11.glScalef(scale.x, scale.y, scale.z); } if (selectable) { doSelect(camera, id); } else { doSelect(camera, parentId); } if (selectable) { GL11.glLoadName((int) parentId); } GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.I3dCamera.java
License:Open Source License
public void display(float width, float height) { this.currentWidth = width; this.currentHeight = height; GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w ww . ja va2 s. co m GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); backgroundScene.display(this); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); initPerspective(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glPushMatrix(); configureView(glu); if (!configured) { configured = true; if (cameraInitialisation != null) { cameraInitialisation.run(); cameraInitialisation = null; } } GL11.glColor3f(1, 0, 0); GL11.glBegin(GL11.GL_LINES); GL11.glVertex3d(0, 0, 0); GL11.glVertex3d(100, 100, 100); GL11.glEnd(); preDisplayScene(); if (currentScene != null) { currentScene.display(this); } postDisplayScene(); preDisplayGui(); postDisplayGui(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, 0, height, -2000.0, 2000.0); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); hudScene.display(this); GL11.glPopMatrix(); }
From source file:com.irr310.i3d.scene.I3dEye3DCamera.java
License:Open Source License
@Override public void enableRotation() { GL11.glPopMatrix(); }