Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualmhagain

Posted 04 March 2013 - 12:24 PM

You can e.g. compile the same vertex shader 3 times and link it to 3 different fragment shaders to make 3 different program objects, and all of this can be done once-only at startup, meaning that calls to glLinkProgram at runtime are unnecessary (just make the appropriate glUseProgram call instead).  Also look at GL_ARB_separate_shader_objects (standard in GL4.1+) for another method of doing this.

 

In relation to the latter, it's worth noting that GLSL's concept of a vertex shader and fragment shader linked into a "program object" is an artificial API construct that's actually at variance with how the underlying hardware really works, and that GLSL is very much the odd-one-out in having this concept; neither the older GL ARB assembly programs nor D3D shaders have it, and this isn't a problem at all outside of GLSL (pre 4.1).


#1mhagain

Posted 04 March 2013 - 12:21 PM

You can e.g. compile the same vertex shader 3 times and link it to 3 different fragment shaders to make 3 different program objects, and all of this can be done once-only at startup, meaning that calls to glLinkProgram at runtime are unnecessary.  Also look at GL_ARB_separate_shader_objects (standard in GL4.1+) for another method of doing this.

 

In relation to the latter, it's worth noting that GLSL's concept of a vertex shader and fragment shader linked into a "program object" is an artificial API construct that's actually at variance with how the underlying hardware really works, and that GLSL is very much the odd-one-out in having this concept; neither the older GL ARB assembly programs nor D3D shaders have it, and this isn't a problem at all outside of GLSL (pre 4.1).


PARTNERS