Hello,
I'm having trouble binding my handlers to my vertex shader, as well as getting to my fragment shader. Not sure if this is the right forum, but I found a lot of OpenGL threads in the search.
I currently have two handlers that are acting up, the handles to my data structure containing all of my normals, and the one that handles my light.
Code:
h_aNormal = safe_glGetAttribLocation(ShadeProg, "aNormal");
h_aLight = safe_glGetAttribLocation(ShadeProg, "aLight");
Those are the calls to set it to values in the shader program, and the safe calls are this helper function:
Code:
inline GLint safe_glGetAttribLocation(const GLuint program, const char varname[]) {
GLint r = glGetAttribLocation(program, varname);
if (r < 0)
std::cerr << "WARN: "<< varname << " cannot be bound (it either doesn't exist or has been optimized away). safe_glAttrib calls will silently ignore it.\n" << std::endl;
return r;
}
The variables inside my vertex shader are declared outside of main() as
Code:
attribute vec3 aLight;
attribute vec3 aNormal;
I feel like that's my main issue, but I'm also not sure if my program ever gets to my fragment shader. Even with the binding errors, it renders a picture, but it's always entirely one color, with no shading done at all, though I'm trying to do a full Phong rendering. In my vertex shader I have a
Code:
varying vec3 vColor;
whose value is set to the value of the color inherited by my color handler before I intend to pass it into my fragment shader.
The reason I think I don't get to my fragment shader is because when I put syntactically incorrect code to intentionally produce error messages, all the errors show up in my vertex shader, but NOT from my fragment shader. How do I know if my fragment shader is ever being run? And yes, I have made sure that the fragment shader is properly installed.
Any help would be appreciated