Introduction

Learn how to program in 3D computer graphics in the Python programming language!

frustum1

Approach

You’ll learn how to place geometric objects in space, draw them relative to others, add a camera that moves over time based on user input, and transform all those objects into the 2D pixel coordinates of your screen. By the end, you’ll understand the foundations of creating first-person and third-person applications or games. The goal? To empower you to build the graphics programs you want, using math you mostly already know.

This book intentionally keeps things simple intended for beginners. In this book, the applications created won’t be particularly pretty or realistic-looking. After reading this book, for more advanced topics, you’ll want to dive into references LearnOpenGL or the OpenGLTutorial.

  1. LearnOpenGL

  2. OpenGLTutorial

Things You Should Know

  1. Basic programming concepts in Python.

    1. YouTube videos

      1. Learn Python with Socratica

      2. Microsoft Python Tutorials

    2. Books

      1. https://diveintopython3.problemsolving.io/

  2. High school Geometry

Required Software

You will need to install Python, and make a virtual environment. You can search how to do this using a search engine, or AI Chatbot, or follow the instructions below.

Windows

On Windows, install Visual Studio and the Python extension. Afterwards, to set up the virtual environment, open the Developer Command Prompt,

python -m venv venv
cd venv\Scripts
activate.bat
cd ..\..\
python -m pip install --upgrade pip setuptools
python -m pip install -r requirements.txt
python -m pip install -e .[dev]

To run the Spyder Integrated Development Environment (IDE) to execute the code in the book, open Spyder on the Developer Command Prompt

cd venv\Scripts
activate.bat
cd ..\..\
spyder -p .

Linux

Install Python3, glfw via a package manager. Use pip and virtualenv to install dependencies

Mac

Install Python3 (via anaconda, homebrew, macports, whatever), and use pip and virtualenv to install dependencies.

MacOS or Linux

On MacOS or Linux, to set up the environment in a terminal, execute

python3 -m venv venv
source venv/bin/activate
python3 -m pip install --upgrade pip setuptools
python3 -m pip install -r requirements.txt
python3 -m pip install -e .[dev]

To run the Spyder IDE to execute the code in the book, open Spyder on the developer command prompt

source venv/bin/activate
spyder -p .

Source code

This book references source code, which is at https://github.com/billsix/modelviewprojection

This documentation was generated from from commit 849fcdff914480dec0992042c8de6fded179a82e