I know this is basic, but I have tried several code examples from the forum, and can't figure out what I am doing wrong. I have a skeletal mesh on which I want to apply a custom material handled by glsl. Right now I am trying a very basic glsl program to make sure that everything is okay, but all I get is a black mesh! What am i doing wrong?
My graphics card has opengl 4.4, graphics card: GeForce GTX 745 (If that matters). Here are my code snippets:
XRay.vert:
Code: Select all
#version 400
/* Vertex Shader */
uniform mat4 worldViewProjMatrix;
in vec4 vertex;
void main()
{
gl_Position = worldViewProjMatrix *vertex;
}
XRay,frag:
Code: Select all
#version 400
/* Fragment Shader */
out vec4 pPixel;
void main()
{
pPixel = vec4(1.0,0.0,1.0,1.0);
}
XRay.material:
Code: Select all
vertex_program XRayVertexProgram glsl
{
source XRay.vert
}
fragment_program XRayFragmentProgram glsl
{
source XRay.frag
}
// This is a comment
material XRay
{
// first, preferred technique
technique
{
// first pass
pass
{
lighting on
ambient 0.5 0.3 0.5 1.0
vertex_program_ref XRayVertexProgram
{
param_named_auto worldViewProjMatrix worldviewproj_matrix
}
fragment_program_ref XRayFragmentProgram
{
}
}
}
}
All that I get from the log file is this:
Code: Select all
GLSL compiling: XRayVertexProgram
15:52:59: GLSL compiled:
15:52:59: Vertex Program:XRayVertexProgram GLSL link result :
15:52:59: Font SdkTrays/Caption using texture size 512x256
Thanks!