java - Libgdx dim screen with glClearColor -


i want draw background, overlay 0.5f transparent black color dim , render on top of pause menu.

i have tried:

    gdx.gl.glclearcolor(0f, 0f, 0f, 0.5f);     gdx.gl.glclear(gl20.gl_color_buffer_bit); 

and nothing working. couldn't find solution online. other option overlay black sprite, don't want that. there anyway paint on gl?

well, draw transparent rectangle

    gdx.gl.glenable(gl20.gl_blend);     gdx.gl.glblendfunc(gl20.gl_src_alpha, gl20.gl_one_minus_src_alpha);     shaperenderer.begin(shaperenderer.shapetype.filled);     shaperenderer.setcolor(new color(0, 0, 0, 0.5f));     shaperenderer.rect(0, 0, screenwidth, screenheight);     shaperenderer.end();     gdx.gl.gldisable(gl20.gl_blend); 

hope helps


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -