Putting a border frame on the image
Pictures look best in a frame. Let's add one now. There are a number of ways to accomplish this, but we are going to use shaders. The frame will also be used for the thumbnail images and will enable us to change colors to highlight when the user selects an image. Furthermore, it helps define a region of contrast, which ensures that you can see the edge of any image on any background.
Border shaders
We can start by writing the shader programs which, among other things, define the variables they will need from the Material
object that uses it.
If necessary, create a resource directory for the shaders, res/raw/
. Then, create the border_vertex.shader
and border_fragment.shader
files. Define them as follows.
The border_vertex ...
Get Cardboard VR Projects for Android now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.