Nicola Pezzotti

Research Scientist and Engineer in Machine Learning and Visual Analytics

Follow me on GitHub

OpenGL Sandbox - My first shader

14 Mar 2014

Here it is the rendering of the Utah Teapot and the Stanford Dragon rendered with my first shader. 



It's a very simple shader and it does not create any light source in the scene. The depth perception is given by the coloration of the triangles. As you can see in the teapot image, each triangle is colored using a blend of the axes color given by the triangle's normal vector.

The shader's code is straightforward:


Here below the code which passes the vertex attributes to the shader is presented. Qt helper classes are a good choice in order to write quickly a more readable code. For this reason I will use this approach whenever it's possible