【发布时间】:2022-10-14 03:37:26
【问题描述】:
我如何在opengl语言中使用keydown事件,在这里我粘贴了一些部分代码但它不起作用,任何人都可以帮助修复此代码。
bool keypress(int key) {
return texelFetch(texture2D, ivec2(key,2),0).x != 0.0; }
// in above code texture2D was iChannel0 so i change to texture2D according to my script but i think i mistake is this line
const int k = 17; // 17 for CTRL
void main()
{
vec2 p = gl_FragCoord.xy;
vec2 uv = p / resolution.xy;
float blend = 1.9-pow(1.5*cos(time/8.0),5.0);
vec3 cul = texture2D(media, uv).rgb;
vec3 col = texture2D(media, uv).rgb;
if (keypress(k)) col = mix(cul,col,blend);
gl_FragColor = vec4(col, 1.0);
}
当我按 CTRL 键时,它不会执行此 ==>> col = mix(cul,col,blend);
我不知道我错在哪里。
【问题讨论】:
标签: javascript java html css