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

I have some odd issues while rendering a hud

 

Here is my code from rendertickhander :

if (player.getCurrentEquippedItem() != null && !TCKeyHandler.radialActive && ThaumcraftApiHelper.isResearchComplete(player.username, "Complex Essentia Draw")){
				if ((player.getCurrentEquippedItem().getItem() instanceof ItemWandCasting)){
					ItemStack wand = player.getCurrentEquippedItem();
	            	ItemWandCasting wandINTR = (ItemWandCasting) player.getCurrentEquippedItem().getItem();
	            	
	            	GL11.glPushMatrix();

	    		    GL11.glClear(256);
	    		    GL11.glMatrixMode(5889);
	    		    GL11.glLoadIdentity();
	    		    GL11.glOrtho(0.0D, res.getScaledWidth_double(), res.getScaledHeight_double(), 0.0D, 1000.0D, 3000.0D);
	    		    GL11.glMatrixMode(5888);
	    		    GL11.glLoadIdentity();
	    		    int k = res.getScaledWidth();
	    		    int l = res.getScaledHeight();
	    		    ResourceLocation hud = new ResourceLocation("thaumcraft", "textures/gui/hud.png");
	    		    ResourceLocation utilR = new ResourceLocation("rs","textures/utils/stuff.png");

	    		    GL11.glTranslatef(k, 0, -2000.0F);
	    		    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

	    		    GL11.glEnable(3042);
	    		    GL11.glBlendFunc(770, 771);
	    		    
	    		    
	    		    
	    		    GL11.glPushMatrix();
	    		    GL11.glScaled(0.5D, 0.5D, 0.5D);
	    		    Minecraft.getMinecraft().renderEngine.bindTexture(hud);
	    		    GL11.glTranslatef(-32, 32, 0);
	    		    GL11.glRotatef(270, 0, 0, 1);
	    		    GL11.glTranslatef(32, -32, 0);
	    		    UtilsFX.drawTexturedQuad(-64, 0, 0, 0, 64, 64, -90.0D);
	    		    GL11.glPopMatrix();
	    		    
	    		    /*for testing
	    		    GL11.glPushMatrix();
	    		    Minecraft.getMinecraft().renderEngine.bindTexture(utilR);
	    		    GL11.glTranslatef(-32, 32, 0);
	    		    UtilsFX.drawTexturedQuad(0,0, 10, 0, 1, 1, -90F);
	    		    GL11.glPopMatrix();
	    		    */
	    		    
	    		    Minecraft.getMinecraft().renderEngine.bindTexture(hud);
	    		    
	    		    int max = wandINTR.getMaxVis(wand);
	    		    
	    		    for(int i = 0;i<6;i++){
	    		    	GL11.glPushMatrix();
		    		    GL11.glScaled(0.5D, 0.5D, 0.5D);
		    		    GL11.glTranslatef(-32, 32, 0);
		    		    GL11.glRotatef(105-i*24, 0, 0, 1);
		    		    GL11.glTranslatef(-8+i*0.2F, 26, 0);
		    		    
		    		    GL11.glPushMatrix();
		    		    UtilsFX.drawTexturedQuad(0, 0, 72, 4, 16, 42, -90F);
		    		    GL11.glPopMatrix();
		    		    
		    		    if(player.getCurrentEquippedItem().stackTagCompound.hasKey(EDUtils.COMPLEX_POOL)){
		    		    	NBTTagCompound taggy = player.getCurrentEquippedItem().stackTagCompound.getCompoundTag(EDUtils.COMPLEX_POOL);		    
			    		    AspectList visA = new AspectList(); visA.readFromNBT(taggy);
			    		    
			    		    if(visA.getAspects().length-1 >= i && visA.getAspects()[i] != null){
			    		    	GL11.glPushMatrix();
			    		    	
			    		    	GL11.glPushMatrix();
			    		    	int loc = (int)(30.0F * visA.getAmount(visA.getAspects()[i])/ max);
				    		    Color ac = new Color(visA.getAspects()[i].getColor());
				    		    GL11.glColor4f(ac.getRed() / 255.0F, ac.getGreen() / 255.0F, ac.getBlue() / 255.0F, 0.8F);
				    		    UtilsFX.drawTexturedQuad(4, 4, 104, 0, 8, loc, -90.0D);
				    		    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
				    		    GL11.glPopMatrix();
				    		    
				    		    
				    		    
				    		    if(player.isSneaking()){
				    		    	GL11.glPushMatrix();
				    		    	GL11.glRotatef(-90, 0, 0, 1);
				    		                  Minecraft.getMinecraft().ingameGUI.drawCenteredString(Minecraft.getMinecraft().fontRenderer, Math.round(visA.getAmount(visA.getAspects()[i])/100)+"", -50, 50, 16777215);
				    		    	GL11.glPopMatrix();
				    		    }
				    		    GL11.glPopMatrix();
				    		    
                                            }
			    		    
		    		    }
		    		    GL11.glPopMatrix();
		    		}
	    		    
	    		    GL11.glPopMatrix();
		        }
            }

 

I confess that a bunch of code is just pasted, i did only some basics.

 

Here is an issue :

    http://s29.postimg.org/wi0c7exgn/2014_03_17_21_49_27.png

right top corner (not the locations of 100s, white scribble on the hud is the problem and it happens when player is sneaking)

 

 

Hi

 

Just my guess, since it looks to me like one of the "cylinders" renders correctly and the rest don't:

 if(player.isSneaking()){
				    		    	GL11.glPushMatrix();
				    		    	GL11.glRotatef(-90, 0, 0, 1);
				    		                  Minecraft.getMinecraft().ingameGUI.drawCenteredString(Minecraft.getMinecraft().fontRenderer, Math.round(visA.getAmount(visA.getAspects()[i])/100)+"", -50, 50, 16777215);
				    		    	GL11.glPopMatrix();
				    		    }

Probably drawCentredString changes one or more of the drawing attributes.

You could try looking through it to see what flags get changed, alternatively it might work to use

    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);

and

  GL11.glPopAttrib();

 

-TGG

 

 

You might want to translate back to the origin of the circle, before you draw your white text. Then it won't look askew. The center of rotation seems to be somewhere to the left of the center.

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.