Graphics Reference
In-Depth Information
their size. This is done by seting the gl_PointSize variable in the fragment
shader. Seting this value has the same efect as calling the OpenGL function
glPointSize( ) . This allows you to emphasize data points with large data
values by making them more visible. An example of doing this is shown in
Figure 15.12.
Cutting Planes
Now that we have created this 3D texture of data values, is there anything else
we can do with it? Yes! One of the most useful ways to visualize 3D data is
with cuting planes . When you pass a cuting plane through a 3D dataset, you
focus on specific planes of interest and leave out other areas that you don't
care about right now. Also, a cuting plane display is a lot less clutered than
a point cloud.
There are two kinds of cuting planes. In one, you interpolate data values
(and thus colors) at each pixel, and in the other, you create contour lines at
a reduced set of pixels. As before, the color interpolation approach requires
some sort of geometry to hang the data on. In this case, we will use the glman
QuadXY primitive, which draws a quadrilateral in the X-Y plane from [-1,-1] to
[1,1], by default at z = 0 (although we will change the z location with a slider).
The vertex shader reads a z value from a slider uniform variable and sets up
the model coordinates of the quadrilateral to be interpolated through the ras-
terizer:
uniform float uZ;
out vec3 vMCposition;
void main( )
{
vMCposition = aVertex.xyz;
vMCposition.z = uZ; // slide the cutting plane in Z
gl_Position = uModelViewProjectionMatrix*
vec4(vMCposition,1.);
}
The fragment shader uses those model coordinates to determine where
each fragment is in texture coordinate space. This process reuses much of the
fragment code from the pointcloud shader:
const float SMIN = 0.;
const float SMAX = 100.;
Search WWH ::




Custom Search