Search code examples
openglglslshaderfragment-shadervertex-shader

enable/disable frag & vert shaders


Currently I'm using

glUseProgramObjectARB(ProgramObject);

and

glUseProgramObjectARB(0);

But it doesn't switch back properly,and gives me an “invalid operation glError” along these lines

void updateAnim_withShader()
{
    int location;

    location = getUniLoc(ProgramObject, "currentTime"); 
    ParticleTime += 0.002f;

    if (ParticleTime > 15.0)
        ParticleTime = 0.0;

    glUniform1fARB(location, ParticleTime);
    printOpenGLError();
}

What's the proper/right way of doing it(enable/disable shaders)?

[my code files(Temporary link removed )][1]


Solution

  • Your location is -1, because the actual currentTime uniform was not used in a shader.