Commented 8 months ago2024-03-10 00:07:59 UTC
in wiki page: Tutorial: Coding FogComment #106053
@FranticDreamer
That is not true, latest version of HL engine still uses Legacy GL functions but has shader compatibility. The reason why this tutorial doesn't work is that the shaders DON'T know if glEnable(GL_FOG) is run, it just is impossible. To make this tutorial work, theoretically you should replace glEnable(GL_FOG) with something like glUniform1i(glGetUniformLocation(SHADERID, "fogEnabled"), (int)true) but I have ZERO clue on how to find SHADERID atm.
There is also an alternative method, you will have to modify the shader code for your mod though; which should be in "Half-Life/platform/gl_shaders/fs_world.frag". Replace uniform bool fogEnabled with layout(location = 0) uniform bool fogEnabled. Now go back into your code and replace every glEnable(GL_FOG) with glUniform1i(0, (int)true) and obviously replace every glDisable(GL_FOG) with glUniform1i(0, (int)false).
(And yes, I don't know how to reply lol)
That is not true, latest version of HL engine still uses Legacy GL functions but has shader compatibility. The reason why this tutorial doesn't work is that the shaders DON'T know if
glEnable(GL_FOG)
is run, it just is impossible. To make this tutorial work, theoretically you should replaceglEnable(GL_FOG)
with something likeglUniform1i(glGetUniformLocation(SHADERID, "fogEnabled"), (int)true)
but I have ZERO clue on how to find SHADERID atm.There is also an alternative method, you will have to modify the shader code for your mod though; which should be in "Half-Life/platform/gl_shaders/fs_world.frag". Replace
uniform bool fogEnabled
withlayout(location = 0) uniform bool fogEnabled
. Now go back into your code and replace everyglEnable(GL_FOG)
withglUniform1i(0, (int)true)
and obviously replace everyglDisable(GL_FOG)
withglUniform1i(0, (int)false)
.(And yes, I don't know how to reply lol)