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:lyonlancer5.pfsteel.client.render.entity.RenderSnowCreeper.java
License:Open Source License
/** * Queries whether should render the specified pass or not. *///w ww. j a va2s . 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: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();/*from ww w.ja v a 2 s . com*/ GL11.glOrtho(0, size, size, 0, -10, 10); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); 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]); }
From source file:matteroverdrive.client.render.entity.EntityRendererRougeAndroid.java
License:Open Source License
@Override public void doRender(EntityLivingBase p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { if (hologram) { GL11.glPushMatrix();//from www. jav a 2 s . c o m GL11.glDisable(GL11.GL_CULL_FACE); this.mainModel.onGround = this.renderSwingProgress(p_76986_1_, p_76986_9_); if (this.renderPassModel != null) { this.renderPassModel.onGround = this.mainModel.onGround; } this.mainModel.isRiding = p_76986_1_.isRiding(); if (this.renderPassModel != null) { this.renderPassModel.isRiding = this.mainModel.isRiding; } this.mainModel.isChild = p_76986_1_.isChild(); if (this.renderPassModel != null) { this.renderPassModel.isChild = this.mainModel.isChild; } this.renderLivingAt(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_); try { float f2 = 0; float f3 = 0; float f4; f4 = this.handleRotationFloat(p_76986_1_, p_76986_9_); this.rotateCorpse(p_76986_1_, f4, f2, p_76986_9_); float f5 = 0.0625F; GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(-1.0F, -1.0F, 1.0F); this.preRenderCallback(p_76986_1_, p_76986_9_); GL11.glTranslatef(0.0F, -24.0F * f5 - 0.0078125F, 0.0F); float f6 = p_76986_1_.prevLimbSwingAmount + (p_76986_1_.limbSwingAmount - p_76986_1_.prevLimbSwingAmount) * p_76986_9_; float f7 = p_76986_1_.limbSwing - p_76986_1_.limbSwingAmount * (1.0F - p_76986_9_); if (p_76986_1_.isChild()) { f7 *= 3.0F; } if (f6 > 1.0F) { f6 = 1.0F; } GL11.glEnable(GL11.GL_ALPHA_TEST); this.mainModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_); this.renderModel(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); int j; float f8; float f9; float f10; for (int i = 0; i < 4; ++i) { j = this.shouldRenderPass(p_76986_1_, i, p_76986_9_); if (j > 0) { this.renderPassModel.setLivingAnimations(p_76986_1_, f7, f6, p_76986_9_); this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); if ((j & 240) == 16) { this.func_82408_c(p_76986_1_, i, p_76986_9_); this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); } if ((j & 15) == 15) { f8 = (float) p_76986_1_.ticksExisted + p_76986_9_; //this.bindTexture(RES_ITEM_GLINT); GL11.glEnable(GL11.GL_BLEND); f9 = 0.5F; GL11.glColor4f(f9, f9, f9, 1.0F); GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDepthMask(false); for (int k = 0; k < 2; ++k) { GL11.glDisable(GL11.GL_LIGHTING); f10 = 0.76F; GL11.glColor4f(0.5F * f10, 0.25F * f10, 0.8F * f10, 1.0F); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glLoadIdentity(); float f11 = f8 * (0.001F + (float) k * 0.003F) * 20.0F; float f12 = 0.33333334F; GL11.glScalef(f12, f12, f12); GL11.glRotatef(30.0F - (float) k * 60.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.0F, f11, 0.0F); GL11.glMatrixMode(GL11.GL_MODELVIEW); this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); } GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glDepthMask(true); GL11.glLoadIdentity(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDisable(GL11.GL_BLEND); GL11.glDepthFunc(GL11.GL_LEQUAL); } GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); } } GL11.glDepthMask(true); this.renderEquippedItems(p_76986_1_, p_76986_9_); float f14 = p_76986_1_.getBrightness(p_76986_9_); j = this.getColorMultiplier(p_76986_1_, f14, p_76986_9_); OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glDisable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); if ((j >> 24 & 255) > 0 || p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) { GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glDepthFunc(GL11.GL_EQUAL); if (p_76986_1_.hurtTime > 0 || p_76986_1_.deathTime > 0) { GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F); this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); for (int l = 0; l < 4; ++l) { if (this.inheritRenderPass(p_76986_1_, l, p_76986_9_) >= 0) { GL11.glColor4f(f14, 0.0F, 0.0F, 0.4F); this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); } } } if ((j >> 24 & 255) > 0) { f8 = (float) (j >> 16 & 255) / 255.0F; f9 = (float) (j >> 8 & 255) / 255.0F; float f15 = (float) (j & 255) / 255.0F; f10 = (float) (j >> 24 & 255) / 255.0F; GL11.glColor4f(f8, f9, f15, f10); this.mainModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); for (int i1 = 0; i1 < 4; ++i1) { if (this.inheritRenderPass(p_76986_1_, i1, p_76986_9_) >= 0) { GL11.glColor4f(f8, f9, f15, f10); this.renderPassModel.render(p_76986_1_, f7, f6, f4, f3 - f2, p_76986_1_.rotationPitch, f5); } } } GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); } GL11.glDisable(GL12.GL_RESCALE_NORMAL); } catch (Exception exception) { } OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit); GL11.glEnable(GL11.GL_TEXTURE_2D); OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glPopMatrix(); this.passSpecialRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_); } else { super.doRender(p_76986_1_, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_); } }
From source file:matteroverdrive.gui.GuiStarMap.java
License:Open Source License
public void drawWorldBackground(int p_146270_1_) { glDisable(GL_TEXTURE_2D);//ww w . j a v a 2 s. c o m glColor3f(0, 0, 0); RenderUtils.drawPlane(0, 0, -1000, width, height); glEnable(GL_TEXTURE_2D); glPushMatrix(); //GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); //GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT); glPushAttrib(GL_COLOR_BUFFER_BIT); glEnable(GL_BLEND); glBlendFunc(GL_ONE, GL_ONE); GL11.glMatrixMode(GL11.GL_PROJECTION); glPushMatrix(); GL11.glLoadIdentity(); Project.gluPerspective(75f, (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05f, 20); //RenderUtil.loadMatrix(camera.getTransposeProjectionMatrix()); GL11.glMatrixMode(GL11.GL_MODELVIEW); glPushMatrix(); GL11.glLoadIdentity(); //RenderUtil.loadMatrix(camera.getTransposeViewMatrix()); glRotated(15, 1, 0, 0); GL11.glTranslatef(0, -0.8f, 0); float lastRotationYaw = Minecraft.getMinecraft().renderViewEntity.rotationYaw; float lastRotationPitch = Minecraft.getMinecraft().renderViewEntity.rotationPitch; float rotation = 0; if (machine.getZoomLevel() <= 2) { rotation = mc.theWorld.getWorldTime() * 0.1f; } Minecraft.getMinecraft().renderViewEntity.rotationYaw = 180 + rotation; Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft .getMinecraft().renderViewEntity.rotationPitch = 15; //bindTexture(ClientProxy.renderHandler.getRendererOmniTool().getWeaponTexture()); //ClientProxy.renderHandler.getRendererOmniTool().getModel().renderAll(); switch (machine.getZoomLevel()) { case 0: glTranslated(0, -1.1, -4f); break; case 1: glTranslated(0, -0.6, -4f); break; case 2: Star star = machine.getStar(); float maxDistance = 0; if (star != null) { for (Planet planet : star.getPlanets()) { if (maxDistance < planet.getOrbit()) { maxDistance = planet.getOrbit(); } } } glTranslated(0, 0, -maxDistance * 3 - 1.5f); break; default: GL11.glTranslatef(0, 0.1f, -3f); break; } glRotated(rotation, 0, 1, 0); //glTranslated(0.5f,2.5f,3); ClientProxy.renderHandler.getTileEntityRendererStarMap().render(machine, -0.5f, -1.8f, -0.5f, 0); glPopMatrix(); //fontRendererObj.drawString("Test",100,100,0xffffff); GL11.glMatrixMode(GL11.GL_PROJECTION); glPopMatrix(); GL11.glMatrixMode(GL11.GL_MODELVIEW); glPopMatrix(); Minecraft.getMinecraft().renderViewEntity.rotationYaw = lastRotationYaw; Minecraft.getMinecraft().renderViewEntity.prevRotationPitch = Minecraft .getMinecraft().renderViewEntity.rotationPitch = lastRotationPitch; GL11.glPopAttrib(); }
From source file:mcp.mobius.waila.gui.truetyper.FontHelper.java
License:Open Source License
private static void set2DMode(FloatBuffer matrixData) { Minecraft mc = Minecraft.getMinecraft(); ScaledResolution sr = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight); mc.entityRenderer.setupOverlayRendering(); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPushMatrix();//from w w w. j av a 2s .c o m //GL11.glLoadMatrix(matrixData); GL11.glLoadIdentity(); GL11.glOrtho(0, mc.displayWidth, 0, mc.displayHeight, -1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glPushMatrix(); GL11.glLoadIdentity(); Matrix4f matrix = new Matrix4f(); matrix.load(matrixData); GL11.glTranslatef(matrix.m30 * sr.getScaleFactor(), -matrix.m31 * sr.getScaleFactor(), 0f); }
From source file:modeledit.ModelView3D.java
License:Open Source License
private void glInit() { try {/*from ww w . jav a2s .com*/ this.makeCurrent(); } catch (Exception e) { return; // e.printStackTrace(); } GL11.glClearColor(0.0f, 0.0f, 0.0f, 1.0f); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(40, ((float) this.getWidth()) / ((float) this.getHeight()), 1, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glShadeModel(GL11.GL_SMOOTH); // GL11.glPolygonMode(GL11.GL_FRONT,GL11.GL_LINE); // GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping GL11.glLight(GL11.GL_LIGHT0, GL11.GL_DIFFUSE, get(whiteLight)); GL11.glLight(GL11.GL_LIGHT0, GL11.GL_SPECULAR, get(whiteLight)); GL11.glLightModel(GL11.GL_LIGHT_MODEL_AMBIENT, get(ambientLight)); GL11.glEnable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_LIGHT0); GLUtils.glLightPos(1.0f, 1.0f, 1.0f); // 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); }
From source file:modeledit.ModelView3D.java
License:Open Source License
public void draw() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity();//from w w w . j a v a2 s . c om GL11.glMatrixMode(GL11.GL_VIEWPORT); GL11.glViewport(0, 0, getWidth(), getHeight()); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(40, ((float) this.getWidth()) / ((float) this.getHeight()), 1, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glTranslatef(panX, panY, 0); //(float)(camDist*Math.sin(camTheta)*Math.cos(camPhi)) GLU.gluLookAt((float) (camDist * Math.sin(camTheta) * Math.sin(camPhi)), (float) (camDist * Math.cos(camTheta) * Math.sin(camPhi)), (float) (camDist * Math.cos(camPhi)), 0, 0, 0, 0, 0, 1); if (model != null) { model.draw(state); } }
From source file:mods.railcraft.client.render.RenderTankCartItem.java
License:Open Source License
private void renderIn3D(ItemStack stack) { GL11.glPushMatrix();//from www . ja va 2 s . com Tessellator tessellator = Tessellator.instance; int meta = stack.getItemDamage(); for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) { IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass); if (icon == null) continue; int color = stack.getItem().getColorFromItemStack(stack, pass); float c1 = (float) (color >> 16 & 255) / 255.0F; float c2 = (float) (color >> 8 & 255) / 255.0F; float c3 = (float) (color & 255) / 255.0F; if (renderItem.renderWithColor) GL11.glColor4f(c1, c2, c3, 1.0F); float minU = icon.getMinU(); float maxU = icon.getMaxU(); float minV = icon.getMinV(); float maxV = icon.getMaxV(); if (stack.getItemSpriteNumber() == 0) RenderManager.instance.renderEngine.bindTexture(BLOCK_TEXTURE); else RenderManager.instance.renderEngine.bindTexture(ITEM_TEXTURE); ItemRenderer.renderItemIn2D(tessellator, maxU, minV, minU, maxV, icon.getIconWidth(), icon.getIconHeight(), RenderTools.PIXEL); if (stack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL); GL11.glDisable(GL11.GL_LIGHTING); RenderManager.instance.renderEngine.bindTexture(GLINT_TEXTURE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE); float f13 = 0.76F; GL11.glColor4f(0.5F * f13, 0.25F * f13, 0.8F * f13, 1.0F); GL11.glMatrixMode(GL11.GL_TEXTURE); GL11.glPushMatrix(); float f14 = 0.125F; GL11.glScalef(f14, f14, f14); float f15 = (float) (Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F; GL11.glTranslatef(f15, 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, 255, 255, RenderTools.PIXEL); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glScalef(f14, f14, f14); f15 = (float) (Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F; GL11.glTranslatef(-f15, 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, 255, 255, RenderTools.PIXEL); 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:mss.View.java
License:Open Source License
private void initOpenGL() { GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadMatrix(this.buffer); GL11.glOrtho(-100, 100, -100, 100, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glEnable(GL11.GL_BLEND);//www . j a va2 s. c o m GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); }