3

I have freshly installed ursina in a virtual environment. I am trying to set up a basic scene with some lighting:

from ursina import *

class Pivot(Entity):
    def update(self):
        self.rotation_y += time.dt * 30

def show():
    app = Ursina(development_mode=True)
    EditorCamera()

    main_light = DirectionalLight()
    main_light.look_at(Vec3(-1, -1, -1))
    main_light.color = color.white

    cube = Entity(model='cube', scale=1)

    camera.parent = Pivot()
    camera.position = (0, 2, -20)
    camera.look_at(Vec3(0, 0, 0))

    app.run()

show()

However, lighting refuses to work (all objects black). Console shows:

application successfully started
:display:gsg:glgsg(error): An error occurred while compiling GLSL vertex shader created-shader:
ERROR: created-shader:1: '' :  version '130' is not supported
:display:gsg:glgsg(error): An error occurred while compiling GLSL fragment shader created-shader:
ERROR: created-shader:2: '' :  version '140' is not supported

I am on MacOS, M3 Pro.

Any tips on how to fix?

1 Answer 1

0

This happens because Ursina (through Panda3D) is trying to use an OpenGL shader version your Mac’s default OpenGL context doesn’t support. macOS’ OpenGL implementation is stuck at version 4.1 (GLSL 410), but Panda3D sometimes requests an older version (130/140) which Metal-based drivers on Apple Silicon don’t like.

You can fix this by forcing Panda3D to use a compatible OpenGL version. Before creating the Ursina() instance, add this:

from panda3d.core import loadPrcFileData
loadPrcFileData('', 'gl-version 3 3')

So your code should start like this:

from panda3d.core import loadPrcFileData
loadPrcFileData('', 'gl-version 3 3')

from ursina import *

class Pivot(Entity):
    def update(self):
        self.rotation_y += time.dt * 30

def show():
    app = Ursina(development_mode=True)
    EditorCamera()

    main_light = DirectionalLight()
    main_light.look_at(Vec3(-1, -1, -1))
    main_light.color = color.white

    cube = Entity(model='cube', scale=1)

    camera.parent = Pivot()
    camera.position = (0, 2, -20)
    camera.look_at(Vec3(0, 0, 0))

    app.run()

show()

If that doesn’t work, try also setting:

loadPrcFileData('', 'gl-check-errors #f')
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.