Jump to content

Trying to draw a texture [1.5.2]


NuclearFej
 Share

Recommended Posts

Hey everyone.

 

Basically all I want to do is to draw a BufferedImage to the screen. Here's the relevant section of my code:

 

TextureManager.instance().makeTexture("playerFace" + e.getName(), 0, 8, 8, 0, 6408, 9728, 9728, false, e.getFace()).bindTexture(0);
drawTexturedModalRect(0, 0, 0, 0, 8, ;

 

I don't really understand what most of the parameters in the makeTexture method do (except for the width, height, and BufferedImage ones), nor the one in bindTexture. Can someone explain what each actually does?

 

Additionally, as is, the code outputs this when run. I assume a problem with a parameter causes this:

 

2013-08-22 22:44:23 [sEVERE] [Minecraft-Client] ########## GL ERROR ##########
2013-08-22 22:44:23 [sEVERE] [Minecraft-Client] @ Post render
2013-08-22 22:44:23 [sEVERE] [Minecraft-Client] 1280: Invalid enum

 

Thanks guys!

Link to comment
Share on other sites

I'm on 1.5.2, the DynamicTexture class doesn't exist (yet, I assume).

 

The MapItemRenderer class seems to generate the texture on the fly, and I can't quite figure out how it works (sorry).

 

Perhaps I'm looking in the wrong place. I want to draw images (other players' faces) on the overlay (with health bar, XP bar, etc). Is making a Texture the best way to do this? If not, what is?

 

Thanks!

 

EDIT: Here's what I think I should be doing, correct me where I'm wrong:

 

I want to use drawTexturedModelRectFromIcon (sic) in the Gui class. In order to do that, I need to pass in an Icon. Of course I can't instantiate an Icon (basic Java) so I need to use the only class that implements it, TextureStitched. In order to use TextureStitched, I have to pass in a Texture in the init method.

 

Thus, why I want to create a Texture. The easiest way to do this appears to be the makeTexture method in the TextureManager class, but I'm not sure what all of the parameters do - leading back to my initial question.

 

Another way to do it is to use createEmptyTexture and then call transferFromImage on the resulting object, but then I still run into the same problem manifested differently: I don't know what the second or fifth parameters of that method do (although I'm pretty sure the second does nothing).

 

While I'm at it: what do u and v refer to? (Take for example the method addVertexWithUV)

Link to comment
Share on other sites

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

 Share



×
×
  • Create New...

Important Information

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