Graphics Programs Reference
In-Depth Information
Figure 4-2 . Triangle primitives using glDrawElements
Now, I describe how to create a rectangle ( Figure 4-3 ) with the help of triangle prim-
itives using glDrawElements . Once again, start by modifying the Renderer class
inside the GL RECTANGLE application ( Chapter3/ ).
Figure 4-3 . Rendering a rectangle using triangles
Inside the initShapes method, remove the duplicate vertices from the vertex ar-
ray rectangleVFA shown in Listing 4-1 . The array rectangleVFA is modified
in Listing 4-7 to define a rectangle with different vertices. To render a rectangle us-
Search WWH ::

Custom Search