From 12c48a02ad73bb1056a01f920e00d7bc813793e1 Mon Sep 17 00:00:00 2001 From: JuiceyDev Date: Fri, 6 Mar 2026 21:43:31 +0100 Subject: [PATCH] fix: use standard OpenGL constants on Linux to fix invisible terrain --- 4J.Render/4J_Render.h | 18 +++++++++--------- Minecraft.Client/Rendering/Chunk.cpp | 4 ++-- Minecraft.Client/Rendering/GameRenderer.cpp | 2 +- Minecraft.Client/Textures/Texture.cpp | 2 +- Minecraft.Client/Textures/Textures.cpp | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/4J.Render/4J_Render.h b/4J.Render/4J_Render.h index 63bfb3471..5f0ab504e 100644 --- a/4J.Render/4J_Render.h +++ b/4J.Render/4J_Render.h @@ -244,15 +244,15 @@ const int GL_EYE_PLANE = 1; // These things are used by glEnable/glDisable so must be different and non-zero (zero is used by things we haven't assigned yet) -const int GL_TEXTURE_2D = 1; -const int GL_BLEND = 2; -const int GL_CULL_FACE = 3; -const int GL_ALPHA_TEST = 4; -const int GL_DEPTH_TEST = 5; -const int GL_FOG = 6; -const int GL_LIGHTING = 7; -const int GL_LIGHT0 = 8; -const int GL_LIGHT1 = 9; +const int GL_TEXTURE_2D = 0x0DE1; +const int GL_BLEND = 0x0BE2; +const int GL_CULL_FACE = 0x0B44; +const int GL_ALPHA_TEST = 0x0BC0; +const int GL_DEPTH_TEST = 0x0B71; +const int GL_FOG = 0x0B60; +const int GL_LIGHTING = 0x0B50; +const int GL_LIGHT0 = 0x4000; +const int GL_LIGHT1 = 0x4001; const int CLEAR_DEPTH_FLAG = 1; const int CLEAR_COLOUR_FLAG = 2; diff --git a/Minecraft.Client/Rendering/Chunk.cpp b/Minecraft.Client/Rendering/Chunk.cpp index 50ed969e4..79f9dae6f 100644 --- a/Minecraft.Client/Rendering/Chunk.cpp +++ b/Minecraft.Client/Rendering/Chunk.cpp @@ -385,7 +385,7 @@ void Chunk::rebuild() MemSect(0); glPushMatrix(); glDepthMask(true); // 4J added - t->useCompactVertices(false); // 4J added + t->useCompactVertices(true); // 4J added translateToPos(); float ss = 1.000001f; // 4J - have removed this scale as I don't think we should need it, and have now optimised the vertex @@ -704,7 +704,7 @@ void Chunk::rebuild_SPU() MemSect(0); glPushMatrix(); glDepthMask(true); // 4J added - t->useCompactVertices(false); // 4J added + t->useCompactVertices(true); // 4J added translateToPos(); float ss = 1.000001f; // 4J - have removed this scale as I don't think we should need it, and have now optimised the vertex diff --git a/Minecraft.Client/Rendering/GameRenderer.cpp b/Minecraft.Client/Rendering/GameRenderer.cpp index edc77f536..b97a94cb6 100644 --- a/Minecraft.Client/Rendering/GameRenderer.cpp +++ b/Minecraft.Client/Rendering/GameRenderer.cpp @@ -1428,7 +1428,7 @@ void GameRenderer::renderLevel(float a, __int64 until) // 4J - have changed this fancy rendering option to work with our command buffers. The original used to use frame buffer flags to disable // writing to colour when doing the z-only pass, but that value gets obliterated by our command buffers. Using alpha blend function instead // to achieve the same effect. - if (false) // (mc->options->fancyGraphics) + if (true) // (mc->options->fancyGraphics) { if (mc->options->ambientOcclusion) { diff --git a/Minecraft.Client/Textures/Texture.cpp b/Minecraft.Client/Textures/Texture.cpp index 6be70c7d2..ce1a85b74 100644 --- a/Minecraft.Client/Textures/Texture.cpp +++ b/Minecraft.Client/Textures/Texture.cpp @@ -568,7 +568,7 @@ void Texture::transferFromImage(BufferedImage *image) #ifdef _XBOX int byteRemapRGBA[] = { 0, 1, 2, 3 }; #else - int byteRemapRGBA[] = { 0, 1, 2, 3 }; + int byteRemapRGBA[] = { 3, 0, 1, 2 }; #endif int byteRemapBGRA[] = { 3, 2, 1, 0 }; // #endif diff --git a/Minecraft.Client/Textures/Textures.cpp b/Minecraft.Client/Textures/Textures.cpp index 63a5a5fa4..07af71b56 100644 --- a/Minecraft.Client/Textures/Textures.cpp +++ b/Minecraft.Client/Textures/Textures.cpp @@ -611,7 +611,7 @@ void Textures::loadTexture(BufferedImage *img, int id, bool blur, bool clamp) // Swap ARGB to RGBA for( int i = 0; i < ww * hh ; i++ ) { - tempData[i] = ( tempData[i] << 8 ) | ( ( tempData[i] >> 24 ) & 0xff ); + tempData[i] = ( tempData[i] >> 24 ) | (tempData[i] << 8 ); } #endif }