Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

                GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
	GL11.glPushMatrix();

	GL11.glColor4f((float)RGB[0]/255, (float)RGB[1]/255, (float)RGB[2]/255, .6f);
                int top = BAR_SPACING + (iteration * (BAR_SPACING + BAR_HEIGHT));
	int left = BAR_SPACING;
	GL11.glBegin(GL11.GL_LINE_LOOP);
	{
		GL11.glVertex2i(left, top);
		GL11.glVertex2i(left + BAR_WIDTH, top);
		GL11.glVertex2i(left + BAR_WIDTH, top + BAR_HEIGHT);
		GL11.glVertex2i(left, top + BAR_HEIGHT);
	}
	GL11.glEnd();

	GL11.glColor4f((float)RGB[0]/255, (float)RGB[1]/255, (float)RGB[2]/255, .8f);
	GL11.glBegin(GL11.GL_QUADS);
	{
		int right = left + (int)(new Float(BAR_WIDTH) / percent);
		GL11.glVertex2i(left, top);
		GL11.glVertex2i(right, top);
		GL11.glVertex2i(right, top + BAR_HEIGHT);
		GL11.glVertex2i(left, top + BAR_HEIGHT);			
	}
	GL11.glEnd();
                GL11.glPopMatrix();
	GL11.glPopAttrib();

I am trying to draw an open rectangle and then fill in a percent of it.

As is this code draws the rectangle but doesn't fill it.

 

If I switch around the vertices in the second part to this:

                        GL11.glVertex2i(left, top);
		GL11.glVertex2i(right, top);
		GL11.glVertex2i(left, top + BAR_HEIGHT);
		GL11.glVertex2i(right, top + BAR_HEIGHT);

I fills in a triangle using the right side and the bottom left corner.

 

Any idea what I need to do to get it to fill a rectangle?

Current Project: Armerger 

Planned mods: Light Drafter  | Ore Swords

Looking for help getting a mod off the ground? Coding  | Textures

Arent QUADS (front face) drawn anti-clockwise (unless you make double-sided face)? :D I think it should solve problem.

 

Also: Why not use tesselator (WorldRenderer)?

Have a look at Gui.class - it shows basic usage of this thingy.

I personally really like that format (it allows a lot of vertex options).

 

I personally wrote it similar but to be static, accept doubles and use RGBA.

Some of Gui.class methods use ARGB i think (and some just RBG for sure).

1.7.10 is no longer supported by forge, you are on your own.

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.