1

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:

  • my shader is loaded into a variable called testSharer;
  • it's loading from files called testVertexShader.glsl; and testFragShader.glsl; and
  • the shaders both start with #version 150 before anything else.

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?

6
  • 1
    I've seen errors like this when the shader file starts with invisible characters (things not visible in an editor) like a Windows BOM marker Commented Jun 28 at 10:47
  • Hey @ChrisDodd do you know how I could check this? I use sublime text to edit, and I have pycharm set up, is there a way through one of those? Commented Jun 28 at 13:27
  • 1
    See if stackoverflow.com/questions/16195871/… is of any help. Commented Jun 28 at 13:41
  • Doesn't seem to be an encoding error- I feel like it must be to do with how Panda3d compiles shaders by now. Still digging through the docs! Commented Jun 28 at 14:22
  • I've found an answer! It seems that panda requires the .vert and .frag file extensions, and won't accept .glsl extensions. It didn't seem to give me any output accordingly, but when I duplicated my files with the correct extensions, the version error isn't outpyt, and I can now apply the shader to the scene and camera (though some of the ursina entities seem less willing to be shaded)! Commented Jun 28 at 15:00

1 Answer 1

1

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!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.