Hi
I am trying to make a set of classes to handle shading programs and i'm asked to have support for "User Defined Vertex Attributes". I've read all that i can find but frankly i'm not getting any wiser...
I add a
attribute float fooBar; to my .vert shader, and set it with a function
SetVertexAttrib1fARB(string name, float val);. This function looks like this inside:
void ShadingProgram::SetVertexAttribute1f(std::string name, float f)
{
if(shaderProgram == NULL) return;
glVertexAttrib1fARB(GetAttribLoc(name), f);
}
GetAttribLoc() looks like this:
int ShadingProgram::GetAttribLoc(std::string name)
{
if(shaderProgram == NULL) return -1;
int loc = glGetAttribLocationARB(shaderProgram, name.c_str());
if (loc == -1)
{
std::ostringstream stream;
stream << "No such attribute named \"" << name << "\"";
ErrorLog(stream.str());
}
CheckOpenGLError(); // Check for OpenGL errors
return loc;
}
Now when i run my test application it spams me with "No such attribute named fooBar", and i can't figure out why...
Is there something i have forgotten or missunderstood regarding the VertexAttributes?
[Edited by - Android_s on November 12, 2004 6:11:47 AM]
----------------------------------------------------------------------------------------------------------------------"Ask not what humanity can do for you, ask what you can do for humanity." - By: Richard D. Colbert Jr.