本文整理汇总了Java中org.lwjgl.opengl.GL11.glColor3ub方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glColor3ub方法的具体用法?Java GL11.glColor3ub怎么用?Java GL11.glColor3ub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glColor3ub方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onWorldDraw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
protected void onWorldDraw(float delta, float x, float y, float z) {
float mx, my, mz;
if (!safeShow) return;
if (--safeUpdate < 0) {
safeUpdate = 13;
reCheckSafe(fix(x), fix(y), fix(z));
}
if (safeGhost) GL11.glDisable(GL11.GL_DEPTH_TEST);
else GL11.glEnable( GL11.GL_DEPTH_TEST);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_FOG);
GL11.glBegin(GL11.GL_LINES);
for (int i = 0; i < safeCur; ++i) {
Vec3i pos = safePoses[i];
Color color = safeMarks[i];
GL11.glColor3ub(color.rb, color.gb, color.bb);
mx = pos.getX() - x; my = pos.getY() - y; mz = pos.getZ() - z;
GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.9f);
GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.1f);
GL11.glVertex3f(mx+0.9f,my+0.01f,mz+0.1f);
GL11.glVertex3f(mx+0.1f,my+0.01f,mz+0.9f);
}
GL11.glEnd();
}
示例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);
}
示例3: renderGuiFluid
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void renderGuiFluid(FluidStack fluid, float fill, int x, int y, int width, int maxHeight)
{
if (fluid != null && fluid.getFluid() != null && fluid.amount > 0)
{
TextureAtlasSprite sprite = getStillTexture(fluid);
if (sprite != null)
{
int rendHeight = (int) Math.max(Math.min((float) maxHeight, (float) maxHeight * fill), 1.0F);
int yPos = y + maxHeight - rendHeight;
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
int fluidColor = fluid.getFluid().getColor(fluid);
GL11.glColor3ub((byte) (fluidColor >> 16 & 255), (byte) (fluidColor >> 8 & 255), (byte) (fluidColor & 255));
GlStateManager.enableBlend();
for (int i = 0; i < width; i += 16)
{
for (int j = 0; j < rendHeight; j += 16)
{
int dwt = Math.min(width - i, 16);
int dht = Math.min(rendHeight - j, 16);
int dx = x + i;
int dy = yPos + j;
double minU = (double) sprite.getMinU();
double maxU = (double) sprite.getMaxU();
double minV = (double) sprite.getMinV();
double maxV = (double) sprite.getMaxV();
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder tes = tessellator.getBuffer();
tes.begin(7, DefaultVertexFormats.POSITION_TEX);
tes.pos((double) dx, (double) (dy + dht), 0.0D).tex(minU, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) (dy + dht), 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
tes.pos((double) (dx + dwt), (double) dy, 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV).endVertex();
tes.pos((double) dx, (double) dy, 0.0D).tex(minU, minV).endVertex();
tessellator.draw();
}
}
GlStateManager.disableBlend();
}
}
}