【发布时间】:2018-10-27 00:27:31
【问题描述】:
给定:
我有 x.png 图像,其中包含 4 个像素(让它为正方形),颜色为:红色、绿色、蓝色和 4-th 是透明的。
必填:
我需要找到glEnable() 和/或glBlendFunc() 的参数组合,这将产生以下效果:
1)纹理应用没有“平滑”,只是锐利的像素边缘。
2) Transtarent 像素是透明的。
当前代码库:
def set_3d(self):
...
glEnable(GL_BLEND)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)
glTranslatef(x, y, z) # for getting scale image
...
# + here is adding background rect(blue) and rect with 4 pixels
def add_alpha_rect(self, batch):
... # getting textures, etc.
batch.add(
4, GL_QUADS,
texture_group,
('v3f', (x, y, z,
x_, y, z,
x_, y_, z
x, y_, z)),
('t3f', (0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0)))
当前结果:
预期结果:
问题:
我怎样才能达到这个结果?
有可能吗?
【问题讨论】: