Screens & 2D Graphics: Crash Course Computer Science #23
Summary
TLDR这段视频脚本介绍了计算机图形学的早期发展。1960年代的PDP-1计算机及其图形显示器是早期计算机图形技术的代表。由于当时的技术限制,文本和图形任务通常是分开处理的,因为早期的计算机屏幕在渲染清晰文本方面存在困难。计算机屏幕主要用于跟踪程序的运行,例如寄存器中的值,而计算结果则通常写入纸张或其他更永久的介质。然而,随着时间的推移,人们开始探索屏幕的其他用途。视频还介绍了阴极射线管(CRT)显示器的工作原理,以及如何通过矢量扫描和光栅扫描来绘制图形。此外,还讨论了早期计算机如何使用字符生成器来节省内存,并通过ASCII艺术和字符集扩展来创建图形界面。视频还提到了矢量图形模式,这是一种通过定义一系列线条来绘制屏幕内容的方法。最后,脚本探讨了像素图形的出现,以及如何通过内存中的位直接映射到屏幕上的像素,从而实现任意图形的绘制。这些技术的发展为后来的交互式计算和图形用户界面的普及奠定了基础。
Takeaways
- 📚 早期计算机屏幕主要用于跟踪程序的运行,如寄存器中的值,而不是用于打印输出,因为屏幕可以动态快速更新临时值。
- 🖥️ 阴极射线管(CRT)是最早且最具影响力的显示技术之一,通过电子束撞击涂磷屏幕产生光亮来工作。
- 🎨 CRT显示器通过矢量扫描和光栅扫描两种方式绘制图形,矢量扫描通过重复路径创建实像,光栅扫描通过逐行扫描并仅在特定点上激活电子束来创建图形。
- 🔍 随着显示技术的进步,屏幕能够渲染清晰的点,即像素,而现代的液晶显示器(LCD)也使用光栅扫描技术。
- 🚫 早期计算机通常不使用像素,因为像素消耗的内存对于当时的计算机来说太大了,例如200x200像素的图像就包含了40,000个像素。
- 🔑 为了节省内存,早期计算机使用字符网格代替像素,一个80x25字符的网格仅需要2000个字符,大幅减少了内存使用。
- 💡 为了将字符转换为光栅图形,早期计算机使用了一个额外的硬件组件——字符生成器,它类似于最初的显卡。
- 📈 ASCII艺术和使用下划线、加号等基本字符创建的简单图形界面展示了人们如何巧妙地使用有限的字符集。
- 🔍 为了绘制非文本内容,如电路图、建筑平面图、地图等,计算机科学家利用了CRT上的矢量模式,通过定义一系列线条来绘制屏幕上的所有内容。
- 👾 早期视频游戏,如1962年的《Spacewar!》,使用矢量图形在PDP-1上构建,启发了许多后续游戏的发展。
- 🖌️ Sketchpad是最早的交互式图形界面之一,它使用光笔作为输入设备,允许用户在屏幕上绘制线条和形状,代表了计算机辅助设计(CAD)软件的开端。
- 📈 真正的像素图形显示器出现在1960年代末,通过内存中的位直接映射到屏幕上的像素,称为位图显示。
Q & A
早期计算机屏幕在渲染清晰文本方面遇到了哪些困难?
-早期计算机屏幕在渲染清晰文本方面遇到了困难,因为它们很难生成高对比度和高分辨率的文本,而打印在纸上的文本则可以提供更高的对比度和分辨率。
早期计算机屏幕的主要用途是什么?
-早期计算机屏幕的主要用途是监控程序的运行,例如寄存器中的值。屏幕的动态性和快速更新特性使其非常适合显示临时值。
阴极射线管(CRT)是如何工作的?
-阴极射线管(CRT)通过从发射器发射电子到涂有磷光物质的屏幕上工作。当电子击中涂层时,它会短暂发光。由于电子是带电粒子,其路径可以通过电磁场进行操控。
矢量扫描和光栅扫描在绘制图形时有什么区别?
-矢量扫描是通过直接将电子束引导至图形轮廓来绘制形状,而光栅扫描则是通过重复沿固定路径(从屏幕左上角到右下角)扫描,并在特定点打开电子束来创建图形。
为什么早期计算机不使用像素来渲染图像?
-早期计算机不使用像素来渲染图像,主要是因为像素会消耗大量的内存。例如,一个200x200像素的图像包含40,000个像素,即使每个像素只使用1位数据,也会占用大量的内存。
字符生成器是如何帮助节省内存的?
-字符生成器通过存储一个较小的字母网格而不是成千上万的像素来节省内存。它们使用大约80x25个字符的网格,总共2000个字符,每个字符使用8位ASCII编码,整个屏幕的文本仅占用16,000位的内存。
什么是ASCII艺术,它如何利用基本字符集创造出图形?
-ASCII艺术是一种利用ASCII字符集中的字符(如下划线和加号)来创造图形的艺术形式。通过创造性地排列这些字符,可以形成盒子、线条和其他原始形状。
矢量图形模式是如何帮助计算机科学家在不使用大量内存的情况下绘制内容的?
-矢量图形模式通过定义一系列线条来绘制屏幕上的所有内容,从而避免了使用大量内存。如果需要绘制文本,也需要通过线条来绘制。这种方法使得计算机能够以更高效的方式存储和渲染图形。
Spacewar! 是如何使用矢量图形在PDP-1上创建的?
-Spacewar! 是在1962年使用PDP-1上的矢量图形创建的,它是最早的视频游戏之一,通过一系列矢量指令存储在内存中,并使用矢量图形卡渲染到屏幕上,全部由线条构成。
Sketchpad 程序和光笔是如何交互的?
-Sketchpad 使用了一种称为光笔的输入设备,它是一种通过电线连接到计算机的笔。光笔的尖端有一个光传感器,可以检测到计算机显示器的刷新。利用刷新的时间,计算机可以计算出光笔在屏幕上的位置。
位图显示技术是如何出现的,它与之前的图形技术有何不同?
-位图显示技术出现在1960年代晚期,它允许内存中的位直接映射到屏幕上的像素,这被称为位图显示。与之前的技术不同,位图显示提供了完全的像素控制,使得完全任意的图形成为可能。
图形库为程序员提供了哪些便利?
-图形库为程序员提供了现成的函数,用于绘制线条、曲线、形状、文本等,这为他们提供了一个新的抽象层次,减少了从零开始编写绘图函数的时间和复杂性。
Outlines
🖥️ 早期计算机图形与显示技术
Carrie Anne介绍了1960年代的PDP-1计算机,这是早期具有图形功能的计算机的典型代表。她解释了早期计算机屏幕与文本任务的分离,以及屏幕在显示清晰文本方面的困难。早期计算机屏幕主要用于监控程序运行,如寄存器中的值,而不是用于程序输出。随着时间的推移,人们开始探索屏幕的其他用途。Carrie Anne还讨论了阴极射线管(CRT)的工作原理,包括矢量扫描和光栅扫描技术,以及液晶显示器(LCD)技术的发展。此外,她还提到了早期计算机如何通过字符生成器和ASCII编码来节省内存,以及如何使用矢量模式来绘制非文本内容。
📐 矢量图形与光笔输入
本段落介绍了矢量图形的概念,即所有屏幕上的内容都由一系列线条定义。Carrie Anne以Vectrex为例,展示了如何使用矢量命令绘制形状。她解释了矢量图形存储在内存中的方式,以及如何通过矢量图形卡渲染到屏幕上。此外,她还提到了早期视频游戏Spacewar!和计算机辅助设计(CAD)软件Sketchpad,以及它们如何使用光笔这一输入设备进行交互。Sketchpad能够执行如线条平行、长度一致、角度精确等在纸上难以完成的任务,并且可以保存和分享复杂设计。这标志着计算机使用方式的一个关键转折点,计算机不再仅仅是进行数值计算的机器,而是成为了能够交互式增强人类任务的助手。
🎨 像素图形与图形用户界面的兴起
Carrie Anne讨论了真正的像素图形计算机和显示器在1960年代末的出现,以及它们如何使得完全任意的图形成为可能。她解释了位图显示的概念,即内存中的位直接映射到屏幕上的像素。早期计算机使用RAM作为像素数据的存储区域,后来的系统则使用专门的高速视频RAM(VRAM)。她通过一个简单的例子说明了如何使用代码在屏幕上设置像素值、绘制线条和矩形。此外,她还提到了程序员如何利用图形库中的现成函数来绘制线条、曲线、形状等,而不是从头开始编写绘图函数。最后,她指出尽管位图图形为交互式计算开辟了新的可能性,但由于成本高昂,在几十年内并未普及。尽管如此,Sketchpad和Spacewars等先驱工作为计算机显示器的普及和图形用户界面(GUI)的出现奠定了基础。
Mindmap
Keywords
💡PDP-1
💡Cathode Ray Tubes (CRTs)
💡Vector Scanning
💡Raster Scanning
💡Pixels
💡Character Generator
💡ASCII
💡Vector Graphics
💡Sketchpad
💡Bitmapped Displays
💡Frame Buffer
Highlights
1960年代的PDP-1计算机是早期带有图形功能的计算机的典型例子。
早期计算机屏幕在渲染清晰文本方面存在困难,而打字纸提供了更高的对比度和分辨率。
计算机屏幕主要用于跟踪程序的操作,例如寄存器中的值。
阴极射线管(CRT)是几十年来创建的许多不同显示技术中最有影响力且最早的技术之一。
矢量扫描和光栅扫描是两种绘制图形的方法。
随着显示技术的进步,屏幕上可以渲染出清晰的点,即像素。
大多数早期计算机不使用像素,因为像素消耗的内存对于当时的计算机来说太多了。
早期计算机使用字符网格而不是存储成千上万的像素,以节省内存。
字符生成器是早期计算机用来将字符转换为光栅图形的硬件,相当于最早的图形卡。
ASCII艺术和使用下划线和加号等字符创建基本图形界面的尝试展现了人们的创造力。
为了绘制非文本内容,如电路图、建筑平面图、地图等,计算机科学家使用了CRT上的矢量模式。
Spacewar! 是1962年在PDP-1上使用矢量图形构建的,是最早的视频游戏之一。
Sketchpad是一个交互式图形界面,提供了计算机辅助设计(CAD软件),是最早完整的图形应用程序之一。
光笔是一种通过检测计算机显示器刷新来确定其在屏幕上位置的输入设备。
最早的计算机和具有真实像素图形的显示器出现在1960年代末。
位图显示允许完全任意的图形控制,屏幕图形可以看作是一个巨大的像素值矩阵。
程序员使用图形库中的现成函数来绘制线条、曲线、形状、文本等,这是抽象的一个新的层次。
位图图形的灵活性为交互式计算开辟了新的可能性,但几十年来仍然很昂贵。
随着计算机显示器变得普及,图形用户界面的出现标志着计算机使用方式的关键转折点。
Transcripts
Hi, I’m Carrie Anne, and welcome to CrashCourse Computer Science!
This 1960 PDP-1 is a great example of early computing with graphics.
You can see a cabinet-sized computer on the left, an electromechanical teletype machine
in the middle, and a round screen on the right.
Note how they’re separated.
That’s because text-based tasks and graphical tasks were often distinct back then.
In fact, these early computer screens had a very hard time rendering crisp text, whereas
typed paper offered much higher contrast and resolution.
The most typical use for early computer screens was to keep track of a program's operation,
like values in registers.
It didn’t make sense to have a teletype machine print this on paper over and over
and over again -- that’d waste a lot of paper, and it was slow.
On the other hand, screens were dynamic and quick to update -- perfect for temporary values.
Computer screens were rarely considered for program output, though.
Instead, any results from a computation were typically written to paper or some other more
permanent medium.
But, screens were so darn useful that by the early 1960s, people started to use them for
awesome things.
INTRO
A lot of different display technologies have been created over the decades, but the most
influential, and also the earliest, were Cathode Ray Tubes, or CRTs.
These work by shooting electrons out of an emitter at a phosphor-coated screen.
When electrons hit the coating, it glows for a fraction of a second.
Because electrons are charged particles, their paths can be manipulated with electromagnetic
fields.
Plates or coils are used inside to steer electrons to a desired position, both left-right and
up-down.
With this control, there are two ways you can draw graphics.
The first option is to direct the electron beam to trace out shapes.
This is called Vector Scanning.
Because the glow persists for a little bit, if you repeat the path quickly enough, you
create a solid image.
The other option is to repeatedly follow a fixed path, scanning line by line, from top
left to bottom right, and looping over and over again.
You only turn on the electron beam at certain points to create graphics.
This is called Raster Scanning.
With this approach, you can display shapes... and even text... all made of little line segments.
Eventually, as display technologies improved, it was possible to render crisp dots onto
the screen, aka pixels.
The Liquid Crystal Displays, or LCDs, that we use today are quite a different technology.
But, they use raster scanning too, updating the brightness of little tiny red, green and
blue pixels many times a second.
Interestingly, most early computers didn’t use pixels -- not because they couldn’t
physically, but because it consumed way too much memory for computers of the time.
A 200 by 200 pixel image contains 40,000 pixels.
Even if you use just one bit of data for each pixel, that’s black OR white -- not grayscale!
-- the image would consume 40,000 bits of memory.
That would have gobbled up more than half of a PDP-1’s entire RAM.
So, computer scientists and engineers had to come up with clever tricks to render graphics
until memory sizes caught up to our pixelicious ambitions.
Instead of storing tens of thousands of pixels, early computers stored a much smaller grid
of letters, most typically 80 by 25 characters.
That’s 2000 characters in total.
And if each is encoded in 8 bits, using something like ASCII, it would consume 16,000 bits of
memory for an entire screen full of text, which is way more reasonable.
To pull this off, computers needed an extra piece of hardware that could read characters
out of RAM, and convert them into raster graphics to be drawn onto the screen.
This was called a character generator, and they were basically the first graphics cards.
Inside, they had a little piece of Read Only Memory, a ROM, that stored graphics for each
character, called a dot matrix pattern.
If the graphics card saw the 8-bit code for the letter “K”, then it would raster scan
the 2D pattern for the letter K onto the screen, in the appropriate position.
To do this, the character generator had special access to a portion of a computer's memory
reserved for graphics, a region called the screen buffer.
Computer programs wishing to render text to the screen simply manipulated the values stored
in this region, just as they could with any other data in RAM.
This scheme required much less memory, but it also meant the only thing you could draw
was text.
Even still, people got pretty inventive with ASCII art!
People also tried to make rudimentary, pseudo-graphical interfaces out of this basic set of characters,
using things like underscores and plus signs to create boxes, lines and other primitive
shapes.
But, the character set was really too small to do anything terribly sophisticated.
So, various extensions to ASCII were made that added new semigraphical characters, like
IBM’s CP437 character set, seen here, which was used in DOS.
On some systems, the text color and background color could be defined with a few extra bits.
That allowed glorious interfaces like this DOS example, which is built entirely out the
character set you just saw.
Character generators were a clever way to save memory.
But, they didn’t provide any way to draw arbitrary shapes.
And that’s important if you want to draw content like electrical circuits, architectural
plans, maps, and... well… pretty much everything that isn’t text!
To do this, without resorting to memory-gobbling pixels, computer scientists used the vector
mode available on CRTs.
The idea is pretty straightforward: all content to be drawn on screen is defined by a series
of lines.
There’s no text.
If you need to draw text, you have to draw it out of lines.
Don’t read between the lines here.
There is only lines!
Got it?
Alright, no more word play.
I’m drawing the line here.
Let’s pretend this video is a cartesian plane, 200 units wide and 100 tall, with the
origin – that’s the zero-zero point – in the upper left corner.
We can draw a shape with the following vector commands, which we’ve borrowed from the
Vectrex, an early vector display system.
First, we reset, which clears the screen, moves the drawing point of the electron gun
to zero-zero, and sets the brightness of lines to zero.
Then we move the drawing point down to 50 50, and set the line intensity to 100%.
With the intensity up, now we move to 100, 50, then 60, 75 and then back to 50,50.
The last thing to do is set our line intensity back to 0%.
Cool!
We’ve got a triangle!
This sequence of commands would consume on the order of 160 bits, which is way more efficient
than keeping a huge matrix of pixel values!
Just like how characters were stored in memory and turned into graphics by a character generator,
these vector instructions were also stored in memory, and rendered to a screen using
a vector graphics card.
Hundreds of commands could be packed together, sequentially, in the screen buffer, and used
to build up complex graphics.
All made of lines!
Because all these vectors are stored in memory, computer programs can update the values freely,
allowing for graphics that change over time -- Animation!
One of the very earliest video games, Spacewar!, was built on a PDP-1 in 1962 using vector
graphics.
It’s credited with inspiring many later games, like Asteroids, and even the first
commercial arcade video game: Computer Space.
1962 was also a huge milestone because of Sketchpad, an interactive graphical interface
that offered Computer-Aided Design -- called CAD Software today.
It’s widely considered the earliest example of a complete graphical application.
And its inventor, Ivan Sutherland, later won the Turing Award for this breakthrough.
To interact with graphics, Sketchpad used a recently invented input device called a
light pen, which was a stylus tethered to a computer with a wire.
By using a light sensor in the tip, the pen detected the refresh of the computer monitor.
Using the timing of the refresh, the computer could actually figure out the pen’s position
on the screen!
With this light pen, and various buttons on a gigantic computer, users could draw lines
and other simple shapes.
Sketchpad could do things like make lines perfectly parallel, the same length, straighten
corners into perfect 90 degree intersections, and even scale shapes up and down dynamically.
These things that were laborious on paper, a computer now did with a press of a button!
Users were also able to save complex designs they created, and then paste them into later
designs, and even share with other people.
You could have whole libraries of shapes, like electronic components and pieces of furniture
that you could just plop in and manipulate in your creations.
This might all sound pretty routine from today’s perspective.
But in 1962, when computers were still cabinet-sized behemoths chugging through punch cards, Sketchpad
and light pens were equal parts eye opening and brain melting.
They represented a key turning point in how computers could be used.
They were no longer just number crunching math machines that hummed along behind closed
doors.
Now, they were potential assistants, interactively augmenting human tasks.
The earliest computers and displays with true pixel graphics emerged in the late 1960s.
Bits in memory directly “mapped” to pixels on the screen, what are called bitmapped displays.
With full pixel control, totally arbitrary graphics were possible.
You can think of a screen’s graphics as a huge matrix of pixel values . As before,
computers reserve a special region of memory for pixel data, called the frame buffer.
In the early days, the computer’s RAM was used, but later systems used special high
speed Video RAM, or VRAM, which was located on the graphics card itself for high speed
access.
This is how it’s done today.
On an 8-bit grayscale screen, we can set values from 0 intensity, which is black, to 255 intensity,
which is white.
Well actually, it might be green... or orange, as many early displays couldn’t do white.
Let’s pretend this video is a really low resolution bitmapped screen, with a resolution
of 60 by 35 pixels.
If we wanted to set the pixel at 10 10 to be white, we could do it with a piece of code
like this.
If we wanted to draw a line, let’s say from 30, 0 to 30, 35, we can use a loop, like so….
….And this changes a whole line of pixels to white.
If we want to draw something more complicated, let’s say a rectangle, we need to know four
values.
The X and Y coordinate of its starting corner, and its width and height.
So far, we’ve drawn everything in white, so let’s specify this rectangle to be grey.
Grey is halfway between 0 and 255, so that’s a color value of 127.
Then, with two loops – one nested in the other, so that the inner loop runs once for
every iteration of the outer loop – we can draw a rectangle.
When the computer executes our code as part of its draw routine, it colors in all the
pixels we specified.
Let’s wrap this up into a “draw rectangle function”, like this:
Now, to draw a second rectangle on the other side of the screen, maybe in black this time,
we can just call our rectangle drawing function.
Voila!!
Just like the other graphics schemes we’ve discussed, programs can manipulate pixel data
in the framebuffer, creating interactive graphics.
Pong time!
Of course, programmers aren’t wasting time writing drawing functions from scratch.
They use graphics libraries with ready-to-go functions for drawing lines, curves, shapes,
text, and other cool stuff.
Just a new level of abstraction!
The flexibility of bitmapped graphics opened up a whole new world of possibilities for
interactive computing, but it remained expensive for decades.
As I mentioned last episode, by as late as 1971, it was estimated there were around 70,000
electro-mechanical teletype machines and 70,000 terminals in use, in the United States.
Amazingly, there were only around 1,000 computers in the US that had interactive graphical screens.
That’s not a lot!
But the stage was set – helped along by pioneering efforts like Sketchpad and Spacewars
– for computer displays to become ubiquitous, and with them, the dawn of graphical user
interfaces, which we’ll cover in a few episodes!
I’ll see you next week.
استعرض المزيد من الفيديوهات ذات الصلة
![](https://i.ytimg.com/vi/nwDq4adJwzM/hq720.jpg)
Early Programming: Crash Course Computer Science #10
![](https://i.ytimg.com/vi/fOvTtapxa9c/hq720.jpg)
Natural Language Processing: Crash Course Computer Science #36
![](https://i.ytimg.com/vi/TEAtmCYYKZA/hq720.jpg)
3D Graphics: Crash Course Computer Science #27
![](https://i.ytimg.com/vi/4RPtJ9UyHS0/hq720.jpg)
Keyboards & Command Line Interfaces: Crash Course Computer Science #22
![](https://i.ytimg.com/vi/-4E2-0sxVUM/hq720.jpg)
Computer Vision: Crash Course Computer Science #35
![](https://i.ytimg.com/vi/rtAlC5J1U40/hq720.jpg)
Advanced CPU Designs: Crash Course Computer Science #9
5.0 / 5 (0 votes)