当前位置:网站首页>OpenGL jobs - shaders
OpenGL jobs - shaders
2022-07-07 22:08:00 【qq_ fifty-seven million two hundred and fifty-one thousand thre】
One 、 In the vertex shader , Invert a triangle
#version 330 core
layout (location = 0) in vec3 aPos;
out vec4 ourcolor;
void main()
{
gl_Position = vec4(aPos.x, -aPos.y, aPos.z, 1.0);
ourcolor=vec4(1.0, 0,0.2, 1.0);
}Two 、 Use uniform Define a horizontal offset , Use this offset in the vertex shader to move the triangle to the right of the screen
#version 330 core
layout (location = 0) in vec3 aPos;
out vec4 ourcolor;
uniform float Pianyi_x;
void main()
{
gl_Position = vec4(aPos.x+Pianyi_x, aPos.y, aPos.z, 1.0);
ourcolor=vec4(1.0, 0,0.2, 1.0);
}
int vertexColorLocation = glGetUniformLocation(myshader.ID, "Pianyi_x");
myshader.use();
glUniform1f(vertexColorLocation,0.7f); 3、 ... and Use out Keyword to output vertex positions to fragment shaders , And set the color of the clip to be equal to the vertex position ( Let's look at the result that even the vertex position values are interpolated in the triangle ). After that , Try to answer the following questions : Why is it black in the lower left corner of the triangle ?
I made a triangle
f
边栏推荐
- Anti climbing killer
- 嵌入式开发:如何为项目选择合适的RTOS?
- Why can't win11 display seconds? How to solve the problem that win11 time does not display seconds?
- ByteDance Android interview, summary of knowledge points + analysis of interview questions
- Latest Android advanced interview questions summary, Android interview questions and answers
- JNI primary contact
- 谈谈制造企业如何制定敏捷的数字化转型策略
- MIT6.S081-Lab9 FS [2021Fall]
- Jerry's test box configuration channel [chapter]
- [open source] Net ORM accessing Firebird database
猜你喜欢

Matplotlib drawing interface settings

operator

Record a garbled code during servlet learning
![Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]](/img/14/1c8a70102c106f4631853ed73c4d82.png)
Jerry's initiation of ear pairing, reconnection, and opening of discoverable and connectable cyclic functions [chapter]

Demon daddy B3 read extensively in a small amount, and completed 20000 vocabulary+

Implementation method of data platform landing

Open source OA development platform: contract management user manual

The little money made by the program ape is a P!

The whole network "chases" Zhong Xuegao

L2: current situation, prospects and pain points of ZK Rollup
随机推荐
【colmap】稀疏重建转为MVSNet格式输入
Actual combat: sqlserver 2008 Extended event XML is converted to standard table format [easy to understand]
Reptile combat (VII): pictures of the king of reptiles' heroes
海外代理推荐
An overview of the latest research progress of "efficient deep segmentation of labels" at Shanghai Jiaotong University, which comprehensively expounds the deep segmentation methods of unsupervised, ro
#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
Preparing for the interview and sharing experience
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Restapi version control strategy [eolink translation]
解决uni-app中uni.request发送POST请求没有反应。
Tupu digital twin coal mining system to create "hard power" of coal mining
TCP/IP 协议栈
The new version of onespin 360 DV has been released, refreshing the experience of FPGA formal verification function
How does win11 unblock the keyboard? Method of unlocking keyboard in win11
MIT6.S081-Lab9 FS [2021Fall]
Magic weapon - sensitive file discovery tool
【Azure微服务 Service Fabric 】在SF节点中开启Performance Monitor及设置抓取进程的方式
Dry goods sharing | devaxpress v22.1 original help document download collection
Use blocconsumer to build responsive components and monitor status at the same time
Jerry's power on automatic pairing [chapter]