[英]Shader texture values not the same as written when creating the texture
我创建了一个纹理并用它填充:
size_t size = width * height * 4;
float *pixels = new float[size];
for (size_t i = 0; i < size; ++i) {
pixels[i] = 1.0f;
}
glTextureStorage2D(texture_id, 1, GL_RGBA16F, width,
height);
glTextureSubImage2D(texture_id, 0, 0, 0, width, height, GL_RGBA,
GL_FLOAT, pixels);
我使用线性过滤( GL_LINEAR
)和夹到边框。
但是当我画出图像时:
color = texture(atlas, uv);
最后一行看起来它的alpha值小于1.如果在着色器中我将alpha设置为1:
color.a = 1.0f;
它正确地绘制它。 这可能是什么原因?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.