Graphics Reference
In-Depth Information
Figure 15.7. Zooming in Cartesian hyperbolic space.
Again, as k goes to zero, the transformations approach the identity, but
as k increases, the hyperbolic effect increases. This approach makes the vertex
shader code simpler, because you do not need to go through the polar coordi-
nate conversion. The Cartesian hyperbolic vertex shader is left as an exercise.
3D Scalar Data Visualization
In this section, we are going to consider passing a 3D volume of data values
into a shader in the form of a 3D texture, so that we can examine the volumet-
ric data. There is a format setup in glman to make this easy for you to do, but
you need to write your data in this file format yourself. To make this easier,
below we give you an example of a short C++ program that writes a 32 × 32 × 32
texture file. This format is actually made to hold a floating-point 4D texture, as
you can see in the actual file write statements, but here we are just using one
of the four components, and leaving the other three empty. Instead of storing
red, green, blue, and alpha (for example), we are just using the red component
to hold a single value.
#include <stdio.h>
#include <math.h>
float ScalarValue( float, float, float );
const int NUMS = 32;
const int NUMT = 32;
const int NUMP = 32;
int
main( int argc, char *argv[ ] )
Search WWH ::




Custom Search