本文整理汇总了Java中org.lwjgl.opengl.GL11.glPushMatrix方法的典型用法代码示例。如果您正苦于以下问题:Java GL11.glPushMatrix方法的具体用法?Java GL11.glPushMatrix怎么用?Java GL11.glPushMatrix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.opengl.GL11
的用法示例。
在下文中一共展示了GL11.glPushMatrix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: drawStringWithShadow_scaled
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawStringWithShadow_scaled(String str, int x, int y, int color, double scale) {
if (str == null) return;
double scaleFactor = (scale / 0.5) * 2;
GL11.glPushMatrix();
GL11.glScaled(scale, scale, scale);
boolean blend = GL11.glIsEnabled(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_BLEND);
if (scale < 1)
fontRenderer().func_78261_a(str, (int) (x * scaleFactor), (int) (y * scaleFactor), color);
else
fontRenderer().func_78261_a(str, (int) (((x / scaleFactor) * 2)), (int) (((y / scaleFactor) * 2)), color);
if (blend) GL11.glEnable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
示例2: enable
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* @see org.newdawn.slick.Graphics#enable()
*/
protected void enable() {
if (!valid) {
throw new RuntimeException("Attempt to use a destroy()ed offscreen graphics context.");
}
SlickCallable.enterSafeBlock();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
GL11.glPushClientAttrib(GL11.GL_ALL_CLIENT_ATTRIB_BITS);
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix();
bind();
initGL();
}
示例3: renderDrone
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderDrone(EntityDroneBase drone, double x, double y, double z, float yaw, float partialTicks) {
if (drone.getHealth() <= 0) return;
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y, (float) z);
GL11.glPushMatrix();
GL11.glTranslatef(0, 0.76F, 0);
GL11.glScalef(0.5F, -0.5F, -0.5F);
bindEntityTexture(drone);
mainModel.setLivingAnimations(drone, 0, 0, partialTicks);
mainModel.render(drone, 0, 0, 0, 0, partialTicks, 1 / 16F);
GL11.glPopMatrix();
drone.renderExtras(x, y, z, partialTicks);
GL11.glPopMatrix();
}
示例4: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(Entity entity)
{
GL11.glPushMatrix();
move();
//Actually render all the bend parts.
for (int i = 0; i < bendSplit; i++)
{
BendPart part = bendParts.get(i);
boolean mainHighlight = false;
boolean otherHighlight = false;
if (parent.modelObj instanceof ModelObj_Animator)
{
ModelObj_Animator parentModel = (ModelObj_Animator) parent.modelObj;
ModelObj_Animator childModel = (ModelObj_Animator) child.modelObj;
mainHighlight = i < bendSplit / 2 ? parentModel.isMainHighlight(parent) : childModel.isMainHighlight(child);
otherHighlight = i < bendSplit / 2 ? parentModel.isPartHighlighted(parent) : childModel.isPartHighlighted(child);
}
part.updateTextureCoordinates(entity, mainHighlight, otherHighlight, parent.modelObj);
part.render();
}
GL11.glPopMatrix();
}
示例5: drawLine
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawLine(double x, double y, double x2, double y2, float red, float green, float blue, float lineWidth) {
int count = FMLClientHandler.instance().getClient().player.ticksExisted;
float alpha = 0.3F + MathHelper.sin((float) (count + x)) * 0.3F + 0.3F;
Tessellator tess = Tessellator.getInstance();
VertexBuffer buff = tess.getBuffer();
GL11.glPushMatrix();
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS | GL11.GL_LIGHTING_BIT);
GL11.glLineWidth(lineWidth);
GL11.glDisable(GL_TEXTURE_2D);
GL11.glBlendFunc(770, 1);
buff.begin(3, DefaultVertexFormats.POSITION_COLOR);
buff.pos(x, y, 0).color(red, green, blue, alpha).endVertex();
buff.pos(x2, y2, 0).color(red, green, blue, alpha).endVertex();
tess.draw();
GL11.glBlendFunc(770, 771);
GL11.glDisable(32826);
GL11.glEnable(GL_TEXTURE_2D);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopAttrib();
GL11.glPopMatrix();
}
示例6: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public final void render(float alpha)
{
GL11.glPushMatrix();
GL11.glTranslatef(pos.x, pos.y, 0.0f);
GL11.glLineWidth(1.0f);
float color = Main.instance().getFocus() == this ? 0.75f : 1.0f;
GL11.glColor4f(color, color, 1.0f, alpha*0.5f);
GL11.glBegin(GL11.GL_LINE_LOOP);
for (float t = 0.0f; t < T_END; t += DT)
{
Vec2 p = Util.squareDir(t).normalize().mult(radius);
GL11.glVertex2f(p.x, p.y);
}
GL11.glEnd();
GL11.glColor4f(color, color, 1.0f, alpha);
renderSymbol();
GL11.glPopMatrix();
}
示例7: drawRect
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void drawRect(float paramXStart, float paramYStart, float paramXEnd, float paramYEnd, int paramColor)
{
float alpha = (float)(paramColor >> 24 & 0xFF) / 255F;
float red = (float)(paramColor >> 16 & 0xFF) / 255F;
float green = (float)(paramColor >> 8 & 0xFF) / 255F;
float blue = (float)(paramColor & 0xFF) / 255F;
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_LINE_SMOOTH);
GL11.glColor4f(red, green, blue, alpha);
GL11.glBegin(GL11.GL_QUADS);
GL11.glVertex2d(paramXEnd, paramYStart);
GL11.glVertex2d(paramXStart, paramYStart);
GL11.glVertex2d(paramXStart, paramYEnd);
GL11.glVertex2d(paramXEnd, paramYEnd);
GL11.glEnd();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LINE_SMOOTH);
GL11.glPopMatrix();
}
示例8: processRay
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void processRay()
{
if(selectedPart != null && selectedPart instanceof PartRotation)
{
if(!rotationWheelDrag)
{
updateWheelMouseOver();
if(!rotationWheelMouseOver)
super.processRay();
}
else
processRotation();
GL11.glPushMatrix();
applyRotationTransform();
drawRotationWheel();
GL11.glPopMatrix();
}
else
super.processRay();
}
示例9: render
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void render(float alpha)
{
Vec2 pos = getPos();
Vec2 radius = getRadius();
GL11.glPushMatrix();
GL11.glTranslatef(pos.x, pos.y, 0.0f);
GL11.glScalef(radius.x, radius.y, 1.0f);
GL11.glLineWidth(1.0f);
float color = Main.instance().getFocus() == this ? 0.75f : 1.0f;
GL11.glColor4f(color, color, 1.0f, alpha);
GL11.glBegin(GL11.GL_LINE_LOOP);
GL11.glVertex2f(-1.0f, -1.0f);
GL11.glVertex2f(-1.0f, 1.0f);
GL11.glVertex2f(1.0f, 1.0f);
GL11.glVertex2f(1.0f, -1.0f);
GL11.glEnd();
symbol.run();
GL11.glPopMatrix();
}
示例10: draw
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public void draw(int x, int y) {
GL11.glPushMatrix();
GL11.glPushAttrib(8256);
int toAdd = 0;
if(dragging) {
drag(x, y);
}
RenderUtils.drawBorderedRect(getXAndDrag(), getYAndDrag(), getXAndDrag() + 100, getYAndDrag() + 13 + (isOpen ? (12 * buttonList.size() + 0.5F) + (19 * sliderList.size() + (sliderList.size() != 0 ? 2.5F : 0)) : 0) + toAdd, 0.5F, 0xFF000000, 0x80000000);
Fonts.roboto18.drawStringWithShadow(title, getXAndDrag() + 3, getYAndDrag() + 1, 0xFFFFFF);
if(Wrapper.getMinecraft().currentScreen instanceof XdolfGuiClick) {
RenderUtils.drawBorderedRect(getXAndDrag() + 79, getYAndDrag() + 2, getXAndDrag() + 88, getYAndDrag() + 11, 0.5F, 0xFF000000, isPinned ? 0xFFFF0000 : 0xFF383b42);
RenderUtils.drawBorderedRect(getXAndDrag() + 89, getYAndDrag() + 2, getXAndDrag() + 98, getYAndDrag() + 11, 0.5F, 0xFF000000, isOpen ? 0xFFFF0000 : 0xFF383b42);
}
if(isOpen) {
for(XdolfButton b : buttonList) {
b.draw();
if(x >= b.getX() + dragX && y >= b.getY() + dragY && x <= b.getX() + 96 + dragX && y <= b.getY() + 11 + dragY) {
b.overButton = true;
} else {
b.overButton = false;
}
}
for(XdolfSlider s : sliderList) {
s.draw(x);
}
}
//GL11.glEnable(GL11.GL_BLEND);
GL11.glPopMatrix();
GL11.glPopAttrib();
}
示例11: drawRailEndCaps
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
* Draws the end caps of rails.
*
* @param texPoint - Position to render the caps at.
* @param vertices - Rail shape vertices, as returned by {@link openflextrack.api.IRailType#getRailVertices() getRailVertices()}.
* @param texScale - {@link openflextrack.api.IRailType#getTextureScale() Texture scale} of the rail segment.
* @param holographic - {@code true} if the track is a hologram.
*/
private static void drawRailEndCaps(float[] texPoint, Vec3f[][] vertices, float texScale, boolean holographic) {
/* Backup face mode. */
final int glFaceMode = GL11.glGetInteger(GL11.GL_FRONT_FACE);
for (byte b = 1; b > -2; b-=2)
{
GL11.glPushMatrix();
GL11.glScalef(texPoint[4], 1.0F, texPoint[3]);
/* If we're rendering the second cap, invert front face mode and scale.
* This will mirror the cap without the need to render vertices in different order. */
if (b == -1) {
GL11.glScalef(-1, 1, -1);
if (glFaceMode == GL11.GL_CCW) {
GL11.glFrontFace(GL11.GL_CW);
}
else {
GL11.glFrontFace(GL11.GL_CCW);
}
}
/* Actually render face. */
GL11.glBegin(GL11.GL_QUADS);
{
if (!holographic) {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, texPoint[6]%65536, texPoint[6]/65536);
}
for (Vec3f[] verts : vertices)
{
/* The fourth vertex (index 3; bottom left of texture)
* defines x offset and minumum y value,
* and is the first point of the rectangle. */
final float xOff = (verts[3].x-verts[0].x);
final float yMin = verts[3].z;
GL11.glTexCoord2d(0.0F, yMin + (verts[0].y-verts[3].y)*texScale);
GL11.glVertex3d(verts[3].x, verts[3].y, verts[3].x);
GL11.glTexCoord2d((verts[3].x-verts[2].x), yMin - (verts[3].y-verts[2].y)*texScale + (verts[1].y-verts[2].y)*texScale);
GL11.glVertex3d(verts[2].x, verts[2].y, verts[2].x);
GL11.glTexCoord2d(xOff + (verts[0].x-verts[1].x), yMin + (verts[0].y-verts[1].y)*texScale);
GL11.glVertex3d(verts[1].x, verts[1].y, verts[1].x);
GL11.glTexCoord2d(xOff, yMin);
GL11.glVertex3d(verts[0].x, verts[0].y, verts[0].x);
}
}
GL11.glEnd();
GL11.glPopMatrix();
}
/* Reset face mode. */
GL11.glFrontFace(glFaceMode);
}
示例12: pushMatrix
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
public static void pushMatrix()
{
GL11.glPushMatrix();
}
示例13: pingDrawGUIHandle
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
/**
Called on world draw
note: used to be pingDrawGUIHandle()
*/
static void guiDraw(float delta) {
if (!initialized) return;
// show options
checkConfigMenu();
if (!isInMenu() && !wasInConfigMenu && wasKeyPressedThisFrame(keyShowOptions)) {
openConfigMenu();
}
wasInConfigMenu = isConfigMenuOpened();
// text overlay
if (!isHideGUI() && !isInOptions()) {
// set state
GL11.glMatrixMode(GL11.GL_PROJECTION);
GL11.glPushMatrix(); GL11.glLoadIdentity();
GuiHelper.setOrtho();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glPushMatrix(); GL11.glLoadIdentity();
GL11.glTranslatef(0.0F, 0.0F, -2000F);
GL11.glDisable(GL11.GL_LIGHTING);
// draw messages
if (!isShowDebug() && (!isInMenu()
|| getMenu() instanceof GuiContainer
|| getMenu() instanceof GuiChat)) {
setMessage("tags", getTags());
printMessages(messagesTL, 2, 2);
printMessages(messagesTR,-2, 2);
printMessages(messagesBL, 2,-2);
printMessages(messagesBR,-2,-2);
/*
printMessage("tags", 2,2);
printMessage("view", 2,14);
printMessage("info", 2,26);
printMessage("error", 2,38);
printMessage("radar",-2,2);
*/
}
// notify mods
if (!isInMenu() || getMenu() instanceof GuiChat || getMenu() instanceof GuiContainer)
for (ZMod mod : zombesMods)
try {
mod.notifyGUIDraw(delta);
} catch (Exception e) {
err("in mod \""+mod.getName()+"\": gui draw failed", e);
}
// restore state
GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glPopMatrix();
GL11.glMatrixMode(GL11.GL_MODELVIEW);
}
// modLoader compatibility
if (!ML_loaded) try {
ML_loaded = true;
ML_OnTick = Class.forName("ModLoader").getDeclaredMethod("onTick", new Class[]{ Float.TYPE, Minecraft.class }); // ModLoader.OnTick(tick, game);
} catch(Exception whatever) { ML_OnTick = null; }
if (ML_OnTick != null) getResult(ML_OnTick, null, delta, getMinecraft());
}
示例14: renderTag
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
private void renderTag(Entity entity, double x, double y, double z) {
String name = entity.getName();
if(Wrapper.getFriends().isFriend(name)) {
name = "\2479" + name;
}
if (entity instanceof EntityLivingBase) {
name = name + " \247a" + ((double)Math.round((((EntityLivingBase) entity).getHealth() * 100) / 100) / 2);
}
for(Friend friend: Wrapper.getFriends().friendsList) {
name.replace(friend.getName(), friend.getAlias());
}
float var13 = 1.6F;
float var14 = (float) (0.016666668F * (Wrapper.getPlayer().getDistanceToEntity(entity)) / 2);
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + entity.height + 0.5F, (float) z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(-RenderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(RenderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(-var14, -var14, var14);
GL11.glDepthMask(false);
GL11.glDisable(GL11.GL_LIGHTING);
Tessellator var15 = Tessellator.getInstance();
VertexBuffer vertexbuffer = var15.getBuffer();
int var16 = (int) -Wrapper.getPlayer().getDistanceToEntity(entity) / (int) var13;
if (entity.isSneaking()) {
var16 += 4;
} else if (var16 < -14) {
var16 = -14;
}
GL11.glDisable(GL11.GL_TEXTURE_2D);
int var17 = Fonts.roboto18.getStringWidth(name) / 2;
RenderUtils.drawBorderedRect(-var17 - 2, var16, var17 + 2, 11 + var16, 0.5F, 0xFF000000, 0x80000000);
Fonts.roboto18.drawStringWithShadow(name, -var17, var16, 0xFFFFFF);
Wrapper.getMinecraft().entityRenderer.disableLightmap();
GL11.glLineWidth(1.0F);
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthMask(true);
GL11.glPopMatrix();
}
示例15: doRender
import org.lwjgl.opengl.GL11; //导入方法依赖的package包/类
@Override
public void doRender(EntityBall entity, double x, double y, double z, float yaw, float partialTick) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x, (float) y + entity.height / 2, (float) z);
GL11.glColor4f(0.7F, 0.7F, 0.7F, 1F);
GL11.glRotatef(entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTick - 90.0F,
0.0F, 1.0F, 0.0F);
GL11.glRotatef(entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTick, 0.0F,
0.0F, 1.0F);
bindEntityTexture(entity);
// GL11.glTranslatef((float)entity.posX, (float)entity.posY,
// entity.posZ);
if (entity.getCritical() == 2) {
// GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
// GL11.glColor4f(0.0F, 0.0F, 1.0F, 1F);
model.render(entity, 0F, 0F, 0.0F, 0.0F, 0.0F, 0.0625F);
// GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
// GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
} else
model.render(entity, 0F, 0F, 0.0F, 0.0F, 0.0F, 0.0625F);
/*
* GL11.glScalef(1.5f, 1.5f, 1.5f); GL11.glEnable(GL11.GL_BLEND);
* //GL11.glDisable(GL11.GL_ALPHA_TEST); OpenGlHelper.glBlendFunc(770,
* 771, 1, 0);
*
* char c0 = 61680; int j = c0 % 65536; int k = c0 / 65536;
* OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit,
* (float)j / 1.0F, (float)k / 1.0F);
*
* model.render(entity, 0F, 0F, 0.0F, 0.0F, 0.0F, 0.0625F);
* GL11.glDisable(GL11.GL_BLEND); // GL11.glEnable(GL11.GL_ALPHA_TEST);
*/
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glPopMatrix();
/*
* IIcon iicon = TF2EventBusListener.pelletIcon;
*
* if (iicon != null) { GL11.glPushMatrix();
* GL11.glTranslatef((float)x,(float) y,(float) z);
* GL11.glEnable(GL12.GL_RESCALE_NORMAL); GL11.glScalef(0.5F, 0.5F,
* 0.5F); this.bindTexture(TextureMap.locationItemsTexture); Tessellator
* tessellator = Tessellator.instance;
*
* float f = iicon.getMinU(); float f1 = iicon.getMaxU(); float f2 =
* iicon.getMinV(); float f3 = iicon.getMaxV(); float f4 = 1.0F; float
* f5 = 0.5F; float f6 = 0.25F; GL11.glRotatef(180.0F -
* this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
* GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
* tessellator.startDrawingQuads(); tessellator.setNormal(0.0F, 1.0F,
* 0.0F); tessellator.addVertexWithUV((double)(0.0F - f5), (double)(0.0F
* - f6), 0.0D, (double)f, (double)f3);
* tessellator.addVertexWithUV((double)(f4 - f5), (double)(0.0F - f6),
* 0.0D, (double)f1, (double)f3);
* tessellator.addVertexWithUV((double)(f4 - f5), (double)(f4 - f6),
* 0.0D, (double)f1, (double)f2);
* tessellator.addVertexWithUV((double)(0.0F - f5), (double)(f4 - f6),
* 0.0D, (double)f, (double)f2); tessellator.draw();
* GL11.glDisable(GL12.GL_RESCALE_NORMAL); GL11.glPopMatrix();
*
* }
*/
}