Skip to content

Fix SlicedTexture drawing logic to resolve GL1280 errors#194

Open
NealDeal34 wants to merge 1 commit intoGTNewHorizons:masterfrom
NealDeal34:patch-2
Open

Fix SlicedTexture drawing logic to resolve GL1280 errors#194
NealDeal34 wants to merge 1 commit intoGTNewHorizons:masterfrom
NealDeal34:patch-2

Conversation

@NealDeal34
Copy link
Copy Markdown

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

@NealDeal34 NealDeal34 changed the title Refactor SlicedTexture drawing logic to improve compatibility Fix SlicedTexture drawing logic to resolve GL1280 errors Apr 1, 2026
Copy link
Copy Markdown
Member

@UltraProdigy UltraProdigy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, two minor things

} finally {
GL11.glPopMatrix();
GL11.glPopAttrib();
while (GL11.glGetError() != GL11.GL_NO_ERROR);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should not be included. It's not resolving errors here just erasing the evidence of them

int dx = x;
int dy = y;

GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_ENABLE_BIT);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this is missing GL_CURRENT_BIT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants