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.https://192168ll.onl/ https://xender.vip/ https://testmyspeed.onl/
.. well nothing. The game runs but the shape is invisible.
Last edited by JigneshTapase on Tue Jul 16, 2019 9:55 pm, edited 1 time in total.
JigneshTapase
 
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!
evilentity
 
Posts: 4854
Joined: Wed Aug 24, 2011 11:37 am


Return to Libgdx

Who is online

Users browsing this forum: MSN [Bot] and 1 guest