pythonglslshaderursinapanda3d

Unexpected "does not contain #version" error adding basic shader to Ursina/Panda3D


My game project is built in Ursina, which is just Panda3D under the hood with some convenience functions.

I've tried adding a basic glsl vertex and fragment shader to a test file I have, and every time I run it outputs:

:shader(warning): GLSL shader created-shader does not contain a #version line!

I'm confused by this because:

Here's how I load the shaders:

from ursina import *
import numpy as np
WINDOW_WIDTH, WINDOW_HEIGHT = 1080, 600
app = Ursina(size=(WINDOW_WIDTH,WINDOW_HEIGHT))
window.vsync = False
window.title = "BONDING POTENTIAL TEST"
window.borderless = False
window.fullscreen = False
window.fps_counter.enabled = True
window.exit_button.enabled = False
window.color = color.black
EditorCamera()
sky = Sky()
pivot = Entity()
DirectionalLight(parent=pivot, y=1.5, z=3, shadows=True, rotation=(65, -15, 45))
selectView = True
testShader = Shader(Shader.GLSL, vertex="testVertexShader.glsl", fragment="testFragShader.glsl")
firstAtom = Entity(model='sphere', scale=1., world_position=np.array([1,-10,35]), color=color.red, shader=testShader)
secondAtom = Entity(model='sphere', scale=1., world_position=np.array([34,-10,15]), color=color.blue, shader=testShader)

Can anyone give me any clues what to change or add to overcome the "does not contain #version line" error?


Solution

  • It seems that Panda3D requires the .vert and .frag file extensions, and won't accept .glsl extensions.

    It didn't seem to give me any output to warn me of this or ask me to do this, but when I duplicated my files and changed the extensions, it no longer spits out this version error, and I can now apply the shader to the scene and camera!