A method for rendering a computer generated image using a stencil buffer, comprising: receiving an arbitrary closed polygonal contour, the contour having N vertices; dividing the arbitrary closed polygonal contour into primitives, each primitive being a polygon having at least 3 and at most P vertices where 2<P<N; and using a stencil buffer to render the primitives to produce a computer generated image; wherein dividing comprises: i) selecting a vertex of the arbitrary closed polygonal contour as a first index vertex and setting a source contour as the arbitrary closed polygonal contour; ii) outputting a primitive of Q vertices using the index vertex and (Q-1) contiguous successive vertices of the source contour; iii) forming a reduced source contour by removing from the source contour the (Q-2) vertices between the index vertex and the end vertex of the outputted primitive; iv) setting the end vertex of the outputted primitive as the index vertex; v) repeating steps (ii) to (iv) until the end of the source contour; vi) selecting a vertex of the reduced source contour as an index vertex and setting the source contour as the reduced source contour; vii) repeating steps (ii) to (v) until either the reduced source contour is outputted as a primitive or until the reduced source contour has trivially zero area. receiving an arbitrary closed polygonal contour, the contour having N vertices; dividing the arbitrary closed polygonal contour into primitives, each primitive being a polygon having at least 3 and at most P vertices where 2<P<N; and using a stencil buffer to render the primitives to produce a computer generated image; wherein dividing comprises: i) selecting a vertex of the arbitrary closed polygonal contour as a first index vertex and setting a source contour as the arbitrary closed polygonal contour; ii) outputting a primitive of Q vertices using the index vertex and (Q-1) contiguous successive vertices of the source contour; iii) forming a reduced source contour by removing from the source contour the (Q-2) vertices between the index vertex and the end vertex of the outputted primitive; iv) setting the end vertex of the outputted primitive as the index vertex; v) repeating steps (ii) to (iv) until the end of the source contour; vi) selecting a vertex of the reduced source contour as an index vertex and setting the source contour as the reduced source contour; vii) repeating steps (ii) to (v) until either the reduced source contour is outputted as a primitive or until the reduced source contour has trivially zero area. i) selecting a vertex of the arbitrary closed polygonal contour as a first index vertex and setting a source contour as the arbitrary closed polygonal contour; ii) outputting a primitive of Q vertices using the index vertex and (Q-1) contiguous successive vertices of the source contour; iii) forming a reduced source contour by removing from the source contour the (Q-2) vertices between the index vertex and the end vertex of the outputted primitive; iv) setting the end vertex of the outputted primitive as the index vertex; v) repeating steps (ii) to (iv) until the end of the source contour; vi) selecting a vertex of the reduced source contour as an index vertex and setting the source contour as the reduced source contour; vii) repeating steps (ii) to (v) until either the reduced source contour is outputted as a primitive or until the reduced source contour has trivially zero area.