//pixelcolour with ambient
//pixelcolour = vec4( textureshade*shadescale + ambient* textureshade+ textureshade*diffuseshadescale, 1.0 );
//ambient
pixelcolour += vec4(ambient*textureshade,1.0);
//diffuse
//pixelcolour += vec4(textureshade*diffuseshadescale, 1.0);
//ambient && diffuse
//pixelcolour += vec4( ambient* textureshade+ textureshade*diffuseshadescale, 1.0 );
//ambient && specular
//shadescale= pow(dot(h,nn),shinyness);
//pixelcolour += vec4 ( textureshade*shadescale + ambient* textureshade, 1.0 );
//specular && diffuse
//shadescale= pow(dot(h,nn),shinyness);
//pixelcolour += vec4 ( textureshade*shadescale + textureshade*diffuseshadescale , 1.0 );
//ambient && specular && diffuse
//shadescale= pow(dot(h,nn),shinyness);
//pixelcolour += vec4 ( textureshade*shadescale + textureshade*diffuseshadescale + ambient*textureshade, 1.0); 上面的代码使用不同的计算来显示照明,在我有的像素着色器文件中。我需要从键盘控制它,它需要在main中声明,例如,VK_A将在我拥有的不同模式之间循环。我该如何去实现它呢?
你们通常如何添加键盘控制来改变这一点?谢谢
发布于 2011-03-12 01:55:34
为每种模式编译单独版本的着色器,可以手动编写着色器,也可以使用字符串操作来生成每组源代码。
在应用程序中,在渲染受影响的几何体之前,跟踪当前模式并在设备上设置适当的着色器。
你有没有遇到一些更具体的问题?
发布于 2011-03-12 06:03:23
使用多个着色器的另一种方法是使用着色器中的均匀着色器在不同代码路径之间进行选择,并根据键盘输入循环该均匀着色器的值。
https://stackoverflow.com/questions/5276444
复制相似问题