Skip to main content

The Open Graphics Library (OpenGL)

  • Chapter
  • First Online:
Introduction to Computer Graphics

Abstract

The OpenGL is a graphics programming interface that has become very widespread in recent decades due to its open concept and platform independence. Drivers of common graphics processors and graphics cards for the major operating systems support the OpenGL. After a brief overview of existing programming interfaces for graphics applications, this chapter explains the basics of the Open Graphics Library (OpenGL) in detail. The functionality is presented in such detail to enable an understanding and classification of the basic concepts of computer graphics contained in the following chapters. At the same time, this chapter can serve as a concise reference book about the OpenGL. This is limited to the OpenGL variant for desktop operating systems. Furthermore, this chapter contains basic Java programming examples for graphics programming with and without shaders.

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 EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.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

Notes

  1. 1.

    Since drivers for graphics processors only support OpenGL up to a certain version or a limited number of OpenGL extensions, a proportion of hardware-dependent programming code may still be necessary. Depending on the specific application, a large part of the graphics application will still be programmable independently of GPUs using OpenGL.

  2. 2.

    In the OpenGL specification, a regular (uniform) grid consisting of square elements is assumed for simplicity. In special OpenGL implementations, the elements may have other shapes.

  3. 3.

    For details, see, for example, https://www.khronos.org/opengl/wiki/Early_Fragment_Test.

  4. 4.

    See https://www.khronos.org/opengl/wiki/Fragment_Shader for details.

  5. 5.

    Introductions to Unified Modelling Language (UML) class diagrams can be found, for example, in [11].

  6. 6.

    This mechanism is based on the observer design pattern, also called listener pattern. Details of this design pattern are, for example, in [2].

  7. 7.

    Please remember matrix multiplication is not commutative, i.e., the order of the operants must not be reversed.

  8. 8.

    References to the OpenGL Extensions can be found at the web address https://www.khronos.org/registry/OpenGL/.

  9. 9.

    So-called extension viewers show which OpenGL versions and which extensions are available on a particular computer system. The company Realtech VR, for example, provides such software at https://realtech-vr.com.

  10. 10.

    For introductions to Unified Modelling Language (UML) sequence diagrams, see, for example, [11].

  11. 11.

    An alternative representation of the command syntax can be found in [5, p. 73].

  12. 12.

    Since switching shader programs means a certain workload for the GPU, the number of switching operations can be minimised by using identical shader programs and sorting the 3D objects appropriately before drawing.

  13. 13.

    In the JOGL version 2.3.2 from 2015, SPIR-V is not supported.

  14. 14.

    The class ShaderProgram is not to be confused with the class of the same name of the JOGL binding. The class used here, together with the entire example program, can be found in the supplementary material to the online version of this chapter.

  15. 15.

    In fact, glBindBuffer(GL.GL_ARRAY_BUFFER, ...) does not change the state of a vertex array object (VAO). However, an assignment to a vertex array buffer takes place indirectly through the command glVertexAttribPointer.

  16. 16.

    Implementations of some graphics card drivers may deliver the desired result in such a case even without a VAO. For maximum compatibility, however, a VAO should always be used.

  17. 17.

    The maximum frame rate can be set to values other than 60 frames per second in the JOGL examples JoglBasicStartCodeFFP and JoglBasicStartCodePP in the class for the main windows.

References

  1. J. F. Blinn. “Models of light reflection for computer synthesized pictures”. In: Proceedings of the 4th annual conference on Computer graphics and interactive techniques. SIGGRAPH ’77. ACM, 1977, pp. 192–198.

    Google Scholar 

  2. E. Gamma, R. Helm, R. Johnson and J. Vlissides. Design Patterns: Elements of Reusable Object-Oriented Software. Pearson Education India, 2015.

    Google Scholar 

  3. J. F. Hughes, A. van Dam, M. MaGuire, D. F. Sklar, J. D. Foley, S. K. Feiner and K. Akeley. Computer Graphics. 3rd edition. Upper Saddle River, NJ [u. a.]: Addison-Wesley, 2014.

    Google Scholar 

  4. J. Kessenich, D. Baldwin and R. Rost. The OpenGL Shading Language, Version 4.60.6. 12 Dec 2018. Specification. Abgerufen 2.5.2019. The Khronos Group Inc, 2018. URL: https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.pdf.

  5. J. Kessenich, G. Sellers and D. Shreiner. OpenGL Programming Guide. 9th edition. Boston [u. a.]: Addison-Wesley, 2017.

    Google Scholar 

  6. A. Nischwitz, M. Fischer, P. Haberäcker and G. Socher. Computergrafik. 4. Auflage. Computergrafik und Bildverarbeitung. Wiesbaden: Springer Vieweg, 2019.

    Google Scholar 

  7. B. T. Phong. “Illumination for Computer Generated Pictures”. In: Commun. ACM 18.6 (1975), pp. 311–317.

    Google Scholar 

  8. R. J. Rost and B. Licea-Kane. OpenGL Shading Language. 3rd edition. Upper Saddle River, NJ [u. a.]: Addison-Wesley, 2010.

    Google Scholar 

  9. M. Segal and K. Akeley. The OpenGL Graphics System: A Specification (Version 4.6 (Compatibility Profile) - October 22 2019. Abgerufen 8.2.2021. The Khronos Group Inc, 2019. URL: https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.compatibility.pdf.

  10. M. Segal and K. Akeley. The OpenGL Graphics System: A Specification (Version 4.6 (Core Profile) - October 22, 2019). Abgerufen 8.2.2021. The Khronos Group Inc, 2019. URL: https://www.khronos.org/registry/OpenGL/specs/gl/glspec46.core.pdf.

  11. M. Seidl, M. Scholz, C. Huemer and Gerti Kappel. UML @ Classroom: An Introduction to Object-Oriented Modeling. Heidelberg: Springer, 2015.

    Google Scholar 

  12. G. Sellers, S. Wright and N. Haemel. OpenGL SuperBible. 7th edition. New York: Addison-Wesley, 2016.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Karsten Lehn .

2.1 Electronic supplementary material

Below is the link to the electronic supplementary material.

Supplementary material 1 (zip 150 KB)

Rights and permissions

Reprints and permissions

Copyright information

© 2023 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Lehn, K., Gotzes, M., Klawonn, F. (2023). The Open Graphics Library (OpenGL). In: Introduction to Computer Graphics. Undergraduate Topics in Computer Science. Springer, Cham. https://doi.org/10.1007/978-3-031-28135-8_2

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-28135-8_2

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-28134-1

  • Online ISBN: 978-3-031-28135-8

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics