_bau5 Posted May 12, 2013 Share Posted May 12, 2013 My problem is: I'm trying to render some ItemStacks on the in game gui when looking at one of my entities. Now it works, but it seems that it isn't rendering the texture, as the pale-blue backdrop can be seen through where the render is supposed to be. Above you can see, circled in red, the problem. The stone on the left is rendered using the exact same call, but from the GuiIngame class, while the block on the right, that isn't being rendered correctly, is being called from outside the GuiIngame class. I am terrible, terrible at the OpenGL stuff, and am verging on scrapping this idea. Any ideas as to why this would be happening? My guess is it's due to differing states of the OpenGL render, but I've fiddled with it and can't get the textures to show. Here is the pertinent code. @ForgeSubscribe public void onCraftingFrameHighlight(DrawBlockHighlightEvent ev){ if(ev.target.entityHit instanceof EntityCraftingFrame && ((EntityCraftingFrame)ev.target.entityHit).getCurrentRecipe() != null){ RecipeItem rec = ((EntityCraftingFrame)ev.target.entityHit).getCurrentRecipe(); if(rec != null){ Minecraft mc = FMLClientHandler.instance().getClient(); if(rec.alternatives().size() == 0) return; ItemStack[] stacksToDraw = rec.alternatives().get(0); RenderItem itemRenderer = new RenderItem(); mc.entityRenderer.setupOverlayRendering(); GL11.glDisable(GL11.GL_BLEND); GL11.glEnable(GL12.GL_RESCALE_NORMAL); RenderHelper.enableGUIStandardItemLighting(); for(int i = 0; i < stacksToDraw.length; i++){ GL11.glPushMatrix(); FontRenderer font = stacksToDraw[i].getItem().getFontRenderer(stacksToDraw[i]); if (font == null) font = mc.fontRenderer; itemRenderer.renderItemAndEffectIntoGUI(font, mc.renderEngine, stacksToDraw[i], 125, 221 /*9 + xPos + (i * 16), yPos+2*/); itemRenderer.renderItemOverlayIntoGUI(font, mc.renderEngine, stacksToDraw[i],125, 221 /*9 + xPos + (i * 16), yPos+2*/, Integer.toString(stacksToDraw[i].stackSize)); GL11.glPopMatrix(); } RenderHelper.disableStandardItemLighting(); GL11.glDisable(GL12.GL_RESCALE_NORMAL); } } } [embed=425,349][/embed] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.