问题
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