- 1. 版本1.7 QKEnging介绍
- 1. 增加了静态初始化函数
- 2. 增加了动态元素
- 3. 增加了Element初始化附加操作的lambda表达
- 测试代码
- 2. 实现多张Texture的使用
- 1. 将texture绑定gl状态机不同的TextureCode
- 2. 在调用shader之后,设置shader虚拟机里面的纹理符号 为对应纹理槽
- 产生纹理
- shader纹理符号
- 设置操作
- 一个简单的证明
现在Shader,Texture 元素将不会被循环call use,而是在窗口循环call之前调用一次2. 增加了动态元素
现在,SimpleData将会在窗口循环事件中循环call use()3. 增加了Element初始化附加操作的lambda表达
所有的附加lambda表达都将会在use()之后执行
#include2. 实现多张Texture的使用 1. 将texture绑定gl状态机不同的TextureCode#include #include #include #include int main(int argc, char *argv[]) { baseWindow window; Shader shader("vertex","fragment"); TextureData data1("test"); Texture texture1("pp.jpg",0); Texture texture2("p2.jpg",1); Texture texture3("p3.png", 2); shader.addOp([=](shared_ptr sb) { shared_ptr sd = static_pointer_cast (sb); sd->setInt("ourTexture1", 0); sd->setInt("ourTexture2", 2); }); window.addStaticElement(make_shared (texture1)); window.addStaticElement(make_shared (texture2)); window.addStaticElement(make_shared (texture3)); window.addStaticElement(make_shared (shader)); window.addDynamicElement(make_shared (data1)); window.run(); return 0; }
在gl状态机里面提供的纹理槽有很多
第一步你需要先激活某个纹理槽,然后再在这个纹理槽里面绑定数据
值得注意的是,你必须得有一个活着的shader虚拟机,你才能向里面设置这些状态,也就是说你必须use()
我们直接使用mix函数来进行测试
Nice!



