Jump to content
  • Advertisement
Sign in to follow this  
BloodLust666

Small test shader not working

This topic is 3888 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?  

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!