I'm using QOpengGLWidget to render a defaultFrameBufferObject,This is my fragment shader:
#version 430 core
layout(location = 2) uniform sampler2D texDisplay;
in vec2 texVert;
out vec4 color;
void main(){
float co = texture2D(texDisplay, texVert).r;
vec3 cube= vec3(1.0f,0.0f,1.0f);
cube *= co;
color = vec4(cube,1.0f);
}
When cube
set the value to vec3(1.0f, 0.0f,0.0f) / vec3(1.0f, 1.0f,0.0f) / vec3(1.0f, 0.0f,1.0f)
, all these values work well that there will be the corresponding color. If cube
is set to vec3(0.0f,1.0f,1.0f)
or value in which the red channel of the cube is zero, I just get a black window, why does this happen?