, . , , -.
, WebGL, ES 2.0 .
ES 2.0 (. 31, UseProgram):
, , , . .
, . : " ". , " " , .
, " ". , UseProgram, , UseProgram. " " :
... UseProgram.
, , , , . .
1
// Build shaders, create program.
AttachShader(prog1, vs1);
AttachShader(prog1, fs1);
LinkProgram(prog1);
UseProgram(prog1);
DetachShader(prog1, vs1);
DetachShader(prog1, fs1);
// Program is still valid, and can continue to be used.
, , , spec, .
2
AttachShader(prog1, vs1);
AttachShader(prog1, fs1);
LinkProgram(prog1);
DetachShader(prog1, vs1);
DetachShader(prog1, fs1);
UseProgram(prog1);
DetachShader. , " " , " ".
3
// Build shaders, create program.
AttachShader(prog1, vs1);
AttachShader(prog1, fs1);
LinkProgram(prog1);
UseProgram(prog1);
DetachShader(prog1, vs1);
DetachShader(prog1, fs1);
// Program is still valid, and can continue to be used.
UseProgram(prog2);
// prog1 is now not "in use" anymore.
...
UseProgram(prog1);
// Is it valid? Probably not.
. prog1 , DetachShader. , , , . , , , .