Hi,
I can’t make GLSL shaders working in python. I got the error:
:display:gsg:glgsg(error): An error occurred while compiling shader!
(0) : error C0000: syntax error, unexpected $end at token "<EOF>"
I tried to change EOL to unix and windows, change encoding of shaders and python to ANSI and UTF-8. Only ‘$end’ and ‘’ changes to undefined or some other chars.
I am on Windows XP 32bit with NVidia 9500 video card. I have newest drivers.
It looks similar to this problem but that should be fixed.
Cg shaders are working but I’d rather stick with GLSL.
Also, I tried to use pyOpenGL like in this post, just getting shaders source with this:
with open('simple.vert', 'r') as f:
VSHADER = f.read()
with open('simple.frag', 'r') as f:
FSHADER = f.read()
and it works, so shaders and driver seem to be ok.
Shaders are just the simplest possible.
Vertex:
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
Fragment:
void main()
{
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
Here is python script:
import sys
from direct.showbase.ShowBase import ShowBase
from panda3d.core import Shader
class TestApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.accept("escape", sys.exit)
node = self.loader.loadModel('smiley')
node.reparentTo(self.render)
shader = Shader.load(Shader.SLGLSL, 'simple.vert', 'simple.frag')
node.setShader(shader)
base.disableMouse()
self.camera.setPos(0, -10, 0)
app = TestApp()
app.run()
Does anyone tried to use GLSL on Panda 1.7.2? Am I doing something wrong, can I try something more?