I’m trying to draw a 2D grid that can have arbitrary squares filled in (eventually this will be drawn to a texture and projected onto terrain, but I’m just trying to get it to draw to the screen now.) The grid is working fine (using the LineSegs class) but I’m not able to get any of the filling squares to display. The code I’m using for this is below:
filledSquares = [
(2, 2, Vec4(0, 255, 0, 255)),
(2, 3, Vec4(0, 0, 255, 255)),
(2, 4, Vec4(255, 0, 0, 255))
]
meshDrawer = MeshDrawer2D()
meshDrawer.setBudget(1000)
meshDrawer.begin()
for square in filledSquares:
square = filledSquares[0]
meshDrawer.rectangle(square[0] * squareSize, square[1] * squareSize, squareSize, squareSize, 0, 0, 0, 0, square[2])
meshDrawer.end()
squareNode = meshDrawer.getRoot()
squareNode.reparentTo(render)