Jump to content

Recommended Posts

Posted

Hi there!

I have an overlay (Hooked into RenderGameOverlayEvent) and have tried drawing a simple semi-transparent white rectangle

Unfortunatly, the rectangle is opaque (not 50% transparent), and items become invisble in my hotbar, and when I open my inventory screen

Showing NEI crashes with a message to do with drawing items.

 

Here's the NEI crash stack in case if it helps

        at net.minecraft.item.ItemStack.getMetadata(ItemStack.java:280)
at net.minecraft.client.renderer.ItemModelMesher.getMetadata(ItemModelMesher.java:70)
at net.minecraft.client.renderer.ItemModelMesher.getItemModel(ItemModelMesher.java:43)
at net.minecraft.client.renderer.entity.RenderItem.renderItemIntoGUI(RenderItem.java:360)
at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:210)
at codechicken.nei.guihook.GuiContainerManager.drawItem(GuiContainerManager.java:178)
at codechicken.nei.ItemPanel.draw(ItemPanel.java:129)
at codechicken.nei.LayoutManager.renderObjects(LayoutManager.java:197)
at codechicken.nei.guihook.GuiContainerManager.renderObjects(GuiContainerManager.java:389)
at net.minecraft.client.gui.inventory.GuiContainer.drawScreen(GuiContainer.java:135)
at net.minecraftforge.client.ForgeHooksClient.drawScreen(ForgeHooksClient.java:470)

 

Transparency works on the shadow at the bottom of the white rectangle, and it also works if I clear the screen before drawing anything.

 

nVAsIdr.jpg

 

Here's the code for the overlay

            GuiUtils.setup(false);
            rootComponent.onUpdate();

            GL11.glColor4d(1, 1, 1, 1);
            GlStateManager.enableTexture2D();
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glMatrixMode(GL11.GL_PROJECTION);

            int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor();
            GL11.glScaled(guiScale, guiScale, guiScale);

 

rootComponent.onUpdate()

draws the UI

 

Here's

GuiUtils.setup()

    public static void setup(boolean clearBuffer) {
        GL11.glMatrixMode(GL11.GL_PROJECTION);
        GL11.glLoadIdentity();
        GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 10000, -10000);
        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        if (clearBuffer) {
            GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);
        }

        GL11.glShadeModel(GL11.GL_SMOOTH);
        GL11.glEnable(GL11.GL_LINE_SMOOTH);

        GlStateManager.enableBlend();
        GlStateManager.disableTexture2D();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.color(1, 1, 1, 1);
        TextureImpl.bindNone();
    }

Posted

I'd need to see the whole class so I can see the ordering of your calls but you've forgotten to pop part of the stack and have fucked the GLState, plain and simple here (done this countless times myself ;])

 

IE you call

        GlStateManager.disableTexture2D();

I've got no clues if you've reenabled the textures or not

  Quote
I think its my java of the variables.

Posted
  On 3/4/2016 at 1:25 AM, RANKSHANK said:

I'd need to see the whole class so I can see the ordering of your calls but you've forgotten to pop part of the stack and have fucked the GLState, plain and simple here (done this countless times myself ;])

 

IE you call

        GlStateManager.disableTexture2D();

I've got no clues if you've reenabled the textures or not

 

I do re-enable Texture2D

            GuiUtils.setup(false);
            rootComponent.onUpdate();

            GL11.glColor4d(1, 1, 1, 1);
            GlStateManager.enableTexture2D(); // <<<< This line here!
            GL11.glEnable(GL11.GL_BLEND);
            GL11.glMatrixMode(GL11.GL_PROJECTION);

            int guiScale = new ScaledResolution(Minecraft.getMinecraft(), Minecraft.getMinecraft().displayWidth, Minecraft.getMinecraft().displayHeight).getScaleFactor();
            GL11.glScaled(guiScale, guiScale, guiScale);

 

