当前位置:网站首页>First knowledge of OpenGL (3) fragment shader
First knowledge of OpenGL (3) fragment shader
2022-07-26 16:07:00 【thefist11】
step1. Fragment Shader
Calculate the final color output of pixels . Fragment shaders require only one output variable , This variable is a 4 Component vector , It represents the final output color , We should calculate it ourselves .
#version 330 core
out vec4 FragColor;
void main()
{
FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);
}
Declare that the output variable can use out keyword , Here we call it FragColor.
step2. Compiling fragment shaders
Similar to vertex shaders , Use GL_FRAGMENT_SHADER Constant as shader type :
unsigned int fragmentShader;
fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSource, NULL);
glCompileShader(fragmentShader);
边栏推荐
- 大型仿人机器人整机构型研究与应用
- 泰山OFFICE技术讲座:WORD的缩放比例与显示略有差异
- Change an ergonomic chair to relieve the old waist of sitting and writing code~
- Basic specification of component development, localstorage and sessionstorage, object data to basic value, prototype chain use
- Tutorial (7.0) 05. Issue forticlient * forticlient EMS * Fortinet network security expert NSE 5 through forticlient EMS
- 物联网工业级串口转WiFi转网口转以太网模块的选型
- 【物理模拟】最简单的shape matching的原理与实践
- 御神楽的学习记录之SoC FPGA的第一个工程-Hello World
- A coal mine in Yangquan, Shanxi Province, suffered a safety accident that killed one person and was ordered to stop production for rectification
- C# 给Word每一页设置不同文字水印
猜你喜欢

教大模型自己跳过“无用”层,推理速度×3性能不变,谷歌MIT这个新方法火了...

gcc/g++与动静库以及gdb

My brother created his own AI anti procrastination system, and he was "blinded" when playing with his mobile phone | reddit was hot

马斯克被曝绿了谷歌创始人:导致挚友二婚破裂,曾下跪求原谅

HaWe screw cartridge check valve RK4

Technology vane | interpretation of cloud native technology architecture maturity model

2022你的安全感是什么?沃尔沃年中问道

Tutorial (7.0) 05. Issue forticlient * forticlient EMS * Fortinet network security expert NSE 5 through forticlient EMS

如何通过ETL调度工具 TASKCTL 使用作业插件类型调用 kettle作业?

大型仿人机器人整机构型研究与应用
随机推荐
Daily1:SVM
[ten thousand words long text] Based on LSM tree thought Net 6.0 C # realize kV database (case version)
泰山OFFICE技术讲座:WORD的缩放比例与显示略有差异
“核弹级” Log4j 漏洞仍普遍存在,并造成持续影响
Robot hand eye calibration ax=xb (eye to hand and eye in hand) and plane nine point calibration
德国emg电动执行器EB800-60II
Clojure 运行原理之编译器剖析
十周岁生日快乐,Clojure
德国EMG易安基推动器ED301/6 HS
阿里云DMS MySQL云数据库建表报错,求解!!
ES6高级-查询商品案例
初识OpenGL (3)片段着色器(Fragment Shader)
Understanding weight sharing in convolutional neural networks
八叉树建立地图并实现路径规划导航
Implementation of SAP ABAP daemon
Pandora IOT development board learning (RT thread) - Experiment 17 esp8266 experiment (learning notes)
我们被一个 kong 的性能 bug 折腾了一个通宵
PAT甲级1048 Find Coins
《硅谷之谜》读后感
Musk was exposed to be the founder of Google: he broke up his best friend's second marriage and knelt down to beg for forgiveness