Reputation: 14066
I want to draw a 2d rectangle in the shaperenderer. That is ok. But I want to create on this rectangle a custom shader.
So I dont need texture on it, I only want a rectangle with custom shader. Is it possible? How?
My rectangle now is a gradient. I want to draw my shader on this gradient...
Upvotes: 2
Views: 609
Reputation: 1593
The ShapeRenderer
class has a constructor where you can pass in your own ShaderProgram
if you do not want to use the default. However, you cannot set the ShaderProgram
on the fly like you can when using a SpriteBatch
to render your stuff.
View the source of ShapeRenderer
and ImmediateModeRenderer20
class to see how the default shaders are applied. Then adjust to your needs an create an instance of ShapeRenderer
with your adjusted ShaderProgram
.
Upvotes: 2