user796820
user796820

Reputation:

Drawing a partially transparent Pixmap to a Texture (libgdx)

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.

Upvotes: 0

Views: 1699

Answers (1)

user796820
user796820

Reputation:

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.

Upvotes: 2

Related Questions