Skip to content

Instantly share code, notes, and snippets.

@tobspr
Created December 18, 2016 10:03
Show Gist options
  • Select an option

  • Save tobspr/98cc74fc1646bcc33d100972c669711e to your computer and use it in GitHub Desktop.

Select an option

Save tobspr/98cc74fc1646bcc33d100972c669711e to your computer and use it in GitHub Desktop.
from panda3d.core import *
with open("fancy-shader.vtx.glsl", "w") as handle:
handle.write("""
#version 400
void main() {}
""")
with open("fancy-shader.frag.glsl", "w") as handle:
handle.write("""
#version 400
void main() {}
""")
fancy_shader_a = Shader.load(Shader.SL_GLSL, "fancy-shader.vtx.glsl", "fancy-shader.frag.glsl")
print("Instance A:", fancy_shader_a, "ptr:", fancy_shader_a.this)
fancy_shader_b = Shader.load(Shader.SL_GLSL, "fancy-shader.vtx.glsl", "fancy-shader.frag.glsl")
print("Instance B:", fancy_shader_b, "ptr:", fancy_shader_b.this)
print("Modifying fragment shader")
with open("fancy-shader.vtx.glsl", "a") as handle:
handle.write("// comment\n")
fancy_shader_c = Shader.load(Shader.SL_GLSL, "fancy-shader.vtx.glsl", "fancy-shader.frag.glsl")
print("Instance C:", fancy_shader_c, "ptr:", fancy_shader_c.this)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment