I am currently doing my first steps regarding basic shader learning using GLSL and Irrlicht. I started with an Irrlicht example which worked great, did some modifications to the shaders, everything worked and I had fun doing this. Now I want to continue by applying and trying out the great lightning examples under https://learnopengl.com/Lighting/Basic-Lighting
The issue for me is that this author seems to use a newer version of GLSL, which is needed for example for the "out" directive. When I also change my shaders to this version then many attributes are deprecated. So I searched on the internet, through the Irrlicht forum etc..., and I updated my shader code to use in/outs. Problem is now, the shaders still compile, but my texture coordinates seem to have a problem, regardless what I do or try.
Does someone have maybe a clue where my problem is? Or does it not work together with Irrlicht 1.8.4 which I use? According to Irrlicht Forum topics I found higher GLSL versions should also work together with Irrlicht. Thank you very much for any help, and please excuse me if this is a very basic question.
My rather simply Vertex and Fragment shader which works:
Code: Select all
uniform mat4 mWorldViewProj;
uniform mat4 mInvWorld;
uniform mat4 mTransWorld;
uniform vec3 mLightPos;
uniform vec4 mLightColor;
void main(void)
{
gl_Position = mWorldViewProj * gl_Vertex;
gl_TexCoord[0] = gl_MultiTexCoord0;
}Code: Select all
uniform sampler2D myTexture;
void main (void)
{
vec4 col = texture2D(myTexture, vec2(gl_TexCoord[0]));
gl_FragColor = col;
}

After updating shader code to newer version:
Code: Select all
#version 420 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTextCoord0;
/*
alternative layout I did find on Irrlicht Forum, which would
make sense according to order of variables in S3DVertex.h struct
but does also not work
layout ( location = 0 ) in vec3 aPos;
layout ( location = 1 ) in vec3 aNormal;
layout ( location = 2 ) in vec4 color;
layout ( location = 3 ) in vec2 aTextCoord0;*/
uniform mat4 mWorldViewProj;
uniform mat4 mInvWorld;
uniform mat4 mTransWorld;
uniform vec3 mLightPos;
uniform vec4 mLightColor;
out vec2 TexCoord;
void main(void)
{
gl_Position = mWorldViewProj * vec4(aPos, 1.0);
TexCoord = aTextCoord0;
}
Code: Select all
#version 420 core
layout(location=0) out vec4 FragColor;
//found this new kind of binding in another Irrlicht Forum Topic,
//but also does not fix the issue, and does not solve the problem
layout(binding = 0) uniform sampler2D ColoredTextureSampler; // texture 0
layout(binding = 2) uniform sampler2D ReflectionMapSampler; // texture 2
in vec2 TexCoord;
void main (void)
{
vec4 col = texture2D(ColoredTextureSampler, TexCoord);
FragColor = col;
}

