VAOs, VBOs, Vertex and Fragment Shaders

关于Vertex Array Objects(VAOs), Vertex
Buffer Objects
(VBOs), Vertex and Fragment Shaders的概念还是看官方说明理解的好!

The OpenGL 3.2 core specification removes the majority of the fixed function pipeline previously used, and replaces it with a completely programmable architecture using shaders. Our tutorial will make use of VAOs and VBOs to provide our shaders with data.

A Vertex Array Object (VAO) is an object which contains one or more Vertex Buffer Objects(VBOs) and is designed to store the information for a complete rendered object.

A Vertex Buffer Object (VBO) is a memory buffer in the high speed memory of your video card
designed to hold information about vertices. VBOs can also store information such as normals, texcoords, indicies, etc.

Vertex Shader in OpenGL is a piece of C like code written to the GLSL specification which influences the attributes
of a vertex. Vertex shaders can be used to modify properties of the vertex such as position, color, and texture coordinates.

Fragment Shader is similar to a Vertex Shader, but is used for calculating individual fragment colors. This
is where lighting and bump-mapping effects are performed.

There is another shader type called Geometry Shaders which we will be using in a later tutorial. They are used to create additional vertices.

The shader pipeline behaves as follows: Vertex Shaders -> Geometry Shaders -> (Rasterizing Engine) -> Fragment Shaders.

The shaders are compilied and then chained together into a Shader Program.

The shaders receive input data from our VAO through a process of attribute binding, allowing us to perform the needed computations to provide us with the desired results.

时间: 2024-10-15 00:13:37

VAOs, VBOs, Vertex and Fragment Shaders的相关文章

Unity cg vertex and fragment shaders(一)

cg片段 Cg程序片段写CGPROGRAM和ENDCG之间 开始时的片段可以作为#pragma语句编译指令 Pass { // ... the usual pass state setup ... CGPROGRAM // compilation directives for this snippet, e.g.: #pragma vertex vert #pragma fragment frag // the Cg/HLSL code itself ENDCG // ... the rest

UnityShader之顶点片段着色器Vertex and Fragment Shader【Shader资料】

顶点片段着色器 V&F Shader:英文全称Vertex and Fragment Shader,最强大的Shader类型,也是我们在使用ShaderLab中的重点部分,属于可编程管线,使用的是CG/HLSL语法.分为vertex顶点部分和Fragment像素部分. 本篇的末尾讲述顶点函数传入的结构体类型的参数appdata_base. Shader "Custom/Exam1" { Properties { _MainTex ("Texture", 2D

Vertex and fragment programs

[Vertex and fragment programs] When you use vertex and fragment programs (the so called "programmable pipeline"), most of the hardcoded functionality ("fixed function pipeline") in the graphics hardware is switched off. For example, us

3D Computer Grapihcs Using OpenGL - 07 Passing Data from Vertex to Fragment Shader

上节的最后我们实现了两个绿色的三角形,而绿色是直接在Fragment Shader中指定的. 这节我们将为这两个三角形进行更加自由的着色--五个顶点各自使用不同的颜色. 要实现这个目的,我们分两步进行,首先 在顶点数组里增加数据用来表示颜色 修改sendDataToOpenGL()函数中的verts数组: 1 GLfloat verts[] = 2 { 3 +0.0f, +0.0f, //Vertex 0 4 +1.0, +0.0, +0.0f, //Color 0 5 +1.0f, +1.0f

Unity Shaders and Effects Cookbook (3-6) 创建各向异性高光类型(Anisotropic) 模拟金属拉丝效果

这一次学习各向异性高光类型,名字真拗口,Anisotropic 这个英文单词也很拗口. 各向异性是模拟物体表面 沟槽方向性的高光反射类型,他会修改或延伸垂直方向上的高光. 比如模拟金属拉丝的效果,就可以使用各向异性来模拟. 转自http://blog.csdn.net/huutu http://www.thisisgame.com.cn 首先需要准备一张各向异性 的法线贴图,代表各向异性镜面高光的方向性. 注意法线贴图导入到Unity之后要在属性面板中勾选类型为 Normal Map. 首先在

【OpenGL】详解第一个OpenGL程序

写在前面 OpenGL能做的事情太多了!很多程序也看起来很复杂.很多人感觉OpenGL晦涩难懂,原因大多是被OpenGL里面各种语句搞得头大,一会gen一下,一会bind一下,一会又active一下.搞到最后都不知道自己在干嘛,更有可能因为某一步的顺序错误导致最后渲染出错,又或者觉得记下这些操作的顺序是非常烦人的一件事.那么,OpenGL为什么会长成这个样子呢?这篇文章旨在通过一个最简单的OpenGL程序开始,让我们能够"看懂"它,"记住"这些操作顺序. 我们先来解

第4章:缓冲区、着色器、GLSL

原文链接: http://www.rastertek.com/gl40tut04.html Tutorial 4: Buffers, Shaders, and GLSL This tutorial will be the introduction to writing vertex and pixel shaders in OpenGL 4.0. It will also be the introduction to using vertex and index buffers in OpenG

[OpenGL]环境搭建以及OpenGL初识

想往游戏行业发展的话,经常被提及到的就是OpenGL和DirectX,这两者听起来感觉是一门挺高深的技术,今天我也开始摸索学习OpenGL,那么OpenGL到底是什么?它和DirectX有什么区别和联系? OpenGL初识 OpenGL只是一套图形函数库 DirectX包含图形.声音.输入.网络等模块. 但就图形而论,DirectX的图形库性能不如OpenGL,OpenGL稳定,可以跨平台使用,DirectX只支持Windows平台,所以OpenGL还是有它的优势!OpenGL ES是OpenG

(译)Minimal Shader(最小的着色器)

(原文:https://en.wikibooks.org/wiki/Cg_Programming/Unity/Minimal_Shader) This tutorial covers the basic steps to create a minimal Cg shader in Unity. 本节课包含了在Unity中创建一个最小的Cg着色器的基本步骤. Starting Unity and Creating a New Project(打开Unity创建一个新工程) After downlo