Duplicate texture stealing code from mac for unix.