Skip to content

Instantly share code, notes, and snippets.

@rectalogic
Created April 30, 2012 16:21
Show Gist options
  • Save rectalogic/2559736 to your computer and use it in GitHub Desktop.
Save rectalogic/2559736 to your computer and use it in GitHub Desktop.
Panda3D GLSL
from panda3d.core import *
from direct.showbase.ShowBase import ShowBase
vshader = """
void main() {
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
"""
fshader = """
void main() {
gl_FragColor = vec4(1.0, 0.5, 1.0, 1.0);
}
"""
class Game(ShowBase):
def __init__(self):
"""Get the game ready to play."""
ShowBase.__init__(self)
self.model = self.loader.loadModel('smiley')
self.model.reparentTo(render)
self.shader = Shader.make(Shader.SLGLSL, vshader, fshader)
self.model.setShader(self.shader)
self.cam.setPos(0, -10, 0)
game = Game()
game.run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment