Not sure mate, it's a bug with the cacti physics that exploits the fact that it can't grow next to a block, hence when the cacti grows from 1 height to 2 it auto drops the new cacti block. Tree's aren't restricted like that as far as I know so would grow up between the glass and if you put a block above it would grow right up to the block.