当前位置:网站首页>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
边栏推荐
- Win11如何解禁键盘?Win11解禁键盘的方法
- Codemail auto collation code of visual studio plug-in
- npm uninstall和rm直接删除的区别
- Crawler (17) - Interview (2) | crawler interview question bank
- Demon daddy B2 breaks through grammar and completes orthodox oral practice
- The function is really powerful!
- Leetcode SQL first day
- Jenkins user rights management
- How to turn on win11 game mode? How to turn on game mode in win11
- Goal: do not exclude yaml syntax. Try to get started quickly
猜你喜欢
![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]

Build your own website (18)
Talk about relational database and serverless

如何选择合适的自动化测试工具?

Implementation method of data platform landing

强化学习-学习笔记9 | Multi-Step-TD-Target

大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?

Virtual machine network configuration in VMWare

null == undefined

Customer case | China law network, through observing the cloud, greatly shortens the time of fault location
随机推荐
2022 how to evaluate and select low code development platforms?
operator
Cv2.resize function reports an error: error: (-215:assertion failed) func= 0 in function ‘cv::hal::resize‘
Jerry's test box configuration channel [chapter]
【Azure微服务 Service Fabric 】因证书过期导致Service Fabric集群挂掉(升级无法完成,节点不可用)
Wechat official account oauth2.0 authorizes login and displays user information
Redis - basic use (key, string, list, set, Zset, hash, geo, bitmap, hyperloglog, transaction)
Which financial products will yield high returns in 2022?
L2: current situation, prospects and pain points of ZK Rollup
你可曾迷茫?曾经的测试/开发程序员,懵懂的小菜C鸟升级......
#DAYU200体验官#MPPT光伏发电项目 DAYU200、Hi3861、华为云IotDA
Typescript TS basic knowledge type declaration
ISO 26262 - considerations other than requirements based testing
The difference between NPM uninstall and RM direct deletion
Tcp/ip protocol stack
Develop those things: go plus c.free to free memory, and what are the reasons for compilation errors?
npm uninstall和rm直接删除的区别
Demon daddy A1 speech listening initial challenge
Use blocconsumer to build responsive components and monitor status at the same time
South China x99 platform chicken blood tutorial