CS 1666
www.cs.pitt.edu/~nlf4/cs1666/
CS 1666 www.cs.pitt.edu/~nlf4/cs1666/ Introduction to SDL and 2D - - PowerPoint PPT Presentation
CS 1666 www.cs.pitt.edu/~nlf4/cs1666/ Introduction to SDL and 2D computer graphics Graphics history: Whirlwind/SAGE First real-time computer display 1950's, MIT/US Government development Used as an air defense system into the 1980's
www.cs.pitt.edu/~nlf4/cs1666/
2
3
new/revised list
polygon
4
5
6
7
○ Horizontal pixel count / vertical pixel count ■ E.g.,
○ Pixel width / pixel height ■ At this point in time, almost always 1
8
9
10
11
display?
○ … How much space is needed per pixel?
12
○ Or a single color component of a pixel (i.e., R, G, or B)
○ 256 total colors available ○ Normally 3 bits R, 3 bits G, 2 bits B
○ Up to 65536 colors available ○ Commonly 5R, 6G, 5B
○ 16,777,216 colors available ○ 8R, 8G, 8B ■ 256 options for each channel
○ 1.07 billion+ colors ○ 30/36/48 bits per pixel ■ 10/12/16 bits per color
13
14
61,440 bytes of memory to store ○ 60KiB! ○ The NES only had 2KiB of RAM...
15
entire "frame" of output in memory
○ One buffer used to render the frame ○ Other is presented to the display
16
17
the current image
○ 5R, 5G, 5B, 1 bit for transparent or not
○ 8R, 8G, 8B, 8a ○ Another 256 steps for level of transparency
○ 30/36/48 bit RGB -> 40/48/64 bit RGBa
18
○ Linux ○ Windows ○ macOS ○ iOS ○ Android
○ E.g.: ■ Video ■ Audio ■ Input devices
○ Not backwards-compatible with SDL 1.2!
19
20
○ SDL blits essentially copy and instance of the sprite onto a surface ■ "You should call unless you know exactly how SDL blitting works internally and how to use the other blit functions."
21
○ Can be efficiently rendered into a scene using an
we'll be using the GPU for drawing instead of the CPU
22