List of usage examples for org.lwjgl.opengl GL11 GL_MODELVIEW
int GL_MODELVIEW
To view the source code for org.lwjgl.opengl GL11 GL_MODELVIEW.
Click Source Link
From source file:vazkii.tinkerer.gui.GuiElementalDesk.java
License:Creative Commons License
@Override protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); mc.renderEngine.bindTexture(ResourcesReference.GUI_ELEMENTAL_DESK_TEXTURE); int xStart = (width - xSize) / 2; int yStart = (height - ySize) / 2; drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize); // Draw the Progress bar drawTexturedModalRect(xStart + 48, yStart + 46, 176, 0, (int) Math.round(deskTile.getProgress() / (TileEntityReference.ELEMENTAL_DESK_ENCHANT_TIME / 80D)), 12);/*from www . j a va 2 s .c o m*/ // Render the Book Model, if present ItemStack shouldBeABook = deskTile.getStackInSlot(4); if (shouldBeABook != null && (shouldBeABook.itemID == Item.book.itemID || shouldBeABook.itemID == ElementalTinkererItems.unboundBook.itemID)) { GL11.glPushMatrix(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); ScaledResolution var7 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); GL11.glViewport((var7.getScaledWidth() - 320) / 2 * var7.getScaleFactor(), (var7.getScaledHeight() - 240) / 2 * var7.getScaleFactor(), 320 * var7.getScaleFactor(), 240 * var7.getScaleFactor()); GL11.glTranslatef(0F, 0.25F, 0F); GLU.gluPerspective(90F, 1.3333334F, 9F, 80F); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); RenderHelper.enableStandardItemLighting(); float cos = (float) (Math.cos(ClientTickHandler.elapsedClientTicks / 3D) / 10D); GL11.glTranslatef(0.4F, 3.65F + (deskTile.getIsAdvancing() ? cos : -0.1F), -16F); GL11.glScalef(1F, 1F, 1F); float var9 = 5.0F; GL11.glScalef(var9, var9, var9); GL11.glRotatef(180F, -0.29F, 0F, 1F); float var10 = 0.6F; GL11.glTranslatef((1F - var10) * 0.2F, (1F - var10) * 0.1F, (1F - var10) * 0.25F); GL11.glRotatef(-(1F - var10) * 90F - 90F, 0F, 1F, 0F); GL11.glRotatef(180F, 1F, 0F, 0F); mc.renderEngine.bindTexture(shouldBeABook.itemID == ItemIDs.unboundBook ? ResourcesReference.ROOT_BOOK_TEXTURES + "Unbound.png" : "/item/book.png"); GL11.glEnable(GL12.GL_RESCALE_NORMAL); bookModel.render(null, 0F, 0F, 0F, (float) deskTile.getProgress() / (float) TileEntityReference.ELEMENTAL_DESK_ENCHANT_TIME, 0F, MiscReference.MODEL_DEFAULT_RENDER_SCALE); GL11.glDisable(GL12.GL_RESCALE_NORMAL); RenderHelper.disableStandardItemLighting(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); RenderHelper.disableStandardItemLighting(); GL11.glColor4f(1F, 1F, 1F, 1F); } // Draw the charge bars int color = Color.getHSBColor((float) Math.cos( (double) ClientTickHandler.elapsedClientTicks / ResourcesReference.SPECTRUM_DIVISOR_ELEMENTIUM_GEM), 1F, 1F).getRGB(); Tessellator tess = Tessellator.instance; GL11.glDisable(GL11.GL_TEXTURE_2D); for (int[] i : CHARGE_METER_COORDINATES) { int index = i[0]; int x = i[1]; int endY = i[2] + TileEntityReference.ELEMENTAL_DESK_GEM_CHARGE; int startY = endY - deskTile.getCharge(index); tess.startDrawingQuads(); tess.setColorOpaque_I(color); tess.addVertex(xStart + x, yStart + startY, zLevel); tess.addVertex(xStart + x, yStart + endY, zLevel); tess.addVertex(xStart + x + 2, yStart + endY, zLevel); tess.addVertex(xStart + x + 2, yStart + startY, zLevel); tess.draw(); } GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:vengine.VGraphicLayer.java
public void set() { if (!inited) { init();//w ww .ja va 2 s . co m inited = true; } GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:vengine.VGraphics.java
public static void start() { Thread renderingThread = new Thread("RenderingThread") { @Override/*from w w w . j av a2 s . c o m*/ public void run() { try { Display.setDisplayMode(new DisplayMode(8000, 6000)); Display.setTitle(VEngine.cfg.g("mod")); Display.setIcon(new ByteBuffer[] { new ImageIOImageData().imageToByteBuffer( ImageIO.read(new File(VEngine.cfg.g("modhome") + "/icon.png")), false, false, null), new ImageIOImageData().imageToByteBuffer( ImageIO.read(new File(VEngine.cfg.g("modhome") + "/icon.png")), false, false, null) }); Display.setFullscreen(true); Display.setResizable(true); Display.create(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 1, 1, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); VGraphics g = new VGraphics(); Random r = new Random(); while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glEnable(GL11.GL_TEXTURE_2D); // ? ? ? ?. GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glEnable(GL11.GL_BLEND); WIDTH = Display.getWidth(); HEIGHT = Display.getHeight(); vgm.render(g); Display.update(); } Display.destroy(); System.exit(0); } catch (LWJGLException ex) { Logger.getLogger(VGraphics.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(VGraphics.class.getName()).log(Level.SEVERE, null, ex); } } }; renderingThread.setPriority(Thread.MAX_PRIORITY); renderingThread.start(); }
From source file:voxicity.Renderer.java
License:Open Source License
void setup_camera(float fov, float ratio, float view_distance) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity();//from w w w. j a v a2 s . c o m GLU.gluPerspective(fov, ratio, 0.01f, view_distance); GL11.glMatrixMode(GL11.GL_MODELVIEW); camera.set_attribs(fov, ratio, 0.01f, view_distance); }
From source file:yk.myengine.optiseq.states.LWJGLFont.java
/** * <code>print</code> renders the specified string to a given (x,y) * location. The x, y location is in terms of screen coordinates. There are * currently two sets of fonts supported: NORMAL and ITALICS. * * @param x the x screen location to start the string render. * @param y the y screen location to start the string render. * @param scale scale//from w w w. ja v a2 s . c o m * @param text the String to render. * @param italic the mode of font: NORMAL or ITALICS. */ public void print(final int x, final int y, final Vector3f scale, final String text, int italic) { // RendererRecord matRecord = (RendererRecord) DisplaySystem.getDisplaySystem().getCurrentContext().getRendererRecord(); if (italic > 1) { italic = 1; } else if (italic < 0) { italic = 0; } // if (!alreadyOrtho){ //todo move to outer function GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glLoadIdentity(); GLU.gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight()); // } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); GL11.glTranslatef(x, y, 0); GL11.glScalef(scale.x, scale.y, scale.z); //todo: make italic by matrix, instead of additional data!! (matter of principle) //also it must be realized in transformation state together with scale factor! GL11.glListBase(base - 32 + (128 * italic)); //Put the string into a "pointer" if (text.length() > scratch.capacity()) { scratch = BufferUtils.createByteBuffer(text.length()); } else { scratch.clear(); } final int charLen = text.length(); for (int z = 0; z < charLen; z++) { scratch.put((byte) text.charAt(z)); } scratch.flip(); GL11.glColor4f(fontColor.x, fontColor.y, fontColor.z, fontColor.w); //todo move to right place GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); //call the list for each letter in the string. GL11.glCallLists(scratch); GL11.glDisable(GL11.GL_BLEND); // set color back to white // GL11.glColor4f(fontColor.x, fontColor.y, fontColor.z, fontColor.w); // if (!alreadyOrtho) { //todo move to outer function GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix(); // } GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPopMatrix(); }
From source file:zeldaswordskills.client.render.block.RenderTileEntityPedestal.java
License:Open Source License
public void renderPedestal(TileEntityPedestal pedestal, double dx, double dy, double dz, float f) { ItemStack sword = pedestal.getSword(); if (sword != null) { GL11.glPushMatrix();//from w ww . j a v a2s . co m GL11.glTranslated(dx + 0.5D, dy + 0.9D, dz + 0.5D); bindTexture(field_147501_a.field_147553_e.getResourceLocation(sword.getItemSpriteNumber())); Tessellator tessellator = Tessellator.instance; IIcon icon = sword.getItem().getIconFromDamage(sword.getItemDamage()); if (icon != null) { float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); GL11.glRotatef(pedestal.getOrientation() == 0 ? 0F : 90F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(135.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.5F, -0.5F, 0.03125F); ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); if (sword.hasEffect(0)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); bindTexture(glint); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f7 = 0.76F; GL11.glColor4f(0.5F * f7, 0.25F * f7, 0.8F * f7, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f8 = 0.125F; GL11.glScalef(f8, f8, f8); float f9 = (float) (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 = (float) (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(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glPopMatrix(); } } }
From source file:zildo.fwk.gfx.filter.BilinearFilter.java
License:Open Source License
@Override public boolean renderFilter() { fbo.endRendering();/* w w w . j a v a2 s. c om*/ // Select right texture GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); // Disable blend GL11.glDisable(GL11.GL_BLEND); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glTranslatef(0, -sizeY, 1); GL11.glColor3f(1.0f, 1.0f, 1.0f); // Draw texture with depth super.render(); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); return true; }
From source file:zildo.fwk.gfx.filter.BlendFilter.java
License:Open Source License
@Override public boolean renderFilter() { int currentSquareSize = getCurrentSquareSize(); if (currentSquareSize == 1) { return true; }//from www. j a va2s. c o m fbo.endRendering(); // Get on top of screen and disable blending GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glTranslatef(0, -sizeY, 0); GL11.glColor3f(1f, 1f, 1f); // Draw squares int nSquareX = Zildo.viewPortX / currentSquareSize; int nSquareY = Zildo.viewPortY / currentSquareSize; GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glBegin(GL11.GL_QUADS); for (int i = 0; i < nSquareY + 1; i++) { for (int j = 0; j < nSquareX + 1; j++) { ClientEngineZildo.ortho.boxTexturedOpti(j * currentSquareSize, i * currentSquareSize, currentSquareSize, currentSquareSize, (j * currentSquareSize) / (float) ScreenFilter.realX, (i * currentSquareSize) / (float) ScreenFilter.realY, 0, 0); } } GL11.glEnd(); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); return true; }
From source file:zildo.fwk.gfx.filter.BlurFilter.java
License:Open Source License
@Override public boolean renderFilter() { boolean result = true; fbo.endRendering();//from w w w . ja v a2 s.c o m // Get on top of screen and disable blending GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glTranslatef(0, -sizeY, 0); //GL11.glDisable(GL11.GL_BLEND); if (nImagesSaved < nImages) { // All images are not stored yet. So we just display the current one. nImagesSaved++; GL11.glBindTexture(GL11.GL_TEXTURE_2D, texBuffer[currentImage]); super.render(); result = false; } else { super.focusOnZildo(); // Draw each image, with intensified colors for (int i = 0; i < nImages; i++) { float coeff = startCoeff + i * (incCoeff / nImages); GL11.glColor4f(coeff, coeff, coeff, 1.0f); GL11.glBindTexture(GL11.GL_TEXTURE_2D, texBuffer[(i + currentImage + 1) % nImages]); super.render(); if (i == 0) { // Enable blend from second one GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); //_MINUS_SRC_ALPHA); } } } GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); // Switch currentImage = (currentImage + 1) % nImages; return result; }
From source file:zildo.fwk.gfx.filter.CircleFilter.java
License:Open Source License
@Override public boolean renderFilter() { // Get on top of screen and disable blending GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();/*from w ww .ja v a 2 s . c o m*/ GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix(); GL11.glTranslatef(0, -sizeY, 1); GL11.glColor3f(1f, 1f, 1f); GL11.glBindTexture(GL11.GL_TEXTURE_2D, textureID); GL11.glBegin(GL11.GL_QUADS); int radius = (int) (coeffLevel * (255 - getFadeLevel())); // + 20; int radiusSquare = (int) Math.pow(radius, 2); int col = 0; int sizeA = center.y - radius; int sizeB = Zildo.viewPortY - (center.y + radius); // 1) Draw the two areas outside the circle if (sizeA > 0) { ClientEngineZildo.ortho.boxOpti(0, 0, Zildo.viewPortX, sizeA, 2, null); } if (sizeB > 0) { ClientEngineZildo.ortho.boxOpti(0, center.y + radius, Zildo.viewPortX, sizeB, 2, null); } // 2) Draw the circle area int startI = Math.max(0, sizeA); int endI = Math.min(Zildo.viewPortY, center.y + radius); for (int i = startI; i < endI; i++) { int start = (int) Math.pow(i - center.y, 2); // Calculate DELTA and 2 roots x1 & x2 double delta = 4 * (radiusSquare - start); double squareRootDelta = Math.sqrt(delta); int x1 = (int) (center.x - squareRootDelta / 2); int x2 = (int) (center.x + squareRootDelta / 2); ClientEngineZildo.ortho.boxOpti(0, i, x1, 1, col, null); ClientEngineZildo.ortho.boxOpti(x2, i, Zildo.viewPortX - x2, 1, col, null); } GL11.glEnd(); GL11.glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); return true; }