Java Code Examples for net.minecraft.client.renderer.GlStateManager#setActiveTexture()

The following examples show how to use net.minecraft.client.renderer.GlStateManager#setActiveTexture() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GuiInventoryExpandedCrafting.java    From Cyberware with MIT License 5 votes vote down vote up
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent)
{
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate((float)posX, (float)posY, 50.0F);
	GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	float f = ent.renderYawOffset;
	float f1 = ent.rotationYaw;
	float f2 = ent.rotationPitch;
	float f3 = ent.prevRotationYawHead;
	float f4 = ent.rotationYawHead;
	GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
	RenderHelper.enableStandardItemLighting();
	GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
	ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
	ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
	ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
	ent.rotationYawHead = ent.rotationYaw;
	ent.prevRotationYawHead = ent.rotationYaw;
	GlStateManager.translate(0.0F, 0.0F, 0.0F);
	RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
	rendermanager.setPlayerViewY(180.0F);
	rendermanager.setRenderShadow(false);
	rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
	rendermanager.setRenderShadow(true);
	ent.renderYawOffset = f;
	ent.rotationYaw = f1;
	ent.rotationPitch = f2;
	ent.prevRotationYawHead = f3;
	ent.rotationYawHead = f4;
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
 
Example 2
Source File: WrapperGlStateManager.java    From ClientBase with MIT License 4 votes vote down vote up
public static void setActiveTexture(int var0) {
    GlStateManager.setActiveTexture(var0);
}
 
Example 3
Source File: GuiEntityRender.java    From WearableBackpacks with MIT License 4 votes vote down vote up
@Override
public void draw(int mouseX, int mouseY, float partialTicks) {
	int w = getWidth();
	int h = getHeight();
	
	enableBlendAlphaStuffs();
	setRenderColorARGB(_colorBackground); drawRect(1, 1, w - 2, h - 2);
	setRenderColorARGB(_colorBorder);     drawOutline(0, 0, w, h);
	disableBlendAlphaStuffs();
	
	Entity entity = getEntity();
	if (entity == null) return;
	
	AxisAlignedBB bbox = entity.getRenderBoundingBox();
	float entityWidth  = (float)(bbox.maxX - bbox.minX);
	float entityHeight = (float)(bbox.maxY - bbox.minY);
	float scale = Math.min((w - RESERVED_SPACE) / entityWidth,
	                       (h - RESERVED_SPACE) / entityHeight) * _zoom;
	float yaw   = _yawDefault + _yaw;
	float pitch = _pitchDefault + _pitch;
	
	getContext().pushScissor(this, 1, 1, w - 2, h - 2);
	
	if (entity.getEntityWorld() == null)
		entity.setWorld(DummyWorld.INSTANCE);
	if (getMC().player == null) {
		World world = entity.getEntityWorld();
		if (!(world instanceof DummyWorld)) return;
		getMC().player = ((DummyWorld)world).player;
		getMC().player.setWorld(world);
	}
	
	setRenderColorARGB(Color.WHITE);
	GlStateManager.enableDepth();
	// From GuiInventory.drawEntityOnScreen
	GlStateManager.enableColorMaterial();
	GlStateManager.pushMatrix();
	GlStateManager.translate(w * _centerX, h * _centerY, 100.0F);
	GlStateManager.scale(-scale, scale, scale);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.rotate(pitch, 1.0F, 0.0F, 0.0F);
	GlStateManager.translate(0.0F, -(entityHeight / 2), 0.0F);
	GlStateManager.rotate(yaw, 0.0F, 1.0F, 0.0F);
	
	RenderHelper.enableStandardItemLighting();
	
	RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
	rendermanager.setPlayerViewY(180.0F);
	rendermanager.setRenderShadow(false);
	rendermanager.renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
	rendermanager.setRenderShadow(true);
	
	GlStateManager.popMatrix();
	RenderHelper.disableStandardItemLighting();
	GlStateManager.disableRescaleNormal();
	GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
	
	GlStateManager.disableDepth();
	if (getMC().player instanceof DummyPlayerSP)
		getMC().player = null;
	getContext().popScissor();
}
 
Example 4
Source File: RenderUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static void disableLightmap() {
	GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.disableTexture2D();
	GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
 
Example 5
Source File: RenderUtils.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static void enableLightmap() {
	GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
	GlStateManager.enableTexture2D();
	GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
 
Example 6
Source File: EntityWikiTab.java    From IGW-mod with GNU General Public License v2.0 4 votes vote down vote up
public static void drawEntity(Entity entity, int x, int y, float size, float partialTicks){
    //GL11.glEnable(GL11.GL_LIGHTING);
    //x, y, scale, yaw, pitch
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float maxHitboxComponent = Math.max(1, Math.max(entity.width, entity.height));
    int scale = (int)(40 * size / maxHitboxComponent);

    GlStateManager.enableColorMaterial();
    GlStateManager.pushMatrix();
    GL11.glTranslatef(x, y, 50.0F);
    GL11.glScalef(-scale, scale, scale);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);

    GL11.glRotatef(30, 1, 0, 0);

    GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);

    GL11.glRotatef(-TickHandler.ticksExisted, 0, 1, 0);
    /* GL11.glRotatef(-((float)Math.atan((double)(par4 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
     entity.renderYawOffset = (float)Math.atan((double)(par3 / 40.0F)) * 20.0F;
     entity.rotationYaw = (float)Math.atan((double)(par3 / 40.0F)) * 40.0F;
     entity.rotationPitch = -((float)Math.atan((double)(par4 / 40.0F))) * 20.0F;
     entity.rotationYawHead = entity.rotationYaw;
     entity.prevRotationYawHead = entity.rotationYaw;*/
    GL11.glTranslatef(0.0F, (float)entity.getYOffset(), 0.0F);
    RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
    rendermanager.setRenderShadow(false);
    Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F;
    Minecraft.getMinecraft().getRenderManager().renderEntity(entity, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
    rendermanager.setRenderShadow(true);
    /* entity.renderYawOffset = f2;
     entity.rotationYaw = f3;
     entity.rotationPitch = f4;
     entity.prevRotationYawHead = f5;
     entity.rotationYawHead = f6;*/
    GlStateManager.popMatrix();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.disableRescaleNormal();
    GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
    GlStateManager.disableTexture2D();
    GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);

    // GL11.glDisable(GL11.GL_LIGHTING);
}