Return value about glAttachShader

Hi,
i am a fresh man about opengles. I have a question about the return of glAttachShader().
According to spec:
GL_INVALID_VALUE is generated if either program or shader is not a value generated by OpenGL.
GL_INVALID_OPERATION is generated if program is not a program object.

i don’t understand the difference between the two return value.
Here is a piece of code from ogles2conform:

GLuint buf[2];
GTFbool success = GTFtrue;
GLint i;

// There are tests that leak programs/shaders so we have to find a number that is not a program/shader
for(i=1; i<0x7fffffff; ++i)
{
    GLboolean isObject;
    isObject = glIsProgram(i) || glIsShader(i);
    if (!isObject)
    {
        break;
    }
}
buf[0] = i;

for(i=i+1; i<0x7fffffff; ++i)
{
    GLboolean isObject;
    isObject = glIsProgram(i) || glIsShader(i);
    if (!isObject)
    {
        break;
    }
}
buf[1] = i;

glAttachShader(buf[0], buf[1]);

if (glGetError() != GL_INVALID_VALUE)
{
GTFLogLogErrorMessage(GTFLogGetSingleton(),“GTFTestCoverageGL::CallAttachShader”, “glAttachShader : did not return GL_INVALID_VALUE”);
success = GTFfalse;
}

why the return value must be GL_INVALID_VALUE? buf[0] and buf[1] is neither program object nor shader object, why can not return GL_INVALID_OPERATION?
can anyone help me with it?

Thanks a lot~

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.