本文整理汇总了Python中program.Program.attach方法的典型用法代码示例。如果您正苦于以下问题:Python Program.attach方法的具体用法?Python Program.attach怎么用?Python Program.attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类program.Program
的用法示例。
在下文中一共展示了Program.attach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_attach
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import attach [as 别名]
def test_attach(self):
vert = VertexShader("A")
frag = FragmentShader("B")
program = Program(vert)
program.attach(frag)
assert len(program.shaders) == 2
assert program.shaders[0].code == "A"
assert program.shaders[1].code == "B"
示例2: main
# 需要导入模块: from program import Program [as 别名]
# 或者: from program.Program import attach [as 别名]
fragment = """
#version 120
uniform vec4 color;
void main()
{
gl_FragColor = color;
}
"""
# No GL context required
# ----------------------
program = Program(vertex, fragment)
frag = FragmentShader("uniform int dummy;")
print("Attaching shader")
program.attach(frag)
print("Dettaching shader")
program.detach(frag)
print("Uniforms: %s" % program.all_uniforms)
print("Attributes: %s" % program.all_attributes)
print("Shaders: %s" % program.shaders)
print("Program status: %s" % ("dirty (needs new build) " if program.dirty else "clean"))
print("Setting color")
program["color"] = 1, 1, 1, 1
# This should raise a ProgramException
# print("Setting unknown variable")
# program['position'] = 1,1,1,1