O'Reilly logo

3D Game Programming for Teens, Second Edition by Eric Grebler, Maneesh Sethi

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

Coloring

So far, you’ve created simple shapes that have been white but appear slightly shaded because of the light source. You’ll now learn how to apply a color to your shapes. Once again, start by opening the file “cone” that we created earlier. The EntityColor command allows you to apply color to an object. Here we will give our cone a color:

; This is the code for creating and coloring the cone
cone=CreateCone()
PositionEntity cone,0,0,5
EntityColor cone, 125,201,190

After you enter the code EntityColor, you enter the name of the entity you want to color—in this case, it is called cone. You’ll then notice three numbers—in this case, 125,201,190—which represent the red, green, and blue values. In this case, the 125 would be the red value, ...

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