Skip to main content
  • 149 Accesses

Abstract

In this chapter, we will see how we can write graphics programs that are more or less independent of the hardware that is used. If we want to adapt these programs to different kinds of computers, we only have to change a few lines in one of the include files and in the system-dependent module.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Even though the variable poly is a pointer, any change of poly is undone outside the function fill-poly(). We can only change *poly, i.e., the contents of the vector.

    Google Scholar 

  2. For the macros G_move_area() and G-draw_area(), it does not make any difference whether poly is a two-dimensional Vector2 or a three-dimensional Vector, because both types are interpreted as pointers to a float and only the first two elements of the array are taken.

    Google Scholar 

  3. Now we must not write *poly any more, because this would be a float, whereas the macro expects a Vector, i.e., a pointer to a float.

    Google Scholar 

  4. This requires at least 8-bit planes for single buffering and 16-bit planes for double buffering (page flipping).

    Google Scholar 

  5. This requires at least 8-bit planes for single buffering and 16-bit planes for double buffering (page nipping).

    Google Scholar 

  6. The C preprocessor will replace the constant MAX-PAL by the result of the division (MAX-COLORS-COLOR.OFFSET)/PALSIZEevery time it appears in the code. The constants PALSIZEand COLOR-OFFSET aie system-dependent and have to be defined in G_macros.h.

    Google Scholar 

  7. For less experienced C programmers: the operation ++ is done after vertex has been assigned, because ++ stands after prt. Be careful with such abbreviations of the code when you use macros! A typical example of an error that is hard to be found is the line Add_vec(a, a, *b++); (Where a and *b are Vectors.) The value of b will increase by 3 instead of 1 at the end of the line, because the macro Add_vec() will replace this line by 3 lines.

    Google Scholar 

  8. If z points to the coordinate of a vertex stored in coord.pool, z+3 points to the z-coordinate of the following vertex.

    Google Scholar 

  9. Usually, the shift operator works much faster than an ordinary division. If you shift an integer value to the right by 1, this is equivalent to dividing it by 2.

    Google Scholar 

  10. If we deal with large polygons or with polyhedra that approximate smooth surfaces, we can also calculate a shade value for each vertex and interpolate the shades of the pixels between the vertices (see “Gouraud shading” in Section 4.6).

    Google Scholar 

  11. The use of the constant c like in Equation 2 represents a very rough simplification of the law of reflection. It will not place highlighted spots exactly

    Google Scholar 

  12. In our simplified model, the colors of the light sources axe all white.

    Google Scholar 

  13. Since InvRot is a global variable, InvRot[SCREEN.SYST][2] is a constant address, which is evaluated during the compilation.

    Google Scholar 

  14. With this function it does not make any difference whether p and q are of the type Vector2 or of the type Vector. Both types are interpreted as pointers to a float and only the first two elements of the array are used.

    Google Scholar 

  15. It is also possible to use the type Ubyte for the shade. In this case, however, sizeof(Vertex) will be 15 instead of 16. The program runs faster when the size of the structure can be divided by 4.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 1994 Springer Science+Business Media New York

About this chapter

Cite this chapter

Glaeser, G. (1994). Graphics Output. In: Fast Algorithms for 3D-Graphics. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-25798-2_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-662-25798-2_4

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-94288-7

  • Online ISBN: 978-3-662-25798-2

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics