List of usage examples for org.lwjgl.opengl GL11 glLoadIdentity
public static native void glLoadIdentity();
From source file:net.adam_keenan.voxel.hud.HUD.java
License:Creative Commons License
public static void drawCrosshairs() { float screenx = (float) Display.getWidth() / 2, screeny = (float) Display.getHeight() / 2; float x1, y1, x2, y2, width1 = 4, height1 = 20, width2 = height1, height2 = width1; x1 = screenx - width1 / 2;//from w w w. j av a 2 s .c o m y1 = screeny - height1 / 2; x2 = screenx - width2 / 2; y2 = screeny - height2 / 2; FloatBuffer perspectiveProjectionMatrix; FloatBuffer orthographicProjectionMatrix; perspectiveProjectionMatrix = BufferUtils.createFloatBuffer(16); orthographicProjectionMatrix = BufferUtils.createFloatBuffer(16); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, perspectiveProjectionMatrix); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glGetFloat(GL11.GL_PROJECTION_MATRIX, orthographicProjectionMatrix); // GL11.glLoadMatrix(perspectiveProjectionMatrix); GL11.glMatrixMode(GL11.GL_PROJECTION); // For text drawing GL11.glLoadMatrix(orthographicProjectionMatrix); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS); GL11.glLoadIdentity(); // Clears matrix GL11.glColor4f(0, 0, 0, .5f); GL11.glRectf(x1, y1, x1 + width1, y1 + height1); GL11.glRectf(x2, y2, x2 + (width2 - width1) / 2, y2 + height2); GL11.glRectf(x2 + (width2 + width1) / 2, y2, x2 + width2, y2 + height2); GL11.glPopMatrix(); GL11.glPopAttrib(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadMatrix(perspectiveProjectionMatrix); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:net.ae97.notlet.client.GameInstance.java
License:Open Source License
public static void createTextures() throws LWJGLException { Display.setDisplayMode(new DisplayMode(width, height)); Display.create();/* w ww . j a va2 s. c o m*/ Display.setVSyncEnabled(true); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // enable alpha blending GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glViewport(0, 0, width, height); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, width, height, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); Font awtFont = new Font("Times New Roman", Font.BOLD, 18); font = new TrueTypeFont(awtFont, true); try { textureMapping.put("SMALLLET", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("SMALLLET.png"))); textureMapping.put("healthbar", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("healthbar.png"))); textureMapping.put("score", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("score.png"))); textureMapping.put("arrow", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("arrow.png"))); textureMapping.put("dirt", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("dirt.png"))); textureMapping.put("rangerD", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("rangerD.png"))); textureMapping.put("rangerL", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("rangerL.png"))); textureMapping.put("rangerR", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("rangerR.png"))); textureMapping.put("rangerU", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("rangerU.png"))); textureMapping.put("skele", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("skele.png"))); textureMapping.put("slime", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("slime.png"))); textureMapping.put("hp", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("hp.png"))); textureMapping.put("pb", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("pb.png"))); textureMapping.put("wall", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("wall.png"))); textureMapping.put("exit", TextureLoader.getTexture("PNG", ResourceLoader.getResourceAsStream("exit.png"))); } catch (IOException ex) { throw new RuntimeException(ex); } }
From source file:net.kubin.world.characters.CharacterBody.java
License:Apache License
public void transformToRightHand() { /* Transform the matix */ GL11.glLoadIdentity(); GL11.glTranslatef(0.2f - _progressRightHand / 10.0f, -0.05f, -0.2f - _progressRightHand / 20.0f * +(_progressRightHand * _blockDistance * 1.2f)); GL11.glRotatef(-65, 0, 1, 0);// w w w . j av a2 s . c o m GL11.glRotated(_progressRightHand * 50 - 10.0d, 0, 0, 1); GL11.glRotated(_progressRightHand * 20, 1, 1, 0); GL11.glRotatef(90, 0, 0, 1); GL11.glRotatef(20, 0, 1, 0); }
From source file:net.malisis.doors.door.renderer.ForcefieldRenderer.java
License:Open Source License
@Override public void render() { tileEntity = MultiBlock.getOriginProvider(ForcefieldTileEntity.class, world, x, y, z); if (tileEntity == null || tileEntity.isOpened() || !MultiBlock.isOrigin(world, x, y, z)) return;/*from ww w . j a v a 2 s. c o m*/ enableBlending(); tileEntity = (ForcefieldTileEntity) super.tileEntity; direction = ForgeDirection.getOrientation(tileEntity.getDirection()); model.resetState(); //ar.setStartTime(tileEntity.getStartNanoTime()); if (tileEntity.getMovement() == null) return; AxisAlignedBB aabb = tileEntity.getMovement().getBoundingBox(tileEntity, false, BoundingBoxType.COLLISION); if (aabb == null) return; aabb.offset(-x, -y, -z); rp.renderBounds.set(aabb); direction = ForgeDirection.NORTH; if ((int) aabb.minY == (int) aabb.maxY) { direction = ForgeDirection.UP; model.rotate(90, 1, 0, 0, 0, 0, 0); } else if ((int) aabb.minX == (int) aabb.maxX) { direction = ForgeDirection.EAST; model.rotate(90, 0, 1, 0, 0, 0, 0); } setTextureMatrix(); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); GL11.glDisable(GL11.GL_CULL_FACE); model.render(this, rp); next(); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glDisable(GL11.GL_BLEND); }
From source file:net.malisis.doors.door.renderer.ForcefieldRenderer.java
License:Open Source License
private void setTextureMatrix() { long elapsed = ar.getElapsedTime() / 50; int n = (int) (elapsed % 50); bindTexture(rl[n]);//from w ww. java2 s .c o m GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); AxisAlignedBB aabb = tileEntity.getMultiBlock().getBounds(); double scaleX = 1, scaleY = 1; if (direction == ForgeDirection.UP) { scaleX = aabb.maxX - aabb.minX; scaleY = aabb.maxZ - aabb.minZ; if (aabb.maxZ - aabb.minZ > aabb.maxX - aabb.minX) GL11.glRotatef(90, 0, 0, 1); } else { scaleY = aabb.maxY - aabb.minY; if (direction == ForgeDirection.EAST) scaleX = aabb.maxZ - aabb.minZ; else if (direction == ForgeDirection.NORTH) scaleX = aabb.maxX - aabb.minX; } //GL11.glTranslatef(fx, fy, 0); GL11.glScaled(scaleX / 3, scaleY / 3, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:net.minecraft.client.gui.GuiAchievement.java
private void updateAchievementWindowScale() { GL11.glViewport(0, 0, this.theGame.displayWidth, this.theGame.displayHeight); GL11.glMatrixMode(5889 /*GL_PROJECTION*/); GL11.glLoadIdentity(); GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/); GL11.glLoadIdentity();/*from w w w . j a v a 2s. c o m*/ this.achievementWindowWidth = this.theGame.displayWidth; this.achievementWindowHeight = this.theGame.displayHeight; ScaledResolution var1 = new ScaledResolution(this.theGame.gameSettings, this.theGame.displayWidth, this.theGame.displayHeight); this.achievementWindowWidth = var1.getScaledWidth(); this.achievementWindowHeight = var1.getScaledHeight(); GL11.glClear(256); GL11.glMatrixMode(5889 /*GL_PROJECTION*/); GL11.glLoadIdentity(); GL11.glOrtho(0.0D, (double) this.achievementWindowWidth, (double) this.achievementWindowHeight, 0.0D, 1000.0D, 3000.0D); GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/); GL11.glLoadIdentity(); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); }
From source file:net.phatcode.rel.multimedia.Renderer.java
License:Open Source License
Renderer(int screenWidth, int screenHeight) { try {//from ww w .j a v a 2 s. c o m Display.setDisplayMode(new DisplayMode(screenWidth, screenHeight)); Display.create(); Display.setTitle("AnyaBasic 0.4.0 beta"); } catch (LWJGLException e) { e.printStackTrace(); } this.screenWidth = screenWidth; this.screenHeight = screenHeight; GL11.glViewport(0, 0, screenWidth, screenHeight); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, screenWidth, screenHeight, 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glShadeModel(GL11.GL_SMOOTH); //set shading to smooth(try GL_FLAT) GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); //set Clear color to BLACK GL11.glClearDepth(1.0f); //Set Depth buffer to 1(z-Buffer) GL11.glDisable(GL11.GL_DEPTH_TEST); //Disable Depth Testing so that our z-buffer works GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_COLOR_MATERIAL); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glAlphaFunc(GL11.GL_GREATER, 0); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glPolygonMode(GL11.GL_FRONT, GL11.GL_FILL); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glTranslatef(0.375f, 0.375f, 0); // magic trick }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setModelViewIdentity() { GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); return this; }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setProjectionFrustum(double left, double right, double bottom, double top, double zNear, double zFar) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // glFrustum sadly doesn't set all rows and columns GL11.glFrustum(left, right, bottom, top, zNear, zFar); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); return this; }
From source file:net.smert.frameworkgl.opengl.OpenGL1.java
License:Apache License
public OpenGL1 setProjectionOrtho(double left, double right, double bottom, double top, double zNear, double zFar) { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // glOrtho sadly doesn't set all rows and columns GL11.glOrtho(left, right, bottom, top, zNear, zFar); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); return this; }