Here's what my Irrlicht side shader code looks like:
Code: Select all
virtual void OnSetConstants(video::IMaterialRendererServices* Services, s32 UserData)
{
IVideoDriver* IrrDriver = Services->getVideoDriver();
matrix4 ModelMatrix = IrrDriver->getTransform(video::ETS_WORLD);
Services->setVertexShaderConstant("M", ModelMatrix.pointer(), 16);
matrix4 ViewMatrix = IrrDriver->getTransform(video::ETS_VIEW);
Services->setVertexShaderConstant("V", ViewMatrix.pointer(), 16);
matrix4 ProjectionMatrix = IrrDriver->getTransform(video::ETS_PROJECTION);
Services->setVertexShaderConstant("P", ProjectionMatrix.pointer(), 16);
}
Code: Select all
out vec4 ColorTest;
uniform mat4 M;
uniform mat4 V;
uniform mat4 P;
void main()
{
mat4 MV = V * M;
mat4 MVP = P * MV;
gl_Position = MVP * gl_Vertex;
ColorTest = vec4(gl_Position.x, gl_Position.y, gl_Position.z, 255);
}
Code: Select all
in vec4 ColorTest;
void main()
{
gl_FragColor = ColorTest;
}
I'm thankful for any help as shaders are very confusing, hard to debug and the tutorials out there aren't too fantastic