Small test shader not working

Started by
2 comments, last by BloodLust666 16 years, 2 months ago
I finally read all about shaders and incorporated them into my engine! :) I wrote a very small shader that make a very noticeable effect to test to see if it's working and I see no difference... Here's my shader and fragment code vs.txt

void main()
{
   gl_TexCoord[0] = gl_TexCoord;
   gl_Position = ftransform();
}

fs.txt

void main()
{
    vec4 texcolor = texture2D(0, gl_TexCoord[0].st);

    gl_FragColor = texcolor;
    gl_FragColor.a = 0.3;
}

here's code in the engine to set it up.

WShader::cWVertexShader * pVS = WShader::cWVertexShader::Add("vs");
pVS->LoadFromFile("Assets/Shaders/vs.txt",true);
WShader::cWFragmentShader * pFS = WShader::cWFragmentShader::Add("fs");
pFS->LoadFromFile("Assets/Shaders/fs.txt",true);

WShader::cWShaderProgram *pProg = WShader::cWShaderProgram::Add("TestProg");
pProg->AttachShader(pVS);  ////glAttachShader(m_ProgramID, shader->m_ShaderID);
pProg->AttachShader(pFS);  //glAttachShader(m_ProgramID, shader->m_ShaderID);
pProg->Link();  //glLinkProgram(m_ProgramID);
pProg->Use();   //glUseProgram(m_ProgramID);


Each function does whats it expected, no errors, from what I can see (inside the functions i put what it really does in the comment next to it).  Is there maybe some basic thing I'm missing?  

-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
Advertisement
I looked at the logs and slowly figured out the problem, things are working now and it looks great! hah well, not great, but it's working!

One thing I noticed is I do stuff with the texture matrix, how do I apply that stuff in the shader as well with the texture matrix? I need to do some matrixmults and whatnot, but could someone help me out?
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML
you need to multiply the texture coordinates by the texture matrix.
BEAUTIFUL. thanks! :)
-------------------------Unless specified otherwise, my questions pertain:Windows Platform (with the mindset to keep things multi-platform as possible)C++Visual Studio 2008OpenGL with SFML

This topic is closed to new replies.

Advertisement