GLSL on Panda 1.7.2 problem


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:
with open('simple.frag', 'r') as f:

and it works, so shaders and driver seem to be ok.

Shaders are just the simplest possible.

void main()
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;


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):
        self.accept("escape", sys.exit)
        node = self.loader.loadModel('smiley')
        shader = Shader.load(Shader.SLGLSL, 'simple.vert', 'simple.frag')
        base.disableMouse(), -10, 0)
app = TestApp()

Does anyone tried to use GLSL on Panda 1.7.2? Am I doing something wrong, can I try something more?

Welcome to the forums!

Hmm, that’s odd. Can you file this as a bug report?

Thanks for replay, I hoped for more solution like answer :frowning:
Anyway, I filed a bug.

I was frustrated after all try & fail yesterday and forgot to mention that I like Panda engine. For its simplicity in use and things that are just where they should be. Great work :slight_smile:

For anyone who has the same problem, I think this is the same as in this thread. The changes proposed by drwr are not included in Panda 1.7.2, but are on later CVS revisions. So the solution is to compile Panda with the change or get newest snapshot.

I successfully run my simple testing script on build 2011.11.07 :slight_smile:

That’s interesting, though, because there was a different change to the 1.7.x branch that should have also fixed that problem. But perhaps something went wrong with that fix between 1.7.0 (when it was introduced) and 1.7.2, or perhaps it didn’t reach all of the possible codepaths for some reason.

Well, I’m glad to hear that it’s fixed on the trunk. :slight_smile:


Oops! My fault, sorry about that. Looks like I accidentally moved the branch tag right over your commit.