O'Reilly logo

OpenGL ES 2 for Android by Kevin Brothaler

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

Smooth Shading

In Chapter 2, Defining Vertices and Shaders, we learned how to draw objects with a single color in a uniform, as seen in the following image:

images/AddingColor/FlatTriangle.png

We already know that that we’re limited to drawing points, lines, and triangles, and we build everything up from that. Since we’re limited to those three primitives, how can we represent a complex scene with many different colors and shades?

One way we could do it is by using a million small triangles, each with a different color. If we use enough triangles, we can fool the viewer into seeing a nice, complex scene with a rich variation of colors. While this could technically work, the performance ...

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