Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mathematics for Game Programming and Computer Graphics

You're reading from   Mathematics for Game Programming and Computer Graphics Explore the essential mathematics for creating, rendering, and manipulating 3D virtual environments

Arrow left icon
Product type Paperback
Published in Nov 2022
Publisher Packt
ISBN-13 9781801077330
Length 444 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Penny de Byl Penny de Byl
Author Profile Icon Penny de Byl
Penny de Byl
Arrow right icon
View More author details
Toc

Table of Contents (26) Chapters Close

Preface 1. Part 1 – Essential Tools
2. Chapter 1: Hello Graphics Window: You’re On Your Way FREE CHAPTER 3. Chapter 2: Let’s Start Drawing 4. Chapter 3: Line Plotting Pixel by Pixel 5. Chapter 4: Graphics and Game Engine Components 6. Chapter 5: Let’s Light It Up! 7. Chapter 6: Updating and Drawing the Graphics Environment 8. Chapter 7: Interactions with the Keyboard and Mouse for Dynamic Graphics Programs 9. Part 2 – Essential Trigonometry
10. Chapter 8: Reviewing Our Knowledge of Triangles 11. Chapter 9: Practicing Vector Essentials 12. Chapter 10: Getting Acquainted with Lines, Rays, and Normals 13. Chapter 11: Manipulating the Light and Texture of Triangles 14. Part 3 – Essential Transformations
15. Chapter 12: Mastering Affine Transformations 16. Chapter 13: Understanding the Importance of Matrices 17. Chapter 14: Working with Coordinate Spaces 18. Chapter 15: Navigating the View Space 19. Chapter 16: Rotating with Quaternions 20. Part 4 – Essential Rendering Techniques
21. Chapter 17: Vertex and Fragment Shading 22. Chapter 18: Customizing the Render Pipeline 23. Chapter 19: Rendering Visual Realism Like a Pro 24. Index 25. Other Books You May Enjoy

Getting Started with Python, PyCharm, and Pygame

In this section, we will go through the process of setting up PyCharm and rendering a graphics window on the screen. To do this, follow these steps:

  1. Open PyCharm. The first window will appear as shown in Figure 1.2.
Figure 1.2: The opening PyCharm screen on an Apple Mac (the screen on other platforms will look similar but not the same)

Figure 1.2: The opening PyCharm screen on an Apple Mac (the screen on other platforms will look similar but not the same)

You may want to take some time to look at the Customize section. This will allow you to set up colors, fonts, and other visual components. There are also many different settings and customizations you can make within PyCharm, and if you ever want to explore these, then we recommend a visit to the manual at www.jetbrains.com/help/PyCharm/quick-start-guide.html.

  1. Next, select the New Project button on the Projects page of the startup window. A window like what is shown in Figure 1.3 will appear.
Figure 1.3: PyCharm’s New Project window and settings

Figure 1.3: PyCharm’s New Project window and settings

  1. Next, we need to set up our new project as follows:
    1. For Location (1), create a new folder for your files. Unlike a single source file such as what you might get with a Word document, a Python project can consist of many files. Therefore, instead of specifying a single file name, you must specify a folder. Call it Mathematics.
    2. In the field for Base interpreter (2), ensure that you select the version of Python that you downloaded and installed. It’s possible to have more than one version of Python installed on your machine. This is useful if you are working on different projects for clients as you can set the version when you create a new project.
    3. When you first open the New Project window, the Create a main.py welcome script tickbox (3) will be ticked. We don’t require a default main.py script and therefore you should untick it.
  2. Once the project settings have been entered, click on the Create button.
  3. As shown in Figure 1.4, after PyCharm opens the new project window, it will display a column on the left with the folder structure (1). By clicking on Python Packages at the bottom of the window (2), a new section will be revealed where you can search and install packages. In the search section (3), type Pygame. This will bring up a list of packages below the search area. Select the one at the top that says Pygame, and then on the right, click the Install button (4). Once Pygame has been installed, you can close the packages section (5).
Figure 1.4: The PyCharm interface and package installation window

Figure 1.4: The PyCharm interface and package installation window

Python, PyCharm, and Pygame are now set up, and you are ready to create your first graphics window.

For those new to Python

If you are new to Python but not programming, it is a straightforward language to pick up. To get up to speed quickly, any newbies are encouraged to read over the beginner’s documentation at https://wiki.python.org/moin/BeginnersGuide.

You have been reading a chapter from
Mathematics for Game Programming and Computer Graphics
Published in: Nov 2022
Publisher: Packt
ISBN-13: 9781801077330
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime