Круть, только:
i = 8
Repeat
i = i+1
If GraphicsWidth() <= 2^i
TexW = 2^i
Exit
End If
Forever
i = 8
Repeat
i = i+1
If GraphicsHeight() <= 2^i
TexH = 2^i
Exit
End If
Forever
логичнее заменить на:
Local LOG2Den#=1/Log(2)
TexW=2^Ceil(Log(GraphicsWidth())*LOG2Den)
TexH=2^Ceil(Log(GraphicsHeight())*LOG2Den)