本文介绍了将部分透明的Pixmap绘制到纹理(libgdx)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用libgdx,我们需要做些什么来启用将Pixmap绘制到Texture的透明性吗?我尝试在传递Pixmap的纹理的draw()调用之前执行此操作:

Using libgdx, is there something we have to do to enable transparency drawing a Pixmap to a Texture? I've tried doing this before the texture's draw() call where I pass the Pixmap:

Gdx.gl.glClearColor(0.5f, 0.0f, 0.0f, 1.0f);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
Gdx.gl.glEnable(GL10.GL_BLEND);

但是它绘制的是不透明的深红色(glClearColor)颜色,而不是透明的像素.

But it's painting an opaque dark red (glClearColor) color instead of a transparent pixel.

推荐答案

我不知道缺少向纹理绘制透明度的原因,但似乎专门使用了Pixmap(将一个pixmap绘制到另一个更大的pixmap上)解决方案是仅在最后一步渲染到Texture.

I don't know the reason for the lack of transparency drawing to a Texture, but it appears that using Pixmaps exclusively (drawing a pixmap onto another larger pixmap) and only rendering to the Texture as a very last step was the solution.

找不到有关它的信息,因此我只能假定不支持在纹理上绘制透明的Pixmap以与Texture的背景色混合.

Can't find information on it so I can only assume that drawing a transparent Pixmap to a Texture to blend with the Texture's background color isn't supported.

这篇关于将部分透明的Pixmap绘制到纹理(libgdx)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 13:26