官术网_书友最值得收藏!

Chapter 5. Graphics with Qt

When it comes to graphics, we have so far been using only ready-made widgets for the user interface, which resulted in the crude approach of using buttons for a tic-tac-toe game. In this chapter, you will learn about much of what Qt has to offer with regard to custom graphics. This will let you not only create your own widgets, incorporating content that is entirely customized, but also integrate multimedia in your programs. You will also learn about employing your OpenGL skills to display fast 3D graphics. If you are not familiar with OpenGL, this chapter should give you a kick-start for further research in this topic. By the end of the chapter, you will be able to create 2D and 3D graphics for your games using classes offered by Qt and integrate them with the rest of the user interface.

When it comes to graphics, Qt splits this domain into two separate parts. One of them is raster graphics (used by widgets, for example). This part focuses on using high-level operations (such as drawing lines or filling rectangles) to manipulate colors of a grid of points that can be visualized on different devices, such as images or the display of your computer device. The other is vector graphics, which involves manipulating vertices, triangles, and textures. This is tailored for maximum speed of processing and display using hardware acceleration provided by modern graphics cards. Qt abstracts graphics by using the concept of a surface that it draws on. The surface (represented by the QSurface class) can be of one of two types—RasterSurface or OpenGLSurface. The surface can be further customized using the QSurfaceFormat class, but we will talk about that later as it is not important right now.

主站蜘蛛池模板: 荥阳市| 普定县| 武隆县| 渑池县| 林甸县| 新巴尔虎右旗| 库尔勒市| 柳江县| 阜宁县| 新宁县| 阿勒泰市| 洛南县| 丰镇市| 思茅市| 通城县| 酒泉市| 南平市| 大丰市| 平舆县| 潍坊市| 志丹县| 平罗县| 岳西县| 博爱县| 泸定县| 定襄县| 宣化县| 云安县| 曲水县| 林西县| 礼泉县| 祁东县| 漳浦县| 恩平市| 宜阳县| 岳西县| 伊春市| 兴海县| 嘉鱼县| 定襄县| 德钦县|