Getting ready
Set up your OpenGL program to provide the vertex position in attribute location 0 and the vertex normal in attribute location 1. As with the previous recipe, we'll need to provide the model matrix in the uniform variable ModelMatrix.
Load the cube map using the technique shown in the previous recipe. Place it in texture unit zero.
Set the uniform variable WorldCameraPosition to the location of your viewer in world coordinates. Set the value of the uniform variable Material.Eta to the ratio between the index of refraction of the environment n1 and the index of refraction of the material n2 (n1/n2). Set the value of the uniform Material.ReflectionFactor to the fraction of light that is reflected at the interface (a small value ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access