O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Have a go hero – Creating a supporting border for RegularPolygon

What is returned by updatePaintNode() may not just be a single QSGGeometryNode  but also a larger tree of QSGNode items. Each node can have any number of child nodes. By returning a node that has two geometry nodes as children, you can draw two separate shapes in the item:

As a challenge, extend RegularPolygon to draw not only the internal filled part of the polygon but also an edge that can be of a different color. You can draw the edge using the GL_QUAD_STRIP drawing mode. Coordinates of the points are easy to calculate—the points closer to the middle of the shape are the same ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required