当前位置:网站首页>glGetUniformLocation,glUniform4f
glGetUniformLocation,glUniform4f
2022-07-27 06:46:00 【汪汪富贵】
const char* vs = "void main()\
{\
gl_Position = ftransform();\
}";
const char* ps = "uniform vec4 _color;\
void main()\
{\
gl_FragColor = _color;\
}";
GLint program = createProgram(vs, ps);
//根据变量名_color获取着色器程序中对应uniform变量的位置,
//应用程序操作这个_colorId,就可以改变着色器中的uniform变量
uniform colorId = glGetUniformLocation(program,"_color");
//改变uniform
glUseProgram(program);
glUniform4f(colorId,0,1,0,1);//要在绘制之前调用
//....代码省略
glDrawArrays(GL_TRIANGLE_STRIP,0,4);
glUseProgram(0);
边栏推荐
猜你喜欢

我是不是被代码给耽误了……不幸沦为一名程序员……

C# 常用功能整合-3

Introduction to network -- overview of VLAN and trunk

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

Quickly update the information in a field in kettle

Chapter 6 Shell Logic and Arithmetic

海康h9摄像头用xshell无法连接(没有启用ssh)

Use Amazon dynamodb and Amazon S3 combined with gzip compression to maximize the storage of player data

Bingbing's learning notes: classes and objects (middle)

(2022 Niuke multi school III) j-journey (Dijkstra)
随机推荐
[wsl2] configure the USB camera connecting the USB device and using the host
杂谈:高考
(2022 Hangdian multi school III) 1009.package delivery (greedy)
Advanced IO outline
C common function integration-2
Introduction to network -- overview of VLAN and trunk
Will Flink CDC constantly occupy Oracle's memory by extracting Oracle's data, and finally cause oracle-040
查看服务器重启前的 dmesg 日志
Properties类和properties配置文件的理解学习
Okaleido ecological core equity Oka, all in fusion mining mode
在kettle使用循环来处理表中的数据
Functools module
Error when connecting to MySQL: public key retrieval is not allowed [solution]
Multi condition query of when
Panabit SNMP configuration
我是不是被代码给耽误了……不幸沦为一名程序员……
在rhel8上使用soci连接oracle和postgresql和sqlite
【WSL2】配置连接 USB 设备并使用主机的 USB 摄像头
Use of tigervnc
Simple rotation chart