List of usage examples for org.lwjgl.opengl GL11 glLoadIdentity
public static native void glLoadIdentity();
From source file:lwjgl29.GlobalClass.Quad.java
@Override public void init() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, Display.getWidth(), 0, Display.getHeight(), 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:lwjglapp.Renderer.java
private void initGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45.0f, (float) (width / height), 0.1f, 100.0f); GL11.glMatrixMode(GL11.GL_MODELVIEW); // GL11.glLoadIdentity(); ///*from w ww . j ava 2s . co m*/ // GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping ( NEW ) // GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); GL11.glClearDepth(1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); }
From source file:lwjglapp.Renderer.java
public void preRender() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL11.GL_STENCIL_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();/*w ww. j a v a 2 s . c o m*/ }
From source file:lyonlancer5.pfsteel.client.render.entity.RenderDesertCreeper.java
License:Open Source License
/** * Queries whether should render the specified pass or not. *//*from w ww.j a va 2 s. c o m*/ protected int shouldRenderPass(EntityDesertCreeper p_77032_1_, int p_77032_2_, float p_77032_3_) { if (p_77032_1_.getPowered()) { if (p_77032_1_.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } if (p_77032_2_ == 1) { float f1 = (float) p_77032_1_.ticksExisted + p_77032_3_; this.bindTexture(armoredCreeperTextures); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f2 = f1 * 0.01F; float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.creeperModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); float f4 = 0.5F; GL11.glColor4f(f4, f4, f4, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (p_77032_2_ == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }
From source file:lyonlancer5.pfsteel.client.render.entity.RenderNetherCreeper.java
License:Open Source License
/** * Queries whether should render the specified pass or not. *///from ww w . j av a 2 s. c o m protected int shouldRenderPass(EntityNetherCreeper p_77032_1_, int p_77032_2_, float p_77032_3_) { if (p_77032_1_.getPowered()) { if (p_77032_1_.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } if (p_77032_2_ == 1) { float f1 = (float) p_77032_1_.ticksExisted + p_77032_3_; this.bindTexture(armoredCreeperTextures); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f2 = f1 * 0.01F; float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.creeperModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); float f4 = 0.5F; GL11.glColor4f(f4, f4, f4, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (p_77032_2_ == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }
From source file:lyonlancer5.pfsteel.client.render.entity.RenderSnowCreeper.java
License:Open Source License
/** * Queries whether should render the specified pass or not. *//* w w w . j a v a2 s. c om*/ protected int shouldRenderPass(EntitySnowCreeper p_77032_1_, int p_77032_2_, float p_77032_3_) { if (p_77032_1_.getPowered()) { if (p_77032_1_.isInvisible()) { GL11.glDepthMask(false); } else { GL11.glDepthMask(true); } if (p_77032_2_ == 1) { float f1 = (float) p_77032_1_.ticksExisted + p_77032_3_; this.bindTexture(armoredCreeperTextures); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f2 = f1 * 0.01F; float f3 = f1 * 0.01F; GL11.glTranslatef(f2, f3, 0.0F); this.setRenderPassModel(this.creeperModel); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); float f4 = 0.5F; GL11.glColor4f(f4, f4, f4, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE); return 1; } if (p_77032_2_ == 2) { GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); } } return -1; }
From source file:lyonlancer5.xatrocore.lib.internal.MCv18.java
License:Open Source License
@SideOnly(Side.CLIENT) protected static void drawSplashScreen(Minecraft mcIn, TextureManager textureManager) { ScaledResolution scaledresolution = new ScaledResolution(mcIn, mcIn.displayWidth, mcIn.displayHeight); int i = scaledresolution.getScaleFactor(); Framebuffer framebuffer = new Framebuffer(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i, true); framebuffer.bindFramebuffer(false);//w ww .ja v a2s.co m //GlStateManager.matrixMode(5889); GL11.glMatrixMode(5889); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.ortho(0.0D, (double)scaledresolution.getScaledWidth(), (double)scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); GL11.glOrtho(0.0D, (double) scaledresolution.getScaledWidth(), (double) scaledresolution.getScaledHeight(), 0.0D, 1000.0D, 3000.0D); //GlStateManager.matrixMode(5888); GL11.glMatrixMode(5888); //GlStateManager.loadIdentity(); GL11.glLoadIdentity(); //GlStateManager.translate(0.0F, 0.0F, -2000.0F); GL11.glTranslatef(0.0F, 0.0F, -2000.0F); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); //GlStateManager.disableDepth(); GL11.glDisable(GL11.GL_DEPTH); //GlStateManager.enableTexture2D(); GL11.glEnable(GL11.GL_TEXTURE_2D); InputStream inputstream = null; try { //inputstream = this.mcDefaultResourcePack.getInputStream(locationMojangPng); inputstream = mcIn.getResourcePackRepository().rprDefaultResourcePack.getInputStream(locationMojangPng); mojangLogo = textureManager.getDynamicTextureLocation("logo", new DynamicTexture(ImageIO.read(inputstream))); textureManager.bindTexture(mojangLogo); } catch (IOException ioexception) { //logger.error("Unable to load logo: " + locationMojangPng, ioexception); } finally { IOUtils.closeQuietly(inputstream); } Tessellator tessellator = Tessellator.instance; //WorldRenderer worldrenderer = tessellator.getWorldRenderer(); //worldrenderer.startDrawingQuads(); tessellator.startDrawingQuads(); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); //worldrenderer.addVertexWithUV(0.0D, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)mcIn.displayWidth, (double)mcIn.displayHeight, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, (double) mcIn.displayHeight, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV((double)this.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV((double) mcIn.displayWidth, 0.0D, 0.0D, 0.0D, 0.0D); //worldrenderer.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, 0.0D, 0.0D); tessellator.draw(); //GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); //worldrenderer.setColorOpaque_I(16777215); tessellator.setColorOpaque_I(16777215); short short1 = 256; short short2 = 256; mcIn.scaledTessellator((scaledresolution.getScaledWidth() - short1) / 2, (scaledresolution.getScaledHeight() - short2) / 2, 0, 0, short1, short2); //GlStateManager.disableLighting(); GL11.glDisable(GL11.GL_LIGHTING); //GlStateManager.disableFog(); GL11.glDisable(GL11.GL_FOG); framebuffer.unbindFramebuffer(); framebuffer.framebufferRender(scaledresolution.getScaledWidth() * i, scaledresolution.getScaledHeight() * i); //GlStateManager.enableAlpha(); GL11.glEnable(GL11.GL_ALPHA); //GlStateManager.alphaFunc(516, 0.1F); GL11.glAlphaFunc(516, 0.1F); updateDisplay(mcIn); }
From source file:main.Credits.java
License:Creative Commons License
public void run(boolean initi) { FONT = Main.FONT;//from w w w . j a v a2s . c om FONT2 = Main.FONT2; FULL = Display.isFullscreen(); if (QUALITY == 1) { WIDTH = 500; HEIGHT = 500; } init(initi); while (run) { glClear(GL_COLOR_BUFFER_BIT); glPushMatrix(); glTranslatef(translate_x, translate_y, 0); if (Display.wasResized()) { RWIDTH = Display.getWidth(); RHEIGHT = Display.getHeight(); GL11.glViewport(0, 0, RWIDTH, RHEIGHT); GL11.glLoadIdentity(); } // Retrieve the "true" coordinates of the mouse. mousex = (int) (Mouse.getX() * ((float) (WIDTH) / RWIDTH) - translate_x); mousey = (int) (HEIGHT - Mouse.getY() * ((float) (HEIGHT) / RHEIGHT) - 1 - translate_y); Draw.renderthistex(new Rectangle(0, 0, WIDTH, HEIGHT), purple); logic(); render(); update(); if (Display.isCloseRequested()) { run = false; Main.run = false; } glPopMatrix(); Display.update(); Display.sync(60); } Main.RWIDTH = RWIDTH; Main.RHEIGHT = RHEIGHT; }
From source file:Main.Graphics.GameObject.java
public static void initGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, 800, 0, 600, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); }
From source file:map.GameMap.java
License:Open Source License
private void renderMinimap() { int size = MINIMAP_SIZE; Texture tex = new Texture("ground"); miniMap = new Material(name + "_minimap"); int[] viewport = GLUtils.getViewport(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GL11.glOrtho(0, size, size, 0, -10, 10); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();//from w w w .j a v a 2 s . c o m GL11.glViewport(0, 0, size, size); GL11.glClearColor(0.0f, 0, 0, 1.0f); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glScalef(size / tiles.length, size / tiles.length, size / tiles.length); GLUtils.glLightPos(1.0f, 1.0f, 1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_CULL_FACE); draw(null); GL11.glEnable(GL11.GL_CULL_FACE); IntBuffer addr = ByteBuffer.allocateDirect(4).order(ByteOrder.nativeOrder()).asIntBuffer(); GL11.glGenTextures(addr); tex.setID(addr.get(0)); GL11.glBindTexture(GL11.GL_TEXTURE_2D, tex.getID()); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, GL11.GL_CLAMP); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR); GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR); GL11.glCopyTexImage2D(GL11.GL_TEXTURE_2D, 0, GL11.GL_RGB, 0, 0, size, size, 0); miniMap.setTexture(0, tex); GL11.glViewport(viewport[0], viewport[1], viewport[2], viewport[3]); }