Games [SOLVED] [LibGDX] lgPolygonSpriteBatch Texture - Help!!!

wonder

Expert
Licensed User
Longtime User
@Informatix (or any of the other LibGDX/OpenGL gurus out there)...

Using the basic template, I'm able to draw a textured polygon shape.

The problem is, no matter what I try, I can't seem to center and scale the texture to the polygon size...

B4X:
'This kinda works, but I have no idea how to center and scale the texture
'I've tried DrawRegion2 and DrawRegion3 as well
polyBatch.DrawRegion2(reg, 30, 30, 300, 300)


B4X:
'I'd like to try this function, but I have no idea how to add the extra values to ShapeVertices2(),
'as each vertex is required to be composed of 5 elements (x, y, color?, u?, v?)
polyBatch.DrawPolygon(...????????

Capture.PNG

Clearly NOT the expected result!! I'd like the texture to be centered and scaled.

PS: I am well aware of the lgMesh alternative, but it seems more complicated. I'm willing to take a chance at it only if there is no way to solve this problem using lgPolygonBatch.

Attached my test project.
 

Attachments

  • polygonBatch.zip
    34.4 KB · Views: 356

wonder

Expert
Licensed User
Longtime User
Last edited:

ilan

Expert
Licensed User
Longtime User
So... any advance in this?
Is there any way vertices coordinates can be independent from texture size?
If I'm using Box2D and my polygons will be measured in meters, so one meter - one pixel is not good for my purposes :(

just convert your vertices to world coordinates.
 
Top