Chapter 4. OpenGL Implementation

In this chapter, we will cover the following recipes:

  • Setting up OpenGL in Qt
  • Hello World!
  • Rendering 2D shapes
  • Rendering 3D shapes
  • Texturing in OpenGL
  • Lighting and texture filter in OpenGL
  • Moving an object using keyboard controls
  • 3D Canvas in QML

Introduction

In this chapter, we will learn how to use Open Graphics Library (OpenGL), a powerful rendering Application Program Interface (API), and combine it with Qt. OpenGL is a cross-language, cross platform API for drawing 2D and 3D graphics on screen through the Graphics Processing Unit (GPU) within our computer's graphics chip. In this chapter, we will be learning OpenGL 2.x instead of 3.x, because the fixed-function pipeline is easier for beginners to grasp compared to the ...

Get Qt5 C++ GUI Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.