PRIMER 22.1

Brief Description of 3D Vs 2D Graphics

Brief Description of 3D vs. 2D Graphics

In 2D mode PRIMER treats the display device as a dumb 2D device on which lines, polygons and text can be drawn. All coordinates are expressed in 2D integer space, ie [x,y] only, and all calculation of hidden-surface removal, lighting, etc must be done in software. Dynamic viewing relies on the software recalculating and redisplaying images quickly.

In 3D mode much more intelligence is available in the graphics driver, and much of the effort of computing images can be shifted from the software to the hardware. In particular:

  • Graphics coordinates exist in 3D [x,y,z] space, and the hardware does the transformation and projection onto the 2D screen. The software only has to provide the raw coordinates for an image once, and thereafter to change the view only a new scale, centre and rotation matrix.
  • The hardware can compute shading, lighting and hidden-surface removal. So, again, the software only needs to provide raw coordinates, topology, light source data, etc, and then just ask the hardware to render it.
  • The hardware can provide functions, such as Z-clipping, that are not available in software.

So 3D devices, especially those with hardware acceleration, give much faster graphics.

However there are also drawbacks to using 3D graphics: more memory is required since the full scene has to be sent to the driver using [x,y,z] floating-point coordinates. In addition laser plots cannot be generated by the 3D driver, so the capability to switch temporarily back to 2D mode has to be preserved.

Therefore there are options to control aspects of 3D graphics, and also the ability to switch back and forth between 3D and 2D modes.