### OpenCL Procedural Grass and Terrain Example ###
This example shows how OpenCL can be used to create a procedural field of
grass on a generated terrain model which is then rendered with OpenGL.
Because OpenGL buffers are shared with OpenCL, the data can remain on the
graphics card, thus eliminating the API overhead of creating and submitting
the vertices from the host.
All geometry is generated on the compute device, and outputted into
a shared OpenGL buffer. The terrain gets generated only within the
visible arc covering the camera's view frustum to avoid the need for
culling. A page of grass is computed on the surface of the terrain as
bezier patches, and flow noise is applied to the angle of the blades
to simulate wind. Multiple instances of grass are rendered at jittered
offsets to add more grass coverage without having to compute new pages.
Finally, a physically based sky shader (via OpenGL) is applied to
the background to provide an environment for the grass.
Note that the .cl compute kernel file(s) and shader files (.vert and .frag)
are loaded and compiled at runtime. The example source assumes that these
files are in the same path as the built executable.
Mac OS X v10.6 or later
Mac OS X v10.6 or later with OpenCL 1.0
CHANGES FROM PREVIOUS VERSIONS:
- First version.
Copyright (C) 2008 Apple Inc. All rights reserved.
© 2011 Apple Inc. All Rights Reserved. (Last updated: 2011-01-12)