This computer graphics design and computer aided design site aims to provide book reviews and free ebook on 3d computer graphics, opengl tutorial, opengl 3d, 3d design, vrml examples, vrml tutorials, xlib tutorial, adobe photoshop tutorial, illustrator, dreamweaver
and coreldraw tutorial.

OpenGL Simple Shading Example -Sample Chapter

Now that we’ve described the OpenGL Shading Language, let’s look at a simple example. In this example, we apply a brick pattern to an object. The brick pattern is calculated entirely within a fragment shader. If you’d prefer to skip ahead to the next chapter for a more in-depth discussion of the API that allows shaders to be defined and manipulated, feel free to do so.
The shader for rendering a procedural brick pattern was the first interesting shader ever executed by the OpenGL Shading Language on programmable graphics hardware. It ran for the first time in March 2002, on the 3Dlabs Wildcat VP graphics accelerator. Dave Baldwin published the first GLSL brick fragment shader in a white paper that described the language destined to become the OpenGL Shading Language. His GLSL shader was based on a RenderMan shader by Darwyn Peachey that was published in the book, Texturing and Modeling: A Procedural Approach. Steve Koren and John Kessenich adapted Dave’s shader to get it working on real hardware for the first time, and it has subsequently undergone considerable refinement for inclusion in this book.
This example, like most of the others in this book, consists of three essential components: the source code for the vertex shader, the source code for the fragment shader, and the application code that initializes and uses these shaders. This chapter focuses on the vertex and fragment shaders. The application code for using these shaders is discussed in Section 7.13, after the details of the OpenGL Shading Language API have been discussed.

Followers