[Python] Unexpected "does not contain #version" error adding basic shader to Ursina/Panda3D...

Discussão em 'Python' iniciado por Stack, Julho 14, 2025.

  1. Stack

    Stack Membro Participativo

    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?

    Continue reading...

Compartilhe esta Página