Created
April 30, 2012 16:21
-
-
Save rectalogic/2559736 to your computer and use it in GitHub Desktop.
Panda3D GLSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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