• Home
  • Textbooks
  • Mathematics for Game Programming and Computer Graphics: Explore the essential mathematics for creating, rendering, and manipulating 3D virtual environments
  • Graphics and Game Engine Components

Mathematics for Game Programming and Computer Graphics: Explore the essential mathematics for creating, rendering, and manipulating 3D virtual environments

Penny de Byl

Chapter 4

Graphics and Game Engine Components - all with Video Answers

Educators


Section 1

Exploring the OpenGL Graphics Pipeline

Problem 1

In PyCharm, go to the Python Packages window and install PyOpenGL (in the same way we installed Pygame). The correct package to install is shown in Figure 4.3:
(Figure can't copy)

Check back soon!

Problem 2

Create a new Python file called OpenGLStarter.py and add the following code to it:
import pygame
from pygame.locals import *
from OpenGL.GL import *
pygame.init()
screen_width = 500
screen_height = 500
screen = pygame.display.set_mode((screen_width,
screen_height),
DOUBLEBUF|OPENGL)
pygame.display.set_caption('OpenGL in Python')
done = False
white = pygame.Color(255, 255, 255)
while not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
pygame.display.flip()
pygame.quit()

Check back soon!