Jump to content

Recommended Posts

Posted

Just hit a weird problem with GUI rendering, specifically drawing a tank gauge texture on a GUI screen.  It works fine inside my dev environment, but when the mod is run in a regular client, the problem crops up; instead of the GUI background showing up behind the texture, the background renders solid black, or occasionally with parts of other textures intruding (which suggests that I'm being careless with my texture coords, but I'm pretty sure I'm not - and why would it work in a dev environment and not outside?)

 

The code is here: https://github.com/desht/pnc-repressurized/blob/master/src/main/java/me/desht/pneumaticcraft/client/gui/widget/WidgetTank.java#L48

 

and the texture in question (16 x 64 PNG file, mostly transparent) is here: https://github.com/desht/pnc-repressurized/blob/master/src/main/resources/assets/pneumaticcraft/textures/gui/widget/widget_tank.png

 

And an example of what it looks like (5 tanks here, 3 with solid black, 2 with other textures creeping in): https://imgur.com/a/nUi5E.  The problem happens whether or not there's any fluid to render.  If there is fluid, the fluid renders fine, and the gauge is rendered over the fluid OK.  Just the part that's rendered over the GUI background goes wrong.

 

Anyone seen anything like this before?  It's got me scratching my head...

Posted

Yeah, I'd considered that, but my mod is the one & only mod in my non-dev test world, and I still have the problem.  So other-mod interference can be ruled out.

Posted

Well, it turns out that it was happening in my dev environment too.  I've worked around the problem for now by just drawing the gauge lines directly with Gui.drawRect() calls, but I'm no nearer to working out why it was a problem...

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

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

Announcements



×
×
  • Create New...

Important Information

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