def __init__(self, path, tipo, compile=False, formatlist=None):
"""Constructor"""
if tipo == FRAGMENT or tipo == VERTEX:
self.shader = None
self.file = str(self.load(path))
self.tipo = tipo
self.path = path
self.compiled = False
if formatlist is not None:
if isinstance(formatlist, types.ListType):
num = 0
for f in formatlist:
key = '{' + str(num) + '}'
if key in self.file:
self.file = self.file.replace(key, str(f))
num += 1
else:
raise Exception("el tipo de formatlist debe ser del tipo list")
else:
raise Exception("tipo de shader incorrecto, debe ser FRAGMENT o VERTEX")
if compile:
self.compile()
评论列表
文章目录