As for seeing the whole class... (There's several)

Well... I made a custom GUI system. I'll show you the main parts.

All of the drawing is done with the GuiUtils class

The other main classes are UIRootComponent, UIComponent and GuiGameOverlay

 

Here are the 4 files (You asked for the whole thing. It's rather large!):

https://gist.github.com/CraftedCart/e53f6465e60fff6ed45d

Posted

It seems that messing with the GL Matrix stuffs it up...

Any advice anyone?

Doing

GL11.glMatrixMode(GL11.GL_PROJECTION);

after drawing works, but only when the Minecraft window is small. Otherwise, the window is just a solid colour.

Posted
  On 3/7/2016 at 7:46 PM, CraftedCart said:

It seems that messing with the GL Matrix stuffs it up...

Any advice anyone?

Doing

GL11.glMatrixMode(GL11.GL_PROJECTION);

after drawing works, but only when the Minecraft window is small. Otherwise, the window is just a solid colour.

You'll need to trace back and find what matrix mode was being used previously and set it back to that when you're done then

  Quote
I think its my java of the variables.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Is there a fix for this issue? I have tried reinstalling OpenAL.dll, switching Java versions, and even muting my game when it launched, but all of these attempts have resulted in my game crashing nonetheless. I have been dealing with this issue for approximately a week straight. I have not changed any sound settings, so I am very confused. Full Code: https://gnomebot.dev/paste/mclogs/beEBzpm "4/16/2025 12:16:30 AM 1000 Error Faulting application name: javaw.exe, version: **.**.**.**, time stamp: 23 0xd75c3041 24 Faulting module name: OpenAL.dll, version: **.**.**.**, time stamp: 0x647635a125 Exception code: 0xc0000409 26 Fault offset: 0x00000000000a2b05 27 Faulting process id: 0x10A0 28 Faulting application start time: 0x1DBAE81D04A6F2F 29 Faulting application path: C:\Users\********\curseforge\minecraft\Install\java30 \java-runtime-delta\bin\javaw.exe 31 Faulting module path: C:\Users\********\curseforge\minecraft\Install\natives\n32 eoforge-21.1.148\OpenAL.dll 33 Report Id: 28552180-f359-40cc-adeb-08dada7e99d8 34 Faulting package full name: 35 Faulting package-relative application ID:" Any sort of insight would be greatly appreciated, it's giving me a headache.
    • I'm new to this, if that wasn't obvious. My friend and I are trying to make a modpack for 1.19.2. I've made a modpack previously with 0 issues before and many of the same mods. However, I can't seem to find the issue when trying to load up his new modpack.   Any help would be greatly appreciated.
    • Im trying to make a customized modpack for just myself using the atm9 modpack as a base. It was working till recently, when curseforge force updated all the mods in the pack. Currently every time I get to the main menu I try and create a world in single player and it just says saving world. then generates a crash report.    Crash Report: https://pastebin.com/xXESPfJs   Latest Log Part 1: https://pastebin.com/Cb2VpUyr  Part 2: https://pastebin.com/9SWVn4Dx
    • Okay, for him the config file looked like this: flywheel-client.toml: #Select the backend to use. Set to "DEFAULT" to let Flywheel decide. backend = "DEFAULT" #Enable or disable instance update limiting with distance. limitUpdates = true #The number of worker threads to use. Set to -1 to let Flywheel decide. Set to 0 to disable parallelism. Requires a game restart to take effect. #Range: -1 ~ 12 workerThreads = -1 #Config options for Flywheel's built-in backends. [flw_backends]     #How smooth Flywheel's shader-based lighting should be. May have a large performance impact.     #Allowed Values: FLAT, TRI_LINEAR, SMOOTH, SMOOTH_INNER_FACE_CORRECTED     lightSmoothness = "SMOOTH" There was no "INSTANCING", so we changed "DEFAULT" to "OFF", but this didn't help. Changing it to "INSTANCING" didn't work as well.
  • Topics

×
×
  • Create New...

Important Information

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