当前位置:网站首页>opengl-shader学习笔记:varying变量
opengl-shader学习笔记:varying变量
2022-07-27 06:46:00 【汪汪富贵】

varying变量可以在Vertex Shader和Fragment Shader之间传递数据
渲染管线中应用程序调用openglAPI,把顶点数据传给Vertex Shader,Vertex Shader处理完后输出数据给Fragment Shader,如上图中Vertex Shader->Fragment Shader的过程中 varying变量负责把数据从Vertex Shader搬运到Fragment Shader。
const char* vs = "uniform vec4 _color;\
varying vec4 outColor;\
void main()\
{\
outColor = _color;\
gl_Position = ftransform();\
}";
const char* ps = " varying vec4 outColor;\
void main()\
{\
gl_FragColor = outColor;\
}";
//vs通过outColor变量把数据输出,ps通过outColor变量接受vs数据
createProgram(vs, ps);
_color = glGetUniformLocation(_program,"_color");边栏推荐
- 在mac中使用docker来搭建oracle数据库服务器
- 基于Arduino的温度、湿度测量显示装置
- Use reflection to dynamically modify annotation attributes of @excel
- Will Flink CDC constantly occupy Oracle's memory by extracting Oracle's data, and finally cause oracle-040
- 多线程【初阶-上篇】
- Perl: 将要执行的外部命令拆分为多行
- UUID与secrets模块
- Zabbix: 将收集到值映射为易读的语句
- Systematic explanation of unit testing: mockito
- Grayog log server single node deployment
猜你喜欢

Okaleido ecological core equity Oka, all in fusion mining mode

杂谈:最近好多朋友谈出国……

ClickHouse 笔记1 | 简介、特点 | 基于CentOS7系统的安装与使用 | 常用数据类型 | MergeTree 表引擎 | SQL操作

js做一个红绿灯

(2022杭电多校三)1011.Taxi(曼哈顿最值+二分)

mysql备份策略

JS make a traffic light

单臂路由(讲解+实验)

Understanding and learning of node flow and processing flow in io

Properties类和properties配置文件的理解学习
随机推荐
Chapter 6 Shell Logic and Arithmetic
Chapter 6 Shell Logic and Arithmetic
闭散列和开散列解决哈希冲突
vlan间路由(讲解+验证)
QT连接sqlite数据库的错误及其修改办法
MySQL: 提高最大连接数
flink原理(一) 状态的TTL管理、容错机制
Closed hash and open hash resolve hash conflicts
Advanced IO outline
VLAN trunk experiment
在Perl程序中暴露Prometheus指标
在rhel7.3中编译和使用log4cxx
IO中节点流和处理流的理解学习
网络入门——vlan及trunk概述
Demonstrate the use of foreign keys with Oracle
2022-07-25 Gu Yujia's study notes
Array method and loop in JS
Examples of Oracle triggers
Tableau prep is connected to maxcompute and only writes simple SQL. Why is this error reported?
flink去重(一)flink、flink-sql中常见的去重方案总结