List of usage examples for org.lwjgl.opengl GL11 glColor4ub
public static native void glColor4ub(@NativeType("GLubyte") byte red, @NativeType("GLubyte") byte green, @NativeType("GLubyte") byte blue, @NativeType("GLubyte") byte alpha);
From source file:name.martingeisse.stackd.client.gui.util.Color.java
License:Open Source License
/** * Sets this color as the current drawing color in OpenGL, * applying another external alpha value as well as the alpha value * from this color. The external alpha value too should be in the range 0..255. * /*from w w w .j a v a2 s . co m*/ * @param externalAlpha the external alpha value to apply */ public void glColorWithCombinedAlpha(int externalAlpha) { int effectiveAlpha = (alpha * externalAlpha) >> 8; GL11.glColor4ub((byte) red, (byte) green, (byte) blue, (byte) effectiveAlpha); }
From source file:net.awairo.mcmod.spawnchecker.client.marker.RenderingSupport.java
License:Minecraft Mod Public
/** * ???.//from w ww . j a v a2 s . c om * * @param r * @param g * @param b ? * @param a ? */ public static void setGLColor(int r, int g, int b, int a) { GL11.glColor4ub((byte) r, (byte) g, (byte) b, (byte) a); }
From source file:net.dries007.tfcnei.util.Helper.java
License:Open Source License
public static void drawFluidInRect(Fluid fluid, Rectangle rect) { IIcon fluidIcon = fluid.getIcon();//from ww w . j a v a 2s. co m Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture); int color = fluid.getColor(); GL11.glColor4ub((byte) ((color >> 16) & 255), (byte) ((color >> 8) & 255), (byte) (color & 255), (byte) (0xaa & 255)); gui.drawTexturedModelRectFromIcon(rect.x, rect.y, fluidIcon, rect.width, rect.height); }
From source file:net.smert.frameworkgl.opengl.helpers.LegacyRenderHelper.java
License:Apache License
public void color(byte r, byte g, byte b) { GL11.glColor4ub(r, g, b, (byte) 255); }
From source file:net.smert.frameworkgl.opengl.helpers.LegacyRenderHelper.java
License:Apache License
public void color(byte r, byte g, byte b, byte a) { GL11.glColor4ub(r, g, b, a); }
From source file:org.jogamp.glg2d.GLG2DUtils.java
License:Apache License
public static void setColor(Color c, float preMultiplyAlpha) { int rgb = c.getRGB(); GL11.glColor4ub((byte) (rgb >> 16 & 0xFF), (byte) (rgb >> 8 & 0xFF), (byte) (rgb & 0xFF), (byte) ((rgb >> 24 & 0xFF) * preMultiplyAlpha)); }
From source file:org.jogamp.glg2d.impl.gl2.GL2ColorHelper.java
License:Apache License
private void setColor(Color c, float preMultiplyAlpha) { int rgb = c.getRGB(); GL11.glColor4ub((byte) (rgb >> 16 & 0xFF), (byte) (rgb >> 8 & 0xFF), (byte) (rgb & 0xFF), (byte) ((rgb >> 24 & 0xFF) * preMultiplyAlpha)); }
From source file:tk.ivybits.engine.gl.GL.java
License:Open Source License
public static void glColor4ub(byte a, byte b, byte c, byte d) { GL11.glColor4ub(a, b, c, d); }
From source file:vazkii.botania.client.core.handler.BlockHighlightRenderHandler.java
License:Open Source License
private static void renderRectangle(AxisAlignedBB aabb, boolean inner, Color color, byte alpha) { double renderPosX, renderPosY, renderPosZ; try {/*from w ww . j a v a2 s . c om*/ renderPosX = (double) ClientMethodHandles.renderPosX_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); renderPosY = (double) ClientMethodHandles.renderPosY_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); renderPosZ = (double) ClientMethodHandles.renderPosZ_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); } catch (Throwable t) { return; } GlStateManager.pushMatrix(); GlStateManager.translate(aabb.minX - renderPosX, aabb.minY - renderPosY, aabb.minZ - renderPosZ); if (color == null) color = Color.getHSBColor(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F); GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), alpha); double f = 1F / 16F; double x = aabb.maxX - aabb.minX - f; double z = aabb.maxZ - aabb.minZ - f; Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); tessellator.getBuffer().pos(x, f, f).endVertex(); tessellator.getBuffer().pos(f, f, f).endVertex(); tessellator.getBuffer().pos(f, f, z).endVertex(); tessellator.getBuffer().pos(x, f, z).endVertex(); tessellator.draw(); if (inner) { x += f; z += f; double f1 = f + f / 4F; GL11.glColor4ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue(), (byte) (alpha * 2)); tessellator.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); tessellator.getBuffer().pos(x, f1, 0).endVertex(); tessellator.getBuffer().pos(0, f1, 0).endVertex(); tessellator.getBuffer().pos(0, f1, z).endVertex(); tessellator.getBuffer().pos(x, f1, z).endVertex(); tessellator.draw(); } GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255); GlStateManager.popMatrix(); }
From source file:vazkii.botania.client.core.handler.BlockHighlightRenderHandler.java
License:Open Source License
private static void renderCircle(BlockPos center, double radius) { double renderPosX, renderPosY, renderPosZ; try {//w ww.j a v a 2 s . c om renderPosX = (double) ClientMethodHandles.renderPosX_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); renderPosY = (double) ClientMethodHandles.renderPosY_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); renderPosZ = (double) ClientMethodHandles.renderPosZ_getter .invokeExact(Minecraft.getMinecraft().getRenderManager()); } catch (Throwable t) { return; } GlStateManager.pushMatrix(); double x = center.getX() + 0.5; double y = center.getY(); double z = center.getZ() + 0.5; GlStateManager.translate(x - renderPosX, y - renderPosY, z - renderPosZ); int color = Color.HSBtoRGB(ClientTickHandler.ticksInGame % 200 / 200F, 0.6F, 1F); Color colorRGB = new Color(color); GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 32); double f = 1F / 16F; int totalAngles = 360; int drawAngles = 360; int step = totalAngles / drawAngles; radius -= f; Tessellator tessellator = Tessellator.getInstance(); tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION); tessellator.getBuffer().pos(0, f, 0).endVertex(); for (int i = 0; i < totalAngles + 1; i += step) { double rad = (totalAngles - i) * Math.PI / 180.0; double xp = Math.cos(rad) * radius; double zp = Math.sin(rad) * radius; tessellator.getBuffer().pos(xp, f, zp).endVertex(); } tessellator.getBuffer().pos(0, f, 0).endVertex(); tessellator.draw(); radius += f; double f1 = f + f / 4F; GL11.glColor4ub((byte) colorRGB.getRed(), (byte) colorRGB.getGreen(), (byte) colorRGB.getBlue(), (byte) 64); tessellator.getBuffer().begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION); tessellator.getBuffer().pos(0, f1, 0).endVertex(); for (int i = 0; i < totalAngles + 1; i += step) { double rad = (totalAngles - i) * Math.PI / 180.0; double xp = Math.cos(rad) * radius; double zp = Math.sin(rad) * radius; tessellator.getBuffer().pos(xp, f1, zp).endVertex(); } tessellator.getBuffer().pos(0, f1, 0).endVertex(); tessellator.draw(); GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) 255); GlStateManager.popMatrix(); }