Jump to content

Recommended Posts

Posted

I've tried every DefaultVertexFormat and none of them seem to work, I'm just trying to accomplish the simple goal of drawing a half transparent square. Any help and explanation is appreciated so I know for the future.

 

@Override public void drawScreen(int mouseX, int mouseY, float partialTicks) {
	Tessellator tessellator = Tessellator.getInstance();
	WorldRenderer worldRenderer = tessellator.getWorldRenderer();
	GlStateManager.color(1F, 1F, 1F, 1F);
	worldRenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
	worldRenderer.pos(200, 20, this.zLevel).color(0, 0, 0, 0.5F).endVertex();
	worldRenderer.pos(20, 20, this.zLevel).color(0, 0, 0, 0.5F).endVertex();
	worldRenderer.pos(200, 200, this.zLevel).color(0, 0, 0, 0.5F).endVertex();
	worldRenderer.pos(20, 200, this.zLevel).color(0, 0, 0, 0.5F).endVertex();
	tessellator.draw();
	super.drawScreen(mouseX, mouseY, partialTicks);
}

Posted

Well, you want mode 7 because that's GL11.GL_QUADS which is squares.

 

Your problem is likely that you're trying to draw this square at a location in the world* and it's huge.  Also note that a quad is only visible from one side.  In this case, the north side.  If you're trying to draw to pixel locations on the screen,* then it would be pointed away from the camera.

 

*I'll admit that I'm not entirely sure what getWorldRenderer() does.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Yea Gui rendering changed a lot from 1.8 - > 1.8.8/1.8.9 Although the class is called "WorldRenderer" it is also used for things such as GUIs, I've looked at vanilla code and this is the method for drawBackground

 

    public void drawBackground(int tint)
    {
        GlStateManager.disableLighting();
        GlStateManager.disableFog();
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldrenderer = tessellator.getWorldRenderer();
        this.mc.getTextureManager().bindTexture(optionsBackground);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        float f = 32.0F;
        worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
        worldrenderer.pos(0.0D, (double)this.height, 0.0D).tex(0.0D, (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex();
        worldrenderer.pos((double)this.width, (double)this.height, 0.0D).tex((double)((float)this.width / 32.0F), (double)((float)this.height / 32.0F + (float)tint)).color(64, 64, 64, 255).endVertex();
        worldrenderer.pos((double)this.width, 0.0D, 0.0D).tex((double)((float)this.width / 32.0F), (double)tint).color(64, 64, 64, 255).endVertex();
        worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double)tint).color(64, 64, 64, 255).endVertex();
        tessellator.draw();
    }

 

So I don't need .tex as my GUI element isn't textured. Like I don't see much difference in the two. If you can think of a case in vanilla where just a box is drawn on screen without a texture, I'll take a look at that (I also looked at tooltips yet that didn't seem to help either)

 

Edit: I probably should have searched more before giving up. I scrolled through the Gui class and there's a drawRect static method that takes 4 corners and a color.

Posted

Yea Gui rendering changed a lot from 1.8 - > 1.8.8/1.8.9 Although the class is called "WorldRenderer" it is also used for things such as GUIs

 

Some of the names MCP has given things are just weird.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Dear Brunoe Quick Hack (Team) Thank you so much for your remarkable help in recovering my funds after I was scammed. As a busy surgeon and single mother to three children, the loss was overwhelming.Web-Site: Brunoequickhack.COM Your team's hard work, expertise, and unwavering support gave me hope and helped restore my financial stability. I admire your professionalism and the way you genuinely care about your clients. I highly recommend your services to anyone who has fallen prey to scammers. You are truly life savers. Whats-App: +1705-(7842)-635 With heartfelt thanks, Contact information: BrunoequickhackATgmail.cOM Dear Brunoe Quick Hack (Team) Thank you so much for your remarkable help in recovering my funds after I was scammed. As a busy surgeon and single mother to three children, the loss was overwhelming.Web-Site: Brunoequickhack.COM Your team's hard work, expertise, and unwavering support gave me hope and helped restore my financial stability. I admire your professionalism and the way you genuinely care about your clients. I highly recommend your services to anyone who has fallen prey to scammers. You are truly life savers. Whats-App: +1705-(7842)-635 With heartfelt thanks, Contact information: BrunoequickhackATgmail.cOM
    • ok i tried to disable the last mod's i installed and it is some of then, so now im going to do the classic enable and disable trick to find out which mod cause the crash. thanks for the help  
    • ok  make it work (java not being recognize) by downloading the zip putting it in the java folder and manually setting the path but is still give the same crush report https://pastebin.com/PPmR6jN0
    • Install this one: https://www.azul.com/downloads/?version=java-17-lts&os=windows&architecture=x86-64-bit&package=jdk#zulu After installation, set the java version in your Launcher / Java settings
    • it say it requires java 17 so when i go to install it is say "the installer has encounter an unexpected error installing this package." error code 2503 and 2502. https://pastebin.com/AL6AHMM9
  • Topics

×
×
  • Create New...

Important Information

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