Binding program to 0

From the specs :
BindProgramARB(enum target, uint program);
“If <program> is zero, the default program object for <target> is bound”

what is that default program ? Is it the fixed function, or is there a way to specify a custom one ?


“Default” means fixed function pipeline. You cannot specify your own default program.
I think this expression is quite confusing, too. Maybe they said “default program” instead of ffp, because some hardware does actually use “default” programs instead of a real fixed function pipe (some Radeons do this, i think).


This isn’t exactly true. Binding program object zero won’t get the “default fixed function pipeline”. To do that you’ll have to disable vertex program mode.

Instead, program object zero is basically the same as any other program object. You can specify a program string for it, set program local parameters, etc.

To be fair, this functionality is really more of an artifact from modelling the program object API after texture objects (remember, originally there were no texture objects, so the concept of the “default” texture object was a nice way to provide backward compatability). In almost every circumstance now there’s no reason not to call GenProgams / BindProgram, but if you were really stubborn you could write an app that uses vertex programs and never calls BindProgram!

– Ben

Originally posted by Jan2000:
“Default” means fixed function pipeline.

I am also quite sure it does not work that way. I once forgot to bind (so I guess I got program 0) and I got no output from it. It would have worked if program 0 = fixed pipe.
No, I think this is just to resemble texture objects, I think there’s a note explaining that but I am not sure.

0 is a NULL program, it doesn’t do anything at all (no output).

Program object zero is only a “NULL” program object in the sense that by default it has no program string associated with it, and that most programmers won’t ever specify a valid program string for program object zero. This means that in most typical VP usage models you’ll get an INVALID_OPERATION whenever you try to draw something with program object zero bound.

If you do specify a valid program string for program object zero, however, you can draw something with vertex programs enabled and program object zero bound. You’re also able specify program local parameters for it. In other words, program object zero isn’t different than any other program object.

Like I said before, it’s perfectly legal to write an app that uses vertex programs that never calls BindProgram and only uses the default program object. There aren’t many good reasons to do this so it seems kind of weird, but it’s definitely possible (try it!).

– Ben