Hello,
I have a some trouble with Mesh, can't figure out how to show it.
My code:
local screenOffsetX = application:getLogicalTranslateX() / application:getLogicalScaleX()
local screenOffsetY = application:getLogicalTranslateY() / application:getLogicalScaleY()
local backgroundMesh = Mesh.new()
backgroundMesh:setVertex(1, 0 - screenOffsetX, 0 - screenOffsetY)
backgroundMesh:setVertex(2, application:getLogicalWidth() - screenOffsetX, 0 - screenOffsetY)
backgroundMesh:setVertex(3, application:getLogicalWidth() - screenOffsetX, application:getLogicalHeight() - screenOffsetY)
backgroundMesh:setColor(1, 0x127ef8)
backgroundMesh:setColor(2, 0x127ef8)
backgroundMesh:setColor(3, 0x127ef8)
stage:addChildAt(backgroundMesh, 1)
I can't see anything, what I'm doing wrong?
Thank you
Comments
Unfortunately no, thats is the limitation of the Mesh, that it can only be draw in triangles, thus you will need a triangulation algorithm to draw complex shapes.
For rectangle you would need two triangles.