The clip function

Hi ! I noticed that the clip function gets it’s arguments in absolute position, which means it is not affected by the translate and rotate functions. Is there a way to change that ?

Thanks.

no, the only way is for you is to read the current position matrix data and compute your clip coordinates from it.

Thanks :slight_smile: why haven’t I thought of it before !

Here is my code from a while back. Rotate doesn’t affect it, but it transforms and scales correctly

_clip = clip
function clip(x, y, w, h)
    if x ~= nil then
        local m = modelMatrix()
        x = x * m[1] + m[13]
        y = y * m[6] + m[14]
        w = w * m[1]
        h = h * m[6]
        _clip(x, y, w, h)
    else
        _clip()
    end
end