In this recipe we create a simple fragment shader that will allow you to cycle the color on our textured cube.
Load PlayStation Mobile Studio and create a new project. Once again, this recipe's code will build off the code from the prior recipe, so simply copying that project is the easiest way to start. If you decide to create a new project, be sure to copy the crate.png
texture over, as well as the code from AppMain.cs
. The complete project is available as Ch7_Example4
.
Add
AppMain.cs
and, assuming you copied the code from the prior recipe, changeMain
to match the following (changes are highlighted):public static void Main (string[] args){ var graphics = new GraphicsContext (); graphics.SetClearColor (0.0f, 0.0f, 0.0f, 0.0f); Camera camera = new Camera(45.0f,graphics.Screen.AspectRatio,new Vector3(0.0f,1.0f,-3.0f),new Vector3(0.0f,0.0f,0.0f)); var vertexBuffer = MakeCube(); var texture = new Texture2D("/Application/crate...