Jump to content

Recommended Posts

Posted

Hey Guys,

I have a problem, I want to render a zoom Scope from a sniper into the Screen, I already created the Gui class and can already render stuff into the screen, but my problem is, I already looked up in the GuiIngame Class, I dont know how to draw a image into the screen, which renders so, that the image renders in every resolution right.I hope you unterstand what I mean. It should render like the Pumkin blur, only with another texture.

 

This is my Gui class. It renders after the Expierencebar.

package de.kloon.advancedguns.client;

import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.XRandR.Screen;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.event.entity.minecart.MinecartCollisionEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import de.kloon.advancedguns.main.AdvGuns;

public class GuiZoomScope extends Gui{

private Minecraft mc;
private int height;
private int width;
//	public static final ResourceLocation texture = new ResourceLocation(AdvGuns.modid + ":textures/gui/6x Zoom Scope Overlay.png");
public static final ResourceLocation texture = new ResourceLocation("textures/misc/pumpkinblur.png");

public GuiZoomScope(Minecraft minecraft) {
	super();
	this.mc = minecraft;
}

@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderExperienceBar(RenderGameOverlayEvent event){


}

}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted
    public static void drawDrawFullscreenImage(int width, int height) {
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, (double)height, -90.0D, 0.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, (double)height, -90.0D, 1.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, 0.0D, -90.0D, 1.0D, 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
        tessellator.draw();
    }

Posted

    public static void drawDrawFullscreenImage(int width, int height) {
        Tessellator tessellator = Tessellator.instance;
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, (double)height, -90.0D, 0.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, (double)height, -90.0D, 1.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, 0.0D, -90.0D, 1.0D, 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
        tessellator.draw();
    }

 

OK, You'reposting the raw code, but I want to learn something, can you please teach me what this means?

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

Well, that code starts drawing a quad, adds 4 vertices to the tessellator and draws that to the screen. You need to bind the texture first and then call that method.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

Well, that code starts drawing a quad, adds 4 vertices to the tessellator and draws that to the screen. You need to bind the texture first and then call that method.

 

My Problem is, my scrren only gets Black, I know the Image gets loaded, but it draws it black,why?

 

public void onRenderExperienceBar(RenderGameOverlayEvent event){
	height = Minecraft.getMinecraft().displayHeight;
	width = Minecraft.getMinecraft().displayWidth;

	Tessellator tessellator = Tessellator.instance;
	this.mc.getTextureManager().bindTexture(texture);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(0.0D, (double)height, -90.0D, 0.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, (double)height, -90.0D, 1.0D, 1.0D);
        tessellator.addVertexWithUV((double)width, 0.0D, -90.0D, 1.0D, 0.0D);
        tessellator.addVertexWithUV(0.0D, 0.0D, -90.0D, 0.0D, 0.0D);
        tessellator.draw();

}

Creator of Extra Shoes

 

Watch out, I'm total jerk, and I'll troll anybody if it feels like its necessary. Pls report me then

Posted

Right now you're rendering a lot of times. You nee to check if

event.type == ElementType.A_TYPE

before rendering.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.