本文整理汇总了Java中org.lwjgl.opengl.GL11.glColor4ub方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glColor4ub方法的具体用法?Java GL11.glColor4ub怎么用?Java GL11.glColor4ub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glColor4ub方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderLiquid
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void renderLiquid(FluidTankInfo info, RenderInfo renderInfo, World world) {
if (info.fluid.getFluid().getBlock() != null) {
renderInfo.baseBlock = info.fluid.getFluid().getBlock();
} else {
renderInfo.baseBlock = Blocks.WATER;
}
renderInfo.texture = info.fluid.getFluid().getStill(info.fluid); //TODO 1.8 still or flowing?
FMLClientHandler.instance().getClient().getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
// Tessellator.instance.setColorOpaque_I();
int color = info.fluid.getFluid().getColor(info.fluid);
int red = color >> 16 & 255;
int green = color >> 8 & 255;
int blue = color & 255;
GL11.glColor4ub((byte) red, (byte) green, (byte) blue, (byte) 255);
RenderUtils.INSTANCE.renderBlock(renderInfo, world, 0, 0, 0, false, true);
}
示例2: onWorldDraw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
protected void onWorldDraw(float delta, float x, float y, float z) {
float sx, sy, sz, ex, ey, ez;
// change state
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_CULL_FACE);
// draw selection box sides
if (buildMark == 2) {
// calculate selection box
sx = buildSX - x - 0.1f; ex = buildEX - x + 1.1f;
sy = buildSY - y - 0.1f; ey = buildEY - y + 1.1f;
sz = buildSZ - z - 0.1f; ez = buildEZ - z + 1.1f;
// draw selection box
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glColor4ub((byte)255,(byte)64,(byte)32,(byte)32);
GuiHelper.drawQuadBox(sx,sy,sz, ex,ey,ez);
GL11.glDisable(GL11.GL_BLEND);
// draw selection box
GL11.glColor3ub((byte)32,(byte)64,(byte)255);
GuiHelper.drawLineBox(sx,sy,sz, ex,ey,ez);
}
// draw buffer box source
if (buildBuffer != null && buildBufferHere) {
sx = bufferSX -x - 0.06f; ex = bufferEX -x + 1.06f;
sy = bufferSY -y - 0.06f; ey = bufferEY -y + 1.06f;
sz = bufferSZ -z - 0.06f; ez = bufferEZ -z + 1.06f;
GL11.glColor3ub((byte)192,(byte)192,(byte)192);
GuiHelper.drawLineBox(sx,sy,sz, ex,ey,ez);
}
// draw buffer box destination
if (buildBuffer != null && buildMark > 0 && !isMultiplayer()) {
sx = buildSX -x - 0.08f; ex = buildSX + bufferWX -x + 0.08f;
sy = buildSY -y - 0.08f; ey = buildSY + bufferWY -y + 0.08f;
sz = buildSZ -z - 0.08f; ez = buildSZ + bufferWZ -z + 0.08f;
if (buildEX-buildSX+1 == bufferWX
&& buildEY-buildSY+1 == bufferWY
&& buildEZ-buildSZ+1 == bufferWZ)
GL11.glColor3ub((byte)64,(byte)255,(byte)64);
else if (buildMark == 1)
GL11.glColor3ub((byte)192,(byte)32,(byte)255);
else
GL11.glColor3ub((byte)255,(byte)64,(byte)64);
GuiHelper.drawLineBox(sx,sy,sz, ex,ey,ez);
}
// draw marker 1
if (buildMark > 0) {
sx = buildX1 -x -0.04f; ex = buildX1 -x + 1.04f;
sy = buildY1 -y -0.04f; ey = buildY1 -y + 1.04f;
sz = buildZ1 -z -0.04f; ez = buildZ1 -z + 1.04f;
GL11.glColor3ub((byte)0,(byte)255,(byte)255);
GuiHelper.drawLineBox(sx,sy,sz, ex,ey,ez);
}
// restore state
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glDepthMask(true);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}