Posted March 6, 20169 yr 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
March 6, 20169 yr Arent QUADS (front face) drawn anti-clockwise (unless you make double-sided face)? 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.