List of usage examples for org.lwjgl.opengl GL11 glViewport
public static void glViewport(@NativeType("GLint") int x, @NativeType("GLint") int y, @NativeType("GLsizei") int w, @NativeType("GLsizei") int h)
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glViewport(int a, int b, int c, int d) { GL11.glViewport(a, b, c, d); }
From source file:uk.co.ifs_studios.engine.util.OpenGL.java
License:Open Source License
/** * Setup OpenGL./*from w w w . java 2 s. c o m*/ * * @param width * - Width of screen. * @param height * - Height of screen. */ public static void initialize(int width, int height) { GL11.glClearColor(0f, 0f, 0f, 0f); GL11.glViewport(0, 0, width, height); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); }
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);//ww w .j a v a 2 s. c om // 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:vertigo.graphics.lwjgl.LWJGL_Renderer.java
License:Open Source License
void syncViewportSize(int i, int i0, int width, int height) { GL11.glViewport(0, 0, newDim.width, newDim.height); }
From source file:vertigo.graphics.lwjgl.LWJGL_Window.java
License:Open Source License
public void display() { while (!Display.isCloseRequested() && !closeRequested) { newDim = newCanvasSize.getAndSet(null); if (newDim != null) { vp_event.setSize(newDim.width, newDim.height); GL11.glViewport(0, 0, newDim.width, newDim.height); vpDispatcher.fireUpdate(vp_event); }//from w w w . j a v a2 s.c om Display.sync(60); pollInput(); displayScene(); Display.update(); } this.dispose(); Display.destroy(); frame.dispose(); }
From source file:zildo.fwk.gfx.Ortho.java
License:Open Source License
/** * Resize when using ZEditor// w w w. j av a 2 s. c o m * * @param p_x * @param p_y */ public void setSize(int p_x, int p_y, boolean p_zoom) { // Change viewport GL11.glViewport(0, 0, p_x, p_y); // And adapt ortho resetPerspectiveProjection(); w = p_x; h = p_y; setOrthographicProjection(p_zoom); }
From source file:zildo.fwk.opengl.compatibility.FBOHardware.java
License:Open Source License
@Override public void startRendering(int myFBOId, int sizeX, int sizeY) { EXTFramebufferObject.glBindFramebufferEXT(EXTFramebufferObject.GL_FRAMEBUFFER_EXT, myFBOId); GL11.glPushAttrib(GL11.GL_VIEWPORT_BIT); GL11.glViewport(0, 0, Zildo.viewPortX, Zildo.viewPortY); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); }
From source file:zildo.platform.opengl.LwjglOrtho.java
License:Open Source License
@Override public void setOrthographicProjection(boolean p_zoom) { if (!orthoSetUp) { // switch to projection mode GL11.glMatrixMode(GL11.GL_PROJECTION); // save previous matrix which contains the // settings for the perspective projection GL11.glPushMatrix();// ww w. j a v a2 s . c o m // reset matrix GL11.glLoadIdentity(); // set a 2D orthographic projection GL11.glViewport(0, 0, Zildo.screenX, Zildo.screenY); if (p_zoom) { GL11.glOrtho(0, w / 2, 0, h / 2, -99999, 99999); GL11.glTranslatef(0, -h / 2, 0); } else { GL11.glOrtho(0, w, 0, h, -99999, 99999); } // invert the y axis, down is positive // GL11.glScalef(1, -1, 1); // GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); // mover the origin from the bottom left corner // to the upper left corner GL11.glTranslatef(0, h, 0); GL11.glMatrixMode(GL11.GL_MODELVIEW); orthoSetUp = true; } }
From source file:zildo.platform.opengl.LwjglOrtho.java
License:Open Source License
@Override public void resetPerspectiveProjection(int p_x, int p_y) { if (orthoSetUp) { // Change viewport GL11.glViewport(0, 0, p_x, p_y); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix();//from w w w.j ava 2 s. c om GL11.glMatrixMode(GL11.GL_MODELVIEW); orthoSetUp = false; } }
From source file:zsawyer.mods.stereoscopic3d.MinecraftCopy.java
License:Open Source License
/** * Displays a new screen.//from w w w. java2 s . c o m */ public static void loadScreen() throws LWJGLException { ScaledResolution var1 = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight); GL11.glClear(16640); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, var1.getScaledWidth_double(), var1.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); GL11.glClearColor(0.0F, 0.0F, 0.0F, 0.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_FOG); Tessellator var2 = Tessellator.instance; GL11.glBindTexture(GL11.GL_TEXTURE_2D, mc.renderEngine.getTexture("/title/mojang.png")); var2.startDrawingQuads(); var2.setColorOpaque_I(16777215); var2.addVertexWithUV(0.0D, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double) mc.displayWidth, (double) mc.displayHeight, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV((double) mc.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); var2.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); var2.draw(); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); var2.setColorOpaque_I(16777215); short var3 = 256; short var4 = 256; mc.scaledTessellator((var1.getScaledWidth() - var3) / 2, (var1.getScaledHeight() - var4) / 2, 0, 0, var3, var4); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_FOG); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); Display.swapBuffers(); }