Help using Shaders with ShapeRenderer

Anything libgdx related goes here!

Help using Shaders with ShapeRenderer

Postby JigneshTapase » Fri Jul 12, 2019 6:36 am

Hey everyone! I'm trying to understand how to apply shaders to shapes drawn with the ShapeRenderer. My ultimate goal is to be able to draw polygons with (n) sides that have glowing, pulsing effects both as actors in the game but also as particles. I haven't been able to figure out how to get a shader to apply to ShapeRenderer, and I assume that's because I have no idea what I'm doing (this is my first time doing anything with shaders).

I've created a simple Game class to test this out, as well as 2 basic shaders. What I expect to happen is that when the game runs there is a blue circle rendered at 100 x 100 (even though the color is set to Black in the ShapeRenderer). Instead what I see is... well nothing. The game runs but the shape is invisible.
Posts: 1
Joined: Fri Jul 12, 2019 6:32 am

Re: Help using Shaders with ShapeRenderer

Postby evilentity » Fri Jul 12, 2019 11:42 am

Copy paste shader from ImmediateModeRenderer20 and use that. Shader must much this template or it likely wont work.
Looking for a freelancer? PM me!
Check out libgdx discord server!
Posts: 4806
Joined: Wed Aug 24, 2011 11:37 am

Return to Libgdx

Who is online

Users browsing this forum: No registered users and 1 guest