How to do it...

Create the following 3dWorld.py script:

#!/usr/bin/python3 from __future__ import absolute_import, division from __future__ import print_function, unicode_literals """ An example of generating a 3D environment using a elevation map """ from math import sin, cos, radians import demo import pi3d KEY = {'R':114,'S':115,'T':116,'W':119,'ESC':27,'NONE':-1} DISPLAY = pi3d.Display.create(x=50, y=50) #capture mouse and key presses mykeys = pi3d.Keyboard() mymouse = pi3d.Mouse(restrict = False) mymouse.start() def limit(value,min,max): if (value < min): value = min elif (value > max): value = max return value def main(): CAMERA = pi3d.Camera.instance() tex = pi3d.Texture("textures/grass.jpg") flatsh = pi3d.Shader("uv_flat") # Create ...

Get Raspberry Pi 3 Cookbook for Python Programmers - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.