i tried the example from the manual and another examples from the forum
the console says that “vertex shader was successfully compiled to run on hardware”
but the object that i apply the shader to disappears
i’m using panda 1.8
win7_x64 & linux_x64
ATI HD 4810 with Catalyst 11.8
main.py
import sys
from panda3d.core import Shader
import direct.directbase.DirectStart
base.setBackgroundColor(0.0, 0.0, 0.0)
base.disableMouse()
base.camLens.setNearFar(1.0, 50.0)
base.camLens.setFov(45.0)
camera.setPos(0.0, -20.0, 10.0)
camera.lookAt(0.0, 0.0, 0.0)
root = render.attachNewNode("Root")
modelCube = loader.loadModel("cube.egg")
cubes = []
for x in [-3.0, 0.0, 3.0]:
cube = modelCube.copyTo(root)
cube.setPos(x, 0.0, 0.0)
cubes += [ cube ]
shader = Shader.load(Shader.SLGLSL, "v.glsl", "f.glsl")
root.setShader(shader)
base.accept("escape", sys.exit)
base.accept("o", base.oobe)
def move(x, y, z):
root.setX(root.getX() + x)
root.setY(root.getY() + y)
root.setZ(root.getZ() + z)
base.accept("d", move, [1.0, 0.0, 0.0])
base.accept("a", move, [-1.0, 0.0, 0.0])
base.accept("w", move, [0.0, 1.0, 0.0])
base.accept("s", move, [0.0, -1.0, 0.0])
base.accept("e", move, [0.0, 0.0, 1.0])
base.accept("q", move, [0.0, 0.0, -1.0])
run()
v.glsl
//SLGL
void main() {
gl_Position = ftransform();
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
f.glsl
//SLGL
void main() {
gl_FragColor = vec4(gl_Color.g, gl_Color.r, gl_Color.b, 1.0);
}