Skip to content

Installation Instructions for Computer Graphics Course students

Manos Kamarianakis edited this page Oct 13, 2023 · 4 revisions

Installation

These are the instructions that should be followed to get you started with Elements, as we will use it in the context of a Computer Graphics (CG) course.

⚠️ We strongly recommend using Anaconda for your python environment, as well as Visual Studio Code as your IDE.

OS requirements

The Elements framework has been tested on the following operating systems:

  1. Windows 11
  2. Max OS Monterey-Ventura
  3. Ubuntu 22

Clone the repository

Clone the Elements repository from HERE

SCR-20230920-pccl-2 SCR-20230920-pbsp-2

Checkout to the feature/CG-course branch:

feature1 feature2 feature1

Visual studio code preparation

Download the python extension in your visual studio code

pythonExtension

Open the Elements folder with the visual studio code

Installing Anaconda for python environment handling

We suggest to download the Anaconda package management system to keep your system clean (optional step)

Download the proper Anaconda python distribution based on your system.

For Windows users, make sure you add Anaconda to the PATH environmental variable.

AnacondaPathVariable

Creating a new python 3.8 environment

Open a new command prompt (Ctrl + Shift + `) in visual studio code:

cmd

Create a new elements conda environment with the command:

conda create -n elements python=3.8

This creates a new environment, named elements, with a python version 3.8, which is the proper version to run Elements.

You may now activate the environment by running:

`conda activate elements`

⚠️ For linux users do the following, you need to setup the variable PYOPENGL_PLATFORM to x11:

1. In terminal, run `nano ~/.bashrc`
2. Add the command ‘export PYOPENGL_PLATFORM=x11’ at the end of the file.
3. Save and quit.
4. Run ‘source ~/.bashrc’ for the changes to take effect.

Select the python Interpreter

⚠️ You need to select the proper python interpreter before running any example or test.

Click the python version button on the bottom right and select the elements environment we created.

runExample

If the elements interpreter is not shown, click refresh to update the list.

image

Installing Elements on your environment

Install the needed packages to your elements environment with the following command:

pip install -e .
pipInstall

Your Elements project is now ready!

Run the unit Tests

Runnin the included unit tests assures that your installation is proper and complete.

Click the unit test icon on the left side panel. You may run a test by clicking the run test button.

unitTests

Make sure that all the tests run properly.

If the unit tests are not visible like the image above do the following

  1. Click View>Command Palette

  2. From the menu that will appear click the option: Python: Configure Tests

test1
  1. Click the option: unittest Standard Python test framework
test2
  1. Select the Elements option
test3
  1. Select the test_*.py option
test4

The unit tests will appear in the list on the left panel

Run the examples

Now let's run some Elements examples.

Navigate, e.g., to the Elements/examples/2.Intermediate folder and click the example_9_textures_with_lighting.py example.

Then, press the F5 button to run the example

rotatingCube

The rotating cube should appear!

Contributing to the Elements project

In order to contribute to contribute to the Elements package:

  1. Fork the develop branch.

  2. Clone your forked repo to your computer.

  3. Install it in editable mode by running:

    pip3 install -e .

at the directory where the setup.py file is located.

  1. Create a feature branch from the develop branch, and work on it.
  2. Push your feature branch to your github repo.
  3. Open a Pull Request to the original develop branch.