(self)
return vs, fs
Build the vertex and fragment final codes, using the declarations
        of all template variables.
Build the vertex and fragment final codes, using the declarations
        of all template variables.
Build the vertex and fragment final codes using the declarations of all template variables .
def get_shader_codes(self):
        """Build the vertex and fragment final codes, using the declarations
        of all template variables."""
        vs = VS_TEMPLATE
        fs = FS_TEMPLATE
        
        # Shader headers
        vs_header = self.get_header('vertex')
        fs_header = self.get_header('fragment')
        
        # Varyings
        for varying in self.varyings:
            s1, s2 = get_varying_declarations(varying)
            vs_header += s1
            fs_header += s2
        
        # vs_header += "".join(self.vs_headers)
        # fs_header += "".join(self.fs_headers)
        
        # Integrate shader headers
        vs = vs.replace("%VERTEX_HEADER%", vs_header)
        fs = fs.replace("%FRAGMENT_HEADER%", fs_header)
        
        # Vertex and fragment main code
        vs_main = self.get_main('vertex')
        fs_main = self.get_main('fragment')
        
        # Integrate shader headers
        vs = vs.replace("%VERTEX_MAIN%", vs_main)
        fs = fs.replace("%FRAGMENT_MAIN%", fs_main)
        
        # frag color or frag data
        if self.fragdata is None:
            fs = fs.replace('%FRAG%', """gl_FragColor = out_color;""")
        else:
            fs = fs.replace('%FRAG%', """gl_FragData[%d] = out_color;""" % self.fragdata)
        
        # Make sure there are no Windows carriage returns
        vs = vs.replace(b"\r\n", b"\n")
        fs = fs.replace(b"\r\n", b"\n")
        
        # OLDGLSL does not know the texture function
        if not OLDGLSL:
            fs = fs.replace("texture1D(", "texture(" % 2)
            fs = fs.replace("texture2D(", "texture(" % 2)
        
        # set default color
        fs = fs.replace('%DEFAULT_COLOR%', str(self.default_color))
        
        # replace GLSL version header
        vs = vs.replace('%GLSL_VERSION_HEADER%', self.version_header)
        fs = fs.replace('%GLSL_VERSION_HEADER%', self.version_header)
        
        # replace GLSL precision header
        vs = vs.replace('%GLSL_PRECISION_HEADER%', self.precision_header)
        fs = fs.replace('%GLSL_PRECISION_HEADER%', self.precision_header)
    
        return vs, fs
def get_shader_codes ( self ) : vs = VS_TEMPLATE fs = FS_TEMPLATE # Shader headers vs_header = self . get_header ( 'vertex' ) fs_header = self . get_header ( 'fragment' ) # Varyings for varying in self . varyings : s1 , s2 = get_varying_declarations ( varying ) vs_header += s1 fs_header += s2 # vs_header += "".join(self.vs_headers) # fs_header += "".join(self.fs_headers) # Integrate shader headers vs = vs . replace ( "%VERTEX_HEADER%" , vs_header ) fs = fs . replace ( "%FRAGMENT_HEADER%" , fs_header ) # Vertex and fragment main code vs_main = self . get_main ( 'vertex' ) fs_main = self . get_main ( 'fragment' ) # Integrate shader headers vs = vs . replace ( "%VERTEX_MAIN%" , vs_main ) fs = fs . replace ( "%FRAGMENT_MAIN%" , fs_main ) # frag color or frag data if self . fragdata is None : fs = fs . replace ( '%FRAG%' , """gl_FragColor = out_color;""" ) else : fs = fs . replace ( '%FRAG%' , """gl_FragData[%d] = out_color;""" % self . fragdata ) # Make sure there are no Windows carriage returns vs = vs . replace ( b"\r\n" , b"\n" ) fs = fs . replace ( b"\r\n" , b"\n" ) # OLDGLSL does not know the texture function if not OLDGLSL : fs = fs . replace ( "texture1D(" , "texture(" % 2 ) fs = fs . replace ( "texture2D(" , "texture(" % 2 ) # set default color fs = fs . replace ( '%DEFAULT_COLOR%' , str ( self . default_color ) ) # replace GLSL version header vs = vs . replace ( '%GLSL_VERSION_HEADER%' , self . version_header ) fs = fs . replace ( '%GLSL_VERSION_HEADER%' , self . version_header ) # replace GLSL precision header vs = vs . replace ( '%GLSL_PRECISION_HEADER%' , self . precision_header ) fs = fs . replace ( '%GLSL_PRECISION_HEADER%' , self . precision_header ) return vs , fs