Reputation: 3960
I want to draw filled polygon in Andengine gles2.
I have vertices of polygon. How I can draw it? The problem is that it can have any number of vertices (4, 30).
Next problem is that I want fill this polygon with my image(or just color if not possible).
Can' t find any function for this. Is it possible ?
Upvotes: 2
Views: 1617
Reputation: 4312
This way you can create polygon with repeating image in it.
final float offsetX = 0f;
final float offsetY = 115f;
final float[] vertexX1 = { 200f-offsetX, 400f-offsetX, 300f-offsetX, 200f-offsetX};
final float[] vertexY1 = { 200f-offsetY, 200f-offsetY, 300f-offsetY, 300f-offsetY};
final TexturedPolygon myRepeatingSpriteShape = new TexturedPolygon(offsetX, offsetY, vertexX1, vertexY1, myTextureRegion, this.getVertexBufferObjectManager());
mScene.attachChild(myRepeatingSpriteShape);
This implementation was created by one of the community member recastrodiaz. I think this will solve your problem.
Upvotes: 2