computer graphics framebuffersweb.engr.oregonstate.edu/~mjb/cs550/handouts/framebuffer.1pp.pdf•...
Post on 06-Oct-2020
7 Views
Preview:
TRANSCRIPT
mjb – August 21, 2019
1
Computer Graphics
Computer Graphics Framebuffers
FrameBuffer.pptx
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License
Mike Baileymjb@cs.oregonstate.edu
mjb – August 21, 2019
2
Computer Graphics
The Framebuffers
VideoDriverFront
Back
Double-bufferedColor Framebuffers
Depth-Buffer
Update
Refresh
mjb – August 21, 2019
3
Computer Graphics
The Framebuffer Uses RGB Colors
Blue
Red
Yellow
Cyan
WhiteMagenta
Green
mjb – August 21, 2019
4
Computer Graphics
The Framebuffer:Integer Color Storage
8 28 = 25610 210 = 1024
12 212 = 4096
# Bits/color # Intensities per color
R
B
G
Total colors:24 224 = 16.7 M30 230 = 1 B36 236 = 69 B
# Bits/pixel
“Typical”
High Dynamic Range (HDR)
mjb – August 21, 2019
5
Computer Graphics
• 16- or 32-bit floating point for each color component
R
B
G Why so many bits?
Many modern algorithms do arithmetic on the framebuffer color components, or treat the framebuffer color components as data. They need the extra precision during the arithmetic.
However, the display system cannot display all of those possible colors.
The Framebuffer: Floating Point Color Storage
mjb – August 21, 2019
6
Computer Graphics
The Framebuffer
• Alpha values– Transparency per pixel
= 0. is invisible= 1. is opaque
– Represented in 8-32 bits(integer or floating point)
– Alpha blending equation:
Color 1C (1 ) 2C0.0 1.0
Note: this is really blending, not transparency!
mjb – August 21, 2019
7
Computer Graphics
The Framebuffer
R
B
G
Total Z Values:32 232 = 4 B
# Bits / Z
• Z-buffer– Used for hidden surface removal
– Holds pixel depth
– Typically 32 bits deep
– Integer or floating point
Z
mjb – August 21, 2019
8
Computer Graphics
// swap the double-buffered framebuffers:
glutSwapBuffers( );
glutSwapBuffers( )
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
glDrawBuffer( GL_BACK );
Front
BackYou draw into here
Back
Front
“swap buffers” changes therole of the two framebuffers
The monitor displays from hereThis is called the update
This is called the refresh
You draw into here The monitor displays from here
mjb – August 21, 2019
9
Computer Graphics
The Video Driver
VideoDriverFront
Back
Double-bufferedColor Framebuffers
Depth-Buffer
The viewer sees the contents of this framebuffer
mjb – August 21, 2019
10
Computer Graphics
The Video Driver
• N refreshes/second (N is between 50 and 100)
• The framebuffer contains the R,G,B that define the color at each pixel
• Because of the double-buffering, Refresh is asynchronous from Update,that is, the monitor gets refreshed at N (60) frames per second,no matter how fast or slowly you update the back buffer.
top related