GPU fragment programs

On machines with graphics chips that support fragment programs, Graphing Calculator on Mac OS X will compile equations for surface color and clipping into OpenGL shaders which run on the GPU. This leads to both higher quality and much faster rendering, since the GPU evaluates the equation at each pixel and has hardware to do so in parallel while rendering the surface. (On machines with older graphics cards, Graphing Calculator evaluates the equations on the CPU once per vertex, rather than once per-pixel. It would be much too slow to do per-pixel function evaluations on the CPU.)

The images below link to pages showing the fragment programs used in drawing the images, and linking to the Graphing Calculator documents which created them. You can download Graphing Calculator Viewer here to open these documents.

Some of these documents show shaders which act as computed textures. The color of the surface is given explicitly as a mathematical function of x, y, and z in Graphing Calculator. Others show shaders which act as a generalization of OpenGL clip planes. Rather than defining the clipping function by giving the equation of a plane, however, Graphing Calculator allows for an arbitrary mathematical inequality to specify which fragments are clipped.

To output the fragment program generated from the equation, select the equation and hold the option key down while choosing "Copy As Shader" from the Edit menu.

If the documents below do not produce the same results on your computer, the graphics chip probably does not support fragment programs.

If you've created any documents using this feature to share with other users, please send them to me at .

 

 

Copyright © 2004 Pacific Tech. All rights reserved.
Home | Products | News | Contact Us | FAQ | Gallery