Jump to content

[1.8.9] How to render image in top left corner of screen?


BillehBawb

Recommended Posts

wr.pos(0, 0, 0).tex(90, 90).endVertex();
wr.pos(0, 256, 0).tex(90, 90).endVertex();
wr.pos(256, 0, 0).tex(90, 90).endVertex();
wr.pos(256, 256, 0).tex(90, 90).endVertex();

Vertices must be specified either CW or CCW, not in a "flipped N" order as you currently are doing(that's why your texture looks like a triangle).

UVs range from 0 to 1, and different vertices should have different UVs

 

ResourceLocation textureLocation = new ResourceLocation("hackerdt", "assets/hackernotify.png");

assets/ gets resolved automatically, you do not need to specify it in your path.

 

You must have your resources(textures/sounds/jsons/etc) in assets/modid/ folder.

 

GlStateManager.pushMatrix(); 
GlStateManager.popMatrix();

?

 

RenderGameOverlayEvent has different ElementTypes you need to check, otherwise you will be drawing your image multiple times a frame for each thing the event fires for.

 

A priority of an event is NORMAL by default, you do not need to explicitly specify it.

Link to comment
Share on other sites

23 minutes ago, V0idWa1k3r said:

wr.pos(0, 0, 0).tex(90, 90).endVertex();
wr.pos(0, 256, 0).tex(90, 90).endVertex();
wr.pos(256, 0, 0).tex(90, 90).endVertex();
wr.pos(256, 256, 0).tex(90, 90).endVertex();

Vertices must be specified either CW or CCW, not in a "flipped N" order as you currently are doing(that's why your texture looks like a triangle).

UVs range from 0 to 1, and different vertices should have different UVs

 


ResourceLocation textureLocation = new ResourceLocation("hackerdt", "assets/hackernotify.png");

assets/ gets resolved automatically, you do not need to specify it in your path.

 

You must have your resources(textures/sounds/jsons/etc) in assets/modid/ folder.

 


GlStateManager.pushMatrix(); 
GlStateManager.popMatrix();

?

 

RenderGameOverlayEvent has different ElementTypes you need to check, otherwise you will be drawing your image multiple times a frame for each thing the event fires for.

 

A priority of an event is NORMAL by default, you do not need to explicitly specify it.

Can I have some example code for a 256 x 256 square? I find it easier to learn by looking at code and then going through it and understanding it, plus it gives me something I can reference in the future

Link to comment
Share on other sites

2 minutes ago, BillehBawb said:

Can I have some example code for a 256 x 256 square?

Look at the methods in the class you are extending - Gui. The image dimenions are irrelevant as you specify everything yourself.

Edited by V0idWa1k3r
Link to comment
Share on other sites

1 hour ago, Kokkie said:

Try using Gui.drawTexturedModalRect(...).

 

1 hour ago, V0idWa1k3r said:

Look at the methods in the class you are extending - Gui. The image dimenions are irrelevant as you specify everything yourself.

Thanks both of you, after some experimenting I got it to show up. I just have a few more small questions... first off, is there a simple way to just display text? I want to display text over my image and it changed depending on arguments and the situation.

Link to comment
Share on other sites

40 minutes ago, Kokkie said:

That's because it isn't static, try Minecraft.getMinecraft().ingameGUI.

Ooorr... just use this.drawString, since you have access to it because you extend the Gui class.

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/

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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