Drawing a partially transparent Pixmap to a Texture (libgdx)

旧城冷巷雨未停 提交于 2020-01-25 20:39:31

问题


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);

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


回答1:


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.

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.



来源:https://stackoverflow.com/questions/15314660/drawing-a-partially-transparent-pixmap-to-a-texture-libgdx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!