Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just begun learning shader programing. What I learned is that the rasteriser groups three vertices to form a triangle for doing further operations. If that's true how does the rasteriser determines appropriate vertices which form a triangle in the mesh/geometry? Is it the 3D software which saves geometry in the proper order in model file like .3ds or .obj, .x or is it the GPU which internally triangulates the geometry irrespective of the order the vertices are passed?

share|improve this question
It's been a while, but IIRC .obj stores points in the beginning of the file, and then shapes at the end of the file, so the triangles would have to be formed already. – corsiKa Jul 8 '14 at 22:42
up vote 5 down vote accepted

You tell the GPU how to produce triangles from the input data. You specify vertex buffers containing all your vertex data, you also specify a primitive topology (lines, triangles, et cetera) and an optional index buffer.

The topology tells the GPU how many and what pattern to take the indices in (for example, in sets of three for a triangle list). The indices simply refer directly to entries in the bound vertex buffer.

If you don't specify an index buffer, the GPU takes the data from vertex buffer directly in the pattern indicated by the topology.

Also, strictly speaking, the GPU doesn't do triangularization; by the time you submit the data, it's already expected to be in triangles -- or whatever format your primitive topology demands, like lines or points. Similarly, it's not the rasterizer that handles reading the input arrangements. That's done by the GPU well in advance of the rasterization stage.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.