Fix SlicedTexture drawing logic to resolve GL1280 errors#194
Fix SlicedTexture drawing logic to resolve GL1280 errors#194NealDeal34 wants to merge 7 commits into
Conversation
UltraProdigy
left a comment
There was a problem hiding this comment.
Looks good, two minor things
|
I tried adding a single I tried to figure out the root cause of the |
UltraProdigy
left a comment
There was a problem hiding this comment.
In addition to my comments, I'm curious why you removed a bunch of the commented out lines? You say you used AI for assistance did you just tell it to remove all comments and it got these by mistake?
| public void drawTexture(int x, int y, int width, int height, float zLevel, float partialTick, IGuiColor color) { | ||
| if (width <= 0 || height <= 0) return; | ||
|
|
||
| GL11.glGetError(); |
There was a problem hiding this comment.
Why do we have this line in here? It's basically functioning as an error eraser right now which I don't see as beneficial.
|
|
||
| GL11.glEnable(GL11.GL_BLEND); | ||
| OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); | ||
| OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); |
There was a problem hiding this comment.
What is the purpose of doing this? You stated in your description that you wanted to change this to a universal 2 parameter function but you've kept it as a 4 parameter function and just replaced pre-defined constants with their magic number variants?
|
|
||
| GL11.glEnable(GL11.GL_BLEND); | ||
| OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO); | ||
| OpenGlHelper.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, 1, 0); |
Fixes frequent GL1280 OpenGL errors when BetterQuesting's animated quest boxes are rendered with the Angelica mod. The issue occurred because SlicedTexture modified global OpenGL state without restoring it, used a 4-parameter blend function incompatible with some LWJGL 2 environments, and passed invalid color values from dynamic alpha calculations. This state leakage polluted subsequent render calls, triggering Angelica's strict state validation during post-render checks.
The fix replaces the 4-parameter blend function with the universally compatible 2-parameter version and sanitizes color values to prevent illegal parameters.
This fix was developed with AI assistance due to my limited OpenGL expertise, but it seems to work well.
Reference Error Log:
[Client thread/ERROR]: ########## GL ERROR ##########
[Client thread/ERROR]: @ Post render
[Client thread/ERROR]: 1280: Invalid enum
Test Environment:
GPU: NVIDIA GTX 1650 (Driver 595.79)
Java: 25
Angelica: 2.1.14
NotEnoughItems: 2.8.84-GTNH
lwjgl3ify: 3.0.15
Draconic Evolution: 1.5.19-GTNH