def attributeLocation(self, name): #bruce 090302 renamed from self.attribute() """ Return location of an attribute (per-vertex input) shader variable. If it's not found, return -1 and warn once per session for end users, or raise an AssertionError for developers. @see: _has_shader_attribute """ loc = glGetAttribLocationARB(self.progObj, name) if loc == -1: msg = "Invalid or unused attribute variable name '%s'." % name if EndUser.enableDeveloperFeatures(): # Developers want to know of a mismatch between their Python # and shader programs as soon as possible. Not doing so causes # logic errors, or at least incorrect assumptions, to silently # propagate through the code and makes debugging more difficult. assert 0, msg else: # End users on the other hand, may value program stability more. # Just print a warning if the program is released. Do it only # once per session, since this will be in the inner draw loop! global _warnedVars if name not in _warnedVars: print "Warning:", msg _warnedVars += [name] pass pass pass return loc
def attributeLocation(self, name): #bruce 090302 renamed from self.attribute() """ Return location of an attribute (per-vertex input) shader variable. If it's not found, return -1 and warn once per session for end users, or raise an AssertionError for developers. @see: _has_shader_attribute """ loc = glGetAttribLocationARB(self.progObj, name) if loc == -1: msg = "Invalid or unused attribute variable name '%s'." % name if EndUser.enableDeveloperFeatures(): # Developers want to know of a mismatch between their Python # and shader programs as soon as possible. Not doing so causes # logic errors, or at least incorrect assumptions, to silently # propagate through the code and makes debugging more difficult. assert 0, msg else: # End users on the other hand, may value program stability more. # Just print a warning if the program is released. Do it only # once per session, since this will be in the inner draw loop! global _warnedVars if name not in _warnedVars: print "Warning:", msg _warnedVars += [name] pass pass pass return loc
def _has_shader_attribute(self, name): #bruce 090309 [untested, not currently used] """ @return: whether the specified attribute (per-vertex input) shader variable has a location. @rtype: boolean @note: this can differ for different platforms based on the level of optimization done by their implementation of GLSL (if the attribute is allocated but not used by our shaders). @see: attributeLocation """ loc = glGetAttribLocationARB(self.progObj, name) return (loc != -1)
def _has_shader_attribute(self, name): #bruce 090309 [untested, not currently used] """ @return: whether the specified attribute (per-vertex input) shader variable has a location. @rtype: boolean @note: this can differ for different platforms based on the level of optimization done by their implementation of GLSL (if the attribute is allocated but not used by our shaders). @see: attributeLocation """ loc = glGetAttribLocationARB(self.progObj, name) return (loc != -1)