List of usage examples for org.lwjgl.opengl GL11 glShadeModel
public static native void glShadeModel(@NativeType("GLenum") int mode);
From source file:thaumic.tinkerer.client.core.helper.ClientHelper.java
License:Creative Commons License
public static void drawGradientRect(int par1, int par2, float z, int par3, int par4, int par5, int par6) { float var7 = (par5 >> 24 & 255) / 255.0F; float var8 = (par5 >> 16 & 255) / 255.0F; float var9 = (par5 >> 8 & 255) / 255.0F; float var10 = (par5 & 255) / 255.0F; float var11 = (par6 >> 24 & 255) / 255.0F; float var12 = (par6 >> 16 & 255) / 255.0F; float var13 = (par6 >> 8 & 255) / 255.0F; float var14 = (par6 & 255) / 255.0F; GL11.glDisable(GL11.GL_TEXTURE_2D);//from w w w. j a v a 2 s . c o m GL11.glEnable(GL11.GL_BLEND); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glShadeModel(GL11.GL_SMOOTH); Tessellator var15 = Tessellator.instance; var15.startDrawingQuads(); var15.setColorRGBA_F(var8, var9, var10, var7); var15.addVertex(par3, par2, z); var15.addVertex(par1, par2, z); var15.setColorRGBA_F(var12, var13, var14, var11); var15.addVertex(par1, par4, z); var15.addVertex(par3, par4, z); var15.draw(); GL11.glShadeModel(GL11.GL_FLAT); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glShadeModel(int a) { GL11.glShadeModel(a); }
From source file:tk.jacklin213.voxelgale.rendering.BasicRenderer.java
License:Apache License
private void initGL() { GL11.glEnable(GL11.GL_TEXTURE_2D);/*ww w.ja v a 2s . com*/ GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glClearColor(0, 0, 0, 0); GL11.glClearDepth(1); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glDepthFunc(GL11.GL_LEQUAL); GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); GLU.gluPerspective(45, (float) displayMode.getWidth() / (float) displayMode.getHeight(), 0.1f, 100); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); }
From source file:totemic_commons.pokefenn.client.RenderHelper.java
License:MIT License
public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) { Tessellator tessellator = Tessellator.instance; int ticks = (int) (Minecraft.getMinecraft().theWorld.getTotalWorldTime() % 200); if (ticks >= 100) ticks = 200 - ticks - 1;//from w w w. j av a 2 s . c om float f1 = ticks / 200F; float f2 = 0F; if (f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F; Random random = new Random(seed); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 1); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glTranslatef(0F, -1F, -2F); GL11.glScalef(xScale, yScale, zScale); for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F); GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F); tessellator.startDrawing(GL11.GL_TRIANGLE_FAN); float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; float f4 = random.nextFloat() * 2F + 1F + f2 * 2F; tessellator.setColorRGBA_I(color, (int) (255F * (1F - f2))); tessellator.addVertex(0, 0, 0); tessellator.setColorRGBA_F(0F, 0F, 0F, 0); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0, f3, 1F * f4); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.draw(); } GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
From source file:vazkii.botania.client.core.handler.TiaraWingRenderHandler.java
License:Creative Commons License
private void renderHalo(EntityPlayer player, float partialTicks) { float yaw = player.prevRotationYawHead + (player.rotationYawHead - player.prevRotationYawHead) * partialTicks; float yawOffset = player.prevRenderYawOffset + (player.renderYawOffset - player.prevRenderYawOffset) * partialTicks; float pitch = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * partialTicks; GL11.glPushMatrix();/* w w w .j a v a2 s. c o m*/ GL11.glRotatef(yawOffset, 0, -1, 0); GL11.glRotatef(yaw - 270, 0, 1, 0); GL11.glRotatef(pitch, 0, 0, 1); GL11.glShadeModel(GL11.GL_SMOOTH); OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 240); GL11.glDisable(GL11.GL_LIGHTING); GL11.glColor4f(1F, 1F, 1F, 1F); Minecraft.getMinecraft().renderEngine.bindTexture(textureHalo); GL11.glTranslated(0, -player.eyeHeight + (player.isSneaking() ? 0.0625 : 0), 0); GL11.glRotated(30, 1, 0, -1); GL11.glTranslatef(-0.1F, -0.5F, -0.1F); GL11.glRotatef(player.ticksExisted + partialTicks, 0, 1, 0); Tessellator tes = Tessellator.instance; tes.startDrawingQuads(); tes.addVertexWithUV(-0.5, 0, -0.5, 0, 0); tes.addVertexWithUV(-0.5, 0, 0.5, 0, 1); tes.addVertexWithUV(0.5, 0, 0.5, 1, 1); tes.addVertexWithUV(0.5, 0, -0.5, 1, 0); tes.draw(); GL11.glEnable(GL11.GL_LIGHTING); GL11.glShadeModel(GL11.GL_FLAT); GL11.glPopMatrix(); }
From source file:vazkii.b_baubles.client.core.helper.RenderHelper.java
License:Open Source License
public static void renderStar(int color, float xScale, float yScale, float zScale, long seed) { Tessellator tessellator = Tessellator.instance; int ticks = ClientTickHandler.ticksInGame % 200; if (ticks >= 100) ticks = 200 - ticks - 1;/*from w w w . j a va2 s . c o m*/ float f1 = ticks / 200F; float f2 = 0F; if (f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F; Random random = new Random(seed); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 1); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glScalef(xScale, yScale, zScale); for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F); GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F); GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F); GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0F, 0F, 1F); tessellator.startDrawing(GL11.GL_TRIANGLE_FAN); float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; float f4 = random.nextFloat() * 2F + 1F + f2 * 2F; tessellator.setColorRGBA_I(color, (int) (255F * (1F - f2))); tessellator.addVertex(0, 0, 0); tessellator.setColorRGBA_F(0F, 0F, 0F, 0); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0.866D * f4, f3, -0.5F * f4); tessellator.addVertex(0, f3, 1F * f4); tessellator.addVertex(-0.866D * f4, f3, -0.5F * f4); tessellator.draw(); } GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1F, 1F, 1F, 1F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
From source file:vazkii.recubed.client.renders.PieChartRender.java
License:Creative Commons License
public Entry renderChart(int radius, int x, int y, int mx, int my) { GL11.glPushMatrix();/*from w w w .j a va 2s. c o m*/ GL11.glDisable(GL11.GL_TEXTURE_2D); Entry tooltip = null; float tooltipDeg = 0; boolean mouseIn = (x - mx) * (x - mx) + (y - my) * (y - my) <= radius * radius; float angle = mouseAngle(x, y, mx, my); int highlight = 5; GL11.glShadeModel(GL11.GL_SMOOTH); float totalDeg = 0; for (Entry entry : entries) { boolean mouseInSector = mouseIn && angle > totalDeg && angle < totalDeg + entry.angle; Color color = new Color(entry.color).brighter(); Color color1 = ClientCacheHandler.useGradients ? new Color(entry.color).darker().darker() : color; if (mouseInSector) { tooltip = entry; tooltipDeg = totalDeg; radius += highlight; } GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) 255); GL11.glVertex2i(x, y); GL11.glColor4ub((byte) color1.getRed(), (byte) color1.getGreen(), (byte) color1.getBlue(), (byte) 255); for (float i = entry.angle; i >= 0; i -= 0.01) { float rad = (float) ((i + totalDeg) / 180F * Math.PI); GL11.glVertex2d(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius); } totalDeg += entry.angle; GL11.glColor4ub((byte) 0, (byte) 0, (byte) 0, (byte) 255); GL11.glVertex2i(x, y); GL11.glEnd(); if (mouseInSector) radius -= highlight; } GL11.glShadeModel(GL11.GL_FLAT); totalDeg = 0; GL11.glLineWidth(2F); GL11.glColor4f(0F, 0F, 0F, 1F); for (Entry entry : entries) { if (Math.round(entry.angle) == 360) break; boolean mouseInSector = mouseIn && angle > totalDeg && angle < totalDeg + entry.angle; if (mouseInSector) radius += highlight; float rad = (float) (totalDeg / 180F * Math.PI); GL11.glBegin(GL11.GL_LINES); GL11.glVertex2i(x, y); GL11.glVertex2d(x + Math.cos(rad) * radius, y + Math.sin(rad) * radius); GL11.glEnd(); if (mouseInSector) radius -= highlight; totalDeg += entry.angle; } GL11.glLineWidth(3F); GL11.glColor4f(0F, 0F, 0F, 1F); GL11.glBegin(GL11.GL_LINE_LOOP); for (float i = 0; i < 360; i++) { boolean sectorHighlighted = tooltip != null && i >= tooltipDeg && i < tooltip.angle + tooltipDeg; boolean first = tooltip != null && tooltip.angle != 360 && i - tooltipDeg == 0; boolean last = tooltip != null && tooltip.angle != 360 && i - (tooltipDeg + tooltip.angle) == -1; if (first) addVertexForAngle(x, y, i, radius); if (sectorHighlighted) radius += highlight; addVertexForAngle(x, y, i, radius); if (last) addVertexForAngle(x, y, i + 1, radius); if (sectorHighlighted) radius -= highlight; } GL11.glEnd(); if (tooltip != null) { List<String> tooltipList = new ArrayList( Arrays.asList(StatCollector.translateToLocal(tooltip.name), EnumChatFormatting.GRAY + "" + tooltip.val + " (" + Math.round(tooltip.angle / 3.6F * 100D) / 100D + "%)")); if (Minecraft.getMinecraft().gameSettings.advancedItemTooltips) tooltipList.add(EnumChatFormatting.GRAY + "" + EnumChatFormatting.ITALIC + tooltip.name); RenderHelper.renderTooltip(mx, my, tooltipList); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glPopMatrix(); return tooltip; }
From source file:vazkii.tinkerer.client.helper.RenderHelper.java
License:Creative Commons License
/** Renders a star, similar to the dragon death animation, must be * translated previously **//*w w w.ja v a2 s. c om*/ public static void renderStar(int color, float xScale, float yScale, float zScale) { Tessellator tessellator = Tessellator.instance; net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting(); int ticks = (int) (ClientTickHandler.elapsedClientTicks % 200); if (ticks >= 100) ticks = 200 - ticks - 1; float f1 = ticks / 200F; float f2 = 0.0F; if (f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F; Random random = new Random(432L); GL11.glPushMatrix(); GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(770, 1); GL11.glDisable(GL11.GL_ALPHA_TEST); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glDepthMask(false); GL11.glTranslatef(0.0F, -1F, -2F); GL11.glScalef(xScale, yScale, zScale); for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) { GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(random.nextFloat() * 360F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(random.nextFloat() * 360F + f1 * 90F, 0.0F, 0.0F, 1.0F); tessellator.startDrawing(6); float f3 = random.nextFloat() * 20F + 5F + f2 * 10F; float f4 = random.nextFloat() * 2.0F + 1.0F + f2 * 2.0F; tessellator.setColorRGBA_I(color, (int) (255F * (1.0F - f2))); tessellator.addVertex(0.0D, 0.0D, 0.0D); tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0); tessellator.addVertex(-0.86599999999999999D * f4, f3, -0.5F * f4); tessellator.addVertex(0.86599999999999999D * f4, f3, -0.5F * f4); tessellator.addVertex(0.0D, f3, 1.0F * f4); tessellator.addVertex(-0.86599999999999999D * f4, f3, -0.5F * f4); tessellator.draw(); } GL11.glDepthMask(true); GL11.glDisable(GL11.GL_CULL_FACE); GL11.glDisable(GL11.GL_BLEND); GL11.glShadeModel(GL11.GL_FLAT); GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glPopMatrix(); }
From source file:voxicity.Voxicity.java
License:Open Source License
static void init(Arguments args) { // Load the specified config file Config config = new Config(args.get_value("config", "voxicity.properties")); String mode = args.get_value("mode", "client"); if (mode.equals("server")) { // Start the server, it spawns its own thread // and takes over from here new Server(config).run(); } else if (mode.equals("client")) { try {// w w w .j a va 2 s . co m System.out.println("Intializing display"); Display.setDisplayMode(new DisplayMode(1200, 720)); Display.create(); Display.setTitle("Voxicity"); System.out.println("Display created"); } catch (LWJGLException e) { System.out.println("Unable to open Display"); e.printStackTrace(); System.exit(1); } System.out.println("Setting up OpenGL states"); GL11.glShadeModel(GL11.GL_SMOOTH); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearColor(126.0f / 255.0f, 169.0f / 255.0f, 254.0f / 255.0f, 1.0f); GL11.glEnableClientState(GL11.GL_VERTEX_ARRAY); GL11.glEnableClientState(GL11.GL_TEXTURE_COORD_ARRAY); System.out.println("Number of texture units: " + GL11.glGetInteger(GL13.GL_MAX_TEXTURE_UNITS)); System.out.println( "Number of image texture units: " + GL11.glGetInteger(GL20.GL_MAX_TEXTURE_IMAGE_UNITS)); System.out.println( "Number of vertex texture units: " + GL11.glGetInteger(GL20.GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS)); System.out.println("Number of combined vertex/image texture units: " + GL11.glGetInteger(GL20.GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS)); try { LWJGLRenderer gui_renderer = new LWJGLRenderer(); LoginGUI login_gui = new LoginGUI(); ThemeManager theme = ThemeManager.createThemeManager(Voxicity.class.getResource("/login.xml"), gui_renderer); GUI gui = new GUI(login_gui, gui_renderer); gui.applyTheme(theme); while (!login_gui.is_login_pressed()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); gui.update(); Display.update(); if (Display.isCloseRequested()) { Display.destroy(); System.exit(0); } } Socket client_s = new Socket(login_gui.get_server_name(), 11000); Client client = new Client(config, new NetworkConnection(client_s)); client.run(); System.out.println("Destroying display"); Display.destroy(); } // Catch exceptions from the game init and main game-loop catch (LWJGLException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (IOException e) { System.out.println(e); e.printStackTrace(); System.exit(1); } catch (Exception e) { System.out.println(e); e.printStackTrace(); } } else { System.out.println("Invalid mode: " + mode); } }
From source file:zildo.fwk.opengl.OpenGLGestion.java
License:Open Source License
private void initGL() { GL11.glEnable(GL11.GL_TEXTURE_2D); // Enable Texture Mapping GL11.glShadeModel(GL11.GL_SMOOTH); // Enable Smooth Shading GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // Black Background GL11.glClearDepth(1.0f); // Depth Buffer Setup GL11.glEnable(GL11.GL_DEPTH_TEST); // Enables Depth Testing GL11.glDepthFunc(GL11.GL_LEQUAL); // The Type Of Depth Testing To Do // initProjectionScene(); GL11.glEnable(GL11.GL_CULL_FACE);/*from w w w.ja v a2s . c om*/ ByteBuffer temp = ByteBuffer.allocateDirect(16); temp.order(ByteOrder.nativeOrder()); GL11.glLight(GL11.GL_LIGHT1, GL11.GL_AMBIENT, (FloatBuffer) temp.asFloatBuffer().put(lightAmbient).flip()); // Setup The Ambient // Light GL11.glLight(GL11.GL_LIGHT1, GL11.GL_DIFFUSE, (FloatBuffer) temp.asFloatBuffer().put(lightDiffuse).flip()); // Setup The Diffuse // Light GL11.glLight(GL11.GL_LIGHT1, GL11.GL_POSITION, (FloatBuffer) temp.asFloatBuffer().put(lightPosition).flip()); // Position The // Light GL11.glEnable(GL11.GL_LIGHT1); // Enable Light One // GL11.glEnable(GL11.GL_LIGHTING); Display.setVSyncEnabled(true); }