List of usage examples for org.lwjgl.opengl GL11 glScalef
public static native void glScalef(@NativeType("GLfloat") float x, @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);
From source file:illarion.graphics.lwjgl.render.TextureRenderPointer.java
License:Open Source License
/** * Draw a texture using buffer pointers and draw arrays. * /*from w w w . jav a 2s. c o m*/ * @param x the x coordinate of the texture * @param y the y coordinate of the texture * @param z the z coordinate (so the layer) of the texture * @param width the width of the area the texture shall be rendered on * @param height the height of the area the texture shall be rendered on * @param texture the texture that shall be drawn * @param color the color that is supposed to be used with that texture * @param mirror mirror the texture horizontal * @param rotation the value the texture is rotated by */ @Override public void drawTexture(final float x, final float y, final float z, final float width, final float height, final TextureLWJGL texture, final SpriteColor color, final boolean mirror, final float rotation) { DriverSettingsLWJGL.getInstance().enableTexturePointer(texture.getTextureID()); color.setActiveColor(); GL11.glPushMatrix(); int xmod = 1; if (mirror) { xmod = -1; GL11.glTranslatef(x + width, y, z); } else { GL11.glTranslatef(x, y, z); } GL11.glScalef(width * xmod, height, 1.f); GL11.glTranslatef(0.5f, 0.5f, 0); if (rotation != 0.f) { GL11.glRotatef(rotation, 0, 0, 1); } textureBuffer.rewind(); textureBuffer.put(texture.getRelX1()).put(texture.getRelY2()); textureBuffer.put(texture.getRelX1()).put(texture.getRelY1()); textureBuffer.put(texture.getRelX2()).put(texture.getRelY2()); textureBuffer.put(texture.getRelX2()).put(texture.getRelY1()); textureBuffer.flip(); GL11.glTexCoordPointer(2, 0, textureBuffer); GL11.glVertexPointer(2, 0, vertexBuffer); GL11.glDrawArrays(GL11.GL_TRIANGLE_STRIP, 0, 4); GL11.glPopMatrix(); }
From source file:illarion.graphics.lwjgl.RenderDisplayLWJGL.java
License:Open Source License
@Override public void applyScaling(final float scale) { GL11.glPushMatrix();/* w w w . j a v a 2s .c om*/ if (!areaLimits.isEmpty()) { final Rectangle lastRect = areaLimits.getLast(); if (scale > 1.f) { GL11.glTranslatef(-lastRect.getWidth() / scale, -lastRect.getHeight() / scale, 0); } else { GL11.glTranslatef(lastRect.getWidth() * scale, lastRect.getHeight() * scale, 0); } } GL11.glScalef(scale, scale, 1.f); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Button widget) { GL11.glPushMatrix();/*from w w w. ja v a 2 s.c o m*/ String translatedText = translator.getMessage(widget.getText()); GL11.glTranslatef(widget.getX() + widget.getWidth() / 2.0f, widget.getY() + widget.getHeight() / 2.0f + font.getHeight(translatedText) / 2.0f, 0.0f); GL11.glScalef(1, -1, 1); drawString(widget, translatedText, LwjglNuitFont.Align.CENTER); GL11.glPopMatrix(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(ControlsConfigurator.ControlConfigurator widget) { String text = widget.getText(); if (null != text) { GL11.glPushMatrix();/*from w ww . j a va 2 s . c om*/ GL11.glTranslatef(widget.getX() + widget.getWidth() / 2.0f, widget.getY() + widget.getHeight() / 2.0f + font.getHeight(text) / 2.0f, 0.0f); GL11.glScalef(1, -1, 1); drawString(widget, text, LwjglNuitFont.Align.CENTER); GL11.glPopMatrix(); } }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Label widget) { GL11.glPushMatrix();//from w w w . jav a 2 s . co m String translatedText = translator.getMessage(widget.getText()); GL11.glTranslatef(widget.getX() + widget.getWidth() / 2.0f, widget.getY() + widget.getHeight() / 2.0f + font.getHeight(translatedText) / 2.0f, 0.0f); GL11.glScalef(1, -1, 1); drawString(widget, translatedText, LwjglNuitFont.Align.CENTER); GL11.glPopMatrix(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Select widget) { GL11.glPushMatrix();/* w ww . j a va 2s. co m*/ String text = widget.getValuePrefix() + String.valueOf(widget.getSelected()) + widget.getValueSuffix(); GL11.glTranslatef(widget.getX() + widget.getWidth() / 2.0f, widget.getY() + widget.getHeight() / 2.0f + font.getHeight(text) / 2.0f, 0.0f); GL11.glScalef(1, -1, 1); drawString(widget, text, LwjglNuitFont.Align.CENTER); GL11.glPopMatrix(); }
From source file:im.bci.jnuit.lwjgl.LwjglNuitRenderer.java
License:Open Source License
@Override public void visit(Toggle widget) { GL11.glPushMatrix();//www. j a v a2 s .c o m String text = widget.getText(); GL11.glTranslatef(widget.getX() + widget.getWidth() / 2.0f, widget.getY() + widget.getHeight() / 2.0f + font.getHeight(text) / 2.0f, 0.0f); GL11.glScalef(1, -1, 1); drawString(widget, text, LwjglNuitFont.Align.CENTER); GL11.glPopMatrix(); }
From source file:io.cyb3rwarri0r8.commumod.client.renderer.ModularPickaxeItemRenderer.java
License:Open Source License
/** * Called to do the actual rendering, see ItemRenderType for details on when specific * types are run, and what extra data is passed into the data parameter. * * @param type The render type/*from w w w .j a v a2 s.c o m*/ * @param item The ItemStack being rendered * @param data Extra Type specific data */ @Override public void renderItem(ItemRenderType type, ItemStack item, Object... data) { if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) { if (!(item.getItem() instanceof ItemModularPickaxe)) { return; } ItemModularPickaxe modularPickaxe = (ItemModularPickaxe) item.getItem(); EntityPlayer entityPlayer = (EntityPlayer) data[1]; float i2 = 0.0F; float translation = -1.5F; if ((entityPlayer.inventory.getCurrentItem() == null) || (!(entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe))) { return; } GL11.glPushMatrix(); if (i2 < 0.0F) { i2 = 0.0F; } if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glTranslatef(0.0F, -(Math.abs(i2) / 2.0F), 0.0F); if (entityPlayer.getItemInUseCount() > 0) { GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-77.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-44.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-0.9F, -1.2F, -0.85F); GL11.glRotatef(15.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(0.1F, -0.25F, 0.08F); } if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe) { GL11.glRotatef(10.0F, 0.0F, 0.0F, 0.0F); GL11.glTranslatef(0.3F, 0.515F, 0.5F); } } else { GL11.glTranslatef(0.7F, 0.225F, 0.6125F); GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-110.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.1F, -0.9F, 0.15F); GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.3F, 1.3F, 1.3F); } renderItemCustom(type, item, data); GL11.glPopMatrix(); GL11.glPushMatrix(); float f28 = item.getMaxItemUseDuration() - (entityPlayer.getItemInUseCount() - 1.0F + 1.0F); float f32 = f28 / 50.0F; f32 = (f32 * f32 + f32 * 2.0F) / 3.0F; if (f32 > 1.0F) { f32 = 1.0F; } if (type == IItemRenderer.ItemRenderType.EQUIPPED_FIRST_PERSON) { GL11.glRotatef(-330.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(1.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.0F, 0.5F, 0.15F); GL11.glTranslatef(0.0F, 0.05F, -0.25F); GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(331.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(2.0F, 1.0F, 0.0F, 1.0F); GL11.glScalef(0.7F, 0.7F, 0.7F); if (entityPlayer.inventory.getCurrentItem().getItem() instanceof ItemModularPickaxe) { GL11.glRotatef(83.0F, 1.0F, 0.0F, 0.0F); GL11.glRotatef(-62.0F, 0.0F, 0.0F, 1.0F); GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F); GL11.glTranslatef(-1.5F, -1.22F, -0.7F); } } else { GL11.glTranslatef(0.7F, 0.225F, 0.6125F); GL11.glRotatef(-40.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(-110.0F, 1.0F, 0.0F, 0.0F); GL11.glTranslatef(0.05F, -0.7F, 0.15F); GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); GL11.glScalef(1.3F, 1.3F, 1.3F); } GL11.glPopMatrix(); } }
From source file:io.cyb3rwarri0r8.commumod.client.renderer.ModularPickaxeItemRenderer.java
License:Open Source License
private void renderItemCustom(ItemRenderType type, ItemStack item, Object[] data) { int i = 0;//w w w .j av a 2 s. c o m EntityLivingBase entity = (EntityLivingBase) data[1]; GL11.glPushMatrix(); Tessellator tes = Tessellator.instance; IIcon icon = entity.getItemIcon(item, i); float f = ((IIcon) icon).getMinU(); float f1 = ((IIcon) icon).getMaxU(); float f2 = ((IIcon) icon).getMinV(); float f3 = ((IIcon) icon).getMaxV(); float j = 0.1F; float l = 0.3F; GL11.glEnable(32826); GL11.glTranslatef(-j, -l, 0.0F); float m = 1.5F; GL11.glScalef(m, m, m); GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F); GL11.glRotatef(330.0F, 0.0F, 0.0F, 1.0F); GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F); ItemRenderer.renderItemIn2D(tes, f1, f2, f, f3, icon.getIconWidth(), icon.getIconHeight(), 0.0625F); GL11.glDisable(32826); GL11.glPopMatrix(); }
From source file:io.cyb3rwarri0r8.commumod.entity.render.RenderCobaltBoat.java
License:Open Source License
/** * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic * (Render<T extends Entity) and this method has signature public void func_76986_a(T entity, double d, double d1, * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that. *//* www .jav a 2 s . c o m*/ public void doRender(EntityCobaltBoat p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) { GL11.glPushMatrix(); GL11.glTranslatef((float) p_76986_2_, (float) p_76986_4_, (float) p_76986_6_); GL11.glRotatef(180.0F - p_76986_8_, 0.0F, 1.0F, 0.0F); float f2 = (float) p_76986_1_.getTimeSinceHit() - p_76986_9_; float f3 = p_76986_1_.getDamageTaken() - p_76986_9_; if (f3 < 0.0F) { f3 = 0.0F; } if (f2 > 0.0F) { GL11.glRotatef(MathHelper.sin(f2) * f2 * f3 / 10.0F * (float) p_76986_1_.getForwardDirection(), 1.0F, 0.0F, 0.0F); } float f4 = 0.75F; GL11.glScalef(f4, f4, f4); GL11.glScalef(1.0F / f4, 1.0F / f4, 1.0F / f4); this.bindEntityTexture(p_76986_1_); GL11.glScalef(-1.0F, -1.0F, 1.0F); this.modelBoat.render(p_76986_1_, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F); GL11.glPopMatrix(); }