List of usage examples for org.lwjgl.opengl GL11 glMatrixMode
public static native void glMatrixMode(@NativeType("GLenum") int mode);
From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java
License:Minecraft Mod Public
/** * ????GL.//from w w w .ja v a 2s . c o m */ public static void beginRendering() { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glCullFace(GL11.GL_BACK); GL11.glDepthMask(false); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND); OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F); }
From source file:net.BiggerOnTheInside.Binder.Binder.java
License:Open Source License
/** * <p>Sets up OpenGL.</p>// w w w . j a va 2 s . com */ public void initGL() { int width = displayMode.getWidth(); int height = displayMode.getHeight(); /* Enable 2D texturing. */ GL11.glEnable(GL11.GL_TEXTURE_2D); /* Make all models smoothly textured. */ GL11.glShadeModel(GL11.GL_SMOOTH); /* Set the background color to that signature blue. */ GL11.glClearColor(0.9f, 1.0f, 1.0f, 0.0f); /* Set the clear depth to all-the-way */ GL11.glClearDepth(1.0); /* Enable the depth system. */ GL11.glEnable(GL11.GL_DEPTH_TEST); /* Set the function for depth to GL_LEQUAL. */ GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); /* Enable face culling, basically don't render this face relative to the camera's position. */ GL11.glEnable(GL11.GL_CULL_FACE); /* Set OpenGL to cull the back face of our spatials. */ GL11.glCullFace(GL11.GL_BACK); /* Set the matrix mode to projection. */ GL11.glMatrixMode(GL11.GL_PROJECTION); /* Reset the OpenGL configuration, loading our above prefrences. */ //GL11.glLoadIdentity(); /* Set the perspective. */ GLU.gluPerspective(45.0f, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100.0f); /* Set the matrix mode to be model view. */ GL11.glMatrixMode(GL11.GL_MODELVIEW); /* Set the perspective correction hint to finest quality. */ GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); }
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;// w w w. ja v a 2 s . c om 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]);//w w w. j av a 2s. c om 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();//from w w w . ja v a2s . c o m GL11.glMatrixMode(5888 /*GL_MODELVIEW0_ARB*/); GL11.glLoadIdentity(); 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 w w w. j a v a 2s . 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.slimevoid.tmf.client.renderers.ItemRendererToolBelt.java
License:Open Source License
private void renderItem(EntityLivingBase entityliving, ItemStack itemstack, int index, TextureManager texturemanager) { GL11.glPushMatrix();/*ww w .j av a 2 s.c om*/ IIcon icon = entityliving.getItemIcon(itemstack, index); if (icon == null) { GL11.glPopMatrix(); return; } texturemanager.bindTexture(texturemanager.getResourceLocation(itemstack.getItemSpriteNumber())); Tessellator tessellator = Tessellator.instance; float f = icon.getMinU(); float f1 = icon.getMaxU(); float f2 = icon.getMinV(); float f3 = icon.getMaxV(); float f4 = 0.0F; float f5 = 0.3F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); /* * GL11.glTranslatef( -f4, -f5, 0.0F); float f6 = 1.5F; GL11.glScalef( * f6, f6, f6); GL11.glRotatef( 50.0F, 0.0F, 1.0F, 0.0F); * GL11.glRotatef( 335.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef( * -0.9375F, -0.0625F, 0.0F); */ ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); if (itemstack.hasEffect(index)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); texturemanager.bindTexture(RES_ITEM_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 = 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 = 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: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; }