gl_TextureMatrix doesn't exist

I'm trying to make my first shader following this tutorial, and I want to add Distant Horizons support According to the video and the iris docs DH uses gl_MultiTexCoord2, which according to the video, requires gl_TextureMatrix[2]. However, according to minecraft, that doesn't exist, as it gives me this error:
dh_terrain.vsh: dh_terrain.vsh: ERROR: 0:61: 'gl_TextureMatrix' : undeclared identifier
ERROR: 0:61: 'gl_TextureMatrix' : left of '[' is not of type array, matrix, or vector
dh_terrain.vsh: dh_terrain.vsh: ERROR: 0:61: 'gl_TextureMatrix' : undeclared identifier
ERROR: 0:61: 'gl_TextureMatrix' : left of '[' is not of type array, matrix, or vector
please help me I have no idea what I'm doing
Samuel Gerkin
YouTube
I coded a Minecraft Shader with Distant Horizons - Code Your Own Sh...
Support future videos! :) https://buymeacoffee.com/samuelgerkin Learn from the ground up how to code a Minecraft shader with GLSL! Or just come along for the ride to see what goes into reimagining Minecraft's visuals! Theme Song โ€œSam with a Planโ€ by Hunter Gerkin https://huntergerkin.bandcamp.com Other music courtesy of Mojang Studios Th...
GitHub
ShaderDoc/dh-support.md at master ยท IrisShaders/ShaderDoc
Documentation of Minecraft shaders. Contribute to IrisShaders/ShaderDoc development by creating an account on GitHub.
Solution:
There is no gl_TextureMatrix[2], as such, you should use gl_TextureMatrix[1] * gl_MultiTexCoord1 instead. See the pinned comment in that same video you linked for the errata.
Jump to solution
4 Replies
๐ŸŒธ lemunhed ๐ŸŒธ
in case you're curious, this is the vertex shader that breaks:
#version 460 compatibility

// out vec2 texCoord;
out vec4 blockColor;
out vec2 lightMapCoords;

void main() {

blockColor = gl_Color;
lightMapCoords = (gl_TextureMatrix[2] * gl_MultiTexCoord2).xy;

gl_Position = ftransform();
}
#version 460 compatibility

// out vec2 texCoord;
out vec4 blockColor;
out vec2 lightMapCoords;

void main() {

blockColor = gl_Color;
lightMapCoords = (gl_TextureMatrix[2] * gl_MultiTexCoord2).xy;

gl_Position = ftransform();
}
Samalando (ping on please)
You should probably ask in the shaderlabs server https://discord.gg/RpzWN9S
Solution
hardester
hardesterโ€ข3mo ago
There is no gl_TextureMatrix[2], as such, you should use gl_TextureMatrix[1] * gl_MultiTexCoord1 instead. See the pinned comment in that same video you linked for the errata.
๐ŸŒธ lemunhed ๐ŸŒธ
It worked thank you so much

Did you find this page helpful?