PyGfx cube exampleΒΆ
Note that this example depends on pygfx (``pip install -U pygfx``).
An example showing a lit, textured, rotating cube.
[1]:
import pygfx as gfx
cube = gfx.Mesh(
gfx.box_geometry(200, 200, 200),
gfx.MeshPhongMaterial(color="#336699"),
)
def animate():
rot = gfx.linalg.Quaternion().set_from_euler(gfx.linalg.Euler(0.005, 0.01))
cube.rotation.multiply(rot)
disp = gfx.Display()
disp.before_render = animate
disp.show(cube)
snapshot
[ ]: