OpenGL编程指南 https://github.com/openglredbook/examples https://blog.csdn.net/guyuealian/article/details/85262650
7th Edition of OpenGL SuperBible https://github.com/openglsuperbible/sb7code
openGL 不错的两个教程 https://learnopengl-cn.github.io https://blog.csdn.net/cordova/column/info/13062/2
什么是 openGL? “the GL,” meaning “the graphics library,”
OpenGL is an application programming interface—‘‘API’’ for short—which is merely a software library for accessing features in graphics hardware OpenGL is an interface that your application can use to access and control the graphics subsystem of the device on which it runs
OpenGL is designed as a streamlined, hardware-independent interface that can be implemented on many different types of graphics hardware systems, or entirely in software (if no graphics hardware is present in the system) independent of a computer’s operating or windowing system
The goal of OpenGL is to provide an abstraction layer between your application and the underlying graphics subsystem
与硬件相关的东西, openGL 都不会涉及,只有这样才能做到独立于图形硬件实现系统
一些基本的概念: Rendering 渲染 : is the process by which a computer creates an image from models 由模型生成图像
Our models, or objects—we’ll use the terms interchangeably—are constructed from geometric primitives—points, lines, and triangles— that are specified by their vertices 模型或物体由 几何元素:点、线、三角形构成,它们由顶点确定。
shaders 着色器:which are special functions that the graphics hardware executes,可以把它看做专为 GPU 编译的一种小程序, little programs that are specifically compiled for GPU( graphics processing unit)
Current GPUs consist of large numbers of small programmable processors called shader cores that run mini-programs called shaders. Each core has a relatively low throughput, processing a single instruction of the shader in one or more clock cycles and normally lacking advanced features
vertex shaders: which process vertex data 顶点数据 a vertex : a bundle of data values that are processed together
fragment shaders, which operate on the fragments generated by the rasterizer A fragment in OpenGL is all the data required for OpenGL to render a single pixel.
a pixel is the smallest visible element on your display,The pixels in your system are stored in a framebuffer, which is a chunk of memory that the graphics hardware manages, and feeds to your display device
viewport : the region of the window where you’re permitted to draw
clipping 就是 vertices 超出了指定区域 viewport ,需要修改 vertices 使其位于 指定区域内,这一步是 openGL 自动完成的。
当使用OpenGL的core-profile开发时,OpenGL迫使我们使用最新的技术。每当我们尝试使用OpenGL的弃用功能时,OpenGL会提示出了一个错误并停止运行
OpenGL的客户端和服务器模式 在一台工作站上,绘图的整个过程不过是把数据从系统的内存中复制到图形卡中,然后绘制出图形。 但openGL是按照客户机-服务器模式设计的。我们认为可以将整个OpenGL系统分为两部分,一部分是客户端,它负责发送OpenGL命令。一部分是服务端,它负责接收OpenGL命令并执行相应的操作。比如我们编写的程序就是一个客户端,而我们的计算机图形硬件制造商提供的OpenGL的实现就是服务器。 对于个人计算机来说,可以将CPU、内存等硬件,以及用户编写的OpenGL程序看做客户端,而将OpenGL驱动程序、显示设备等看做服务端。
Rasterisation (or rasterization) is the task of taking an image described in a vector graphics format (shapes) and converting it into a raster image (a series of pixels, dots or lines, which, when displayed together, create the image which was represented via shapes). 光栅化(Rasterize/rasteriztion)就是把矢量图形转化成像素点儿的过程。我们屏幕上显示的画面都是由像素组成,而三维物体都是点线面构成的。要让点线面,变成能在屏幕上显示的像素,就需要Rasterize这个过程。就是从矢量的点线面的描述,变成像素的描述。
11