opengl - Can't get subroutine info for specified shader type -
i using separated shader objects programs , trying integrate subroutines.
i acquire subroutine indices using glgetsubroutineindex() .then set current subroutine :
gluniformsubroutinesuiv(gl_fragment_shader,1,&( _subrotines.find(method)->second));
i getting following opengl error message:
"id:1282 , severity:high , message: gl_invalid_operation error generated.could note subroutine info specified shader type. "
here how define subroutines in fragment shader:
subroutine vec4 rendermode(); subroutine uniform rendermode rendermode; subroutine (rendermode) vec4 lightsmode(){ // returns color } subroutine (rendermode) vec4 colormode(){ // returns color } void main(void){ vec4 fragout =rendermode(); output= fragout; }
it did work ok when used regular shader programs doesn't seem work separate.
you need have shader program in use before selecting subroutine gluniformsubroutinesuiv()
. steps be:
gluseprogram(program); gluniformsubroutinesuiv(...); gluseprogram(0);
keep in mind unusing program reset subroutine selection. have call gluniformsubroutinesuiv()
again.
Comments
Post a Comment