A vertex s position is defined using three dimensions
A vertex s position is defined using three dimensions (x,y,z), while a texture coordinate can potentially be expressed in three dimensions (although typically only s and t are used). We define a plane for each of the texture coordinates (s, t, and sometimes r). The s texture coordinate is given by a vertex s position relative to the s plane, the t coordinate is given by a vertex s position relative to the t plane, and so on. Planes are defined by specifying the direction of the vector perpendicular (normal) to the plane. For example, to create our mapping from y vertex coordinate to s texture coordinate: TexCoordGeneration texGen = new TexCoordGeneration( TexCoordGeneration.OBJECT_LINEAR, TexCoordGeneration.TEXTURE_COORDINATE_2, new Vector4f( 0, (float) (1.0/(2 * yMaxHeight)), 0, 0.5f ), new Vector4f( 0,0,0,0 ), new Vector4f( 0,0,0,0 ) ); The parameters to the TexCoordGenerationconstructor do the following: 1. Specify the texture coordinate generation mode that we are using, in this case, OBJECT_LINEAR. 2. Specify that we are generating 2D texture coordinates (s and t). 3. Define the mapping from vertex coordinate to s coordinate. 4. Define the mapping from vertex coordinate to t coordinate. 5. Define the mapping from vertex coordinate to r coordinate (which is unused when 2D texture coordinates are used). The mapping from vertex coordinates to s coordinates we defined was: (0, (float) (1.0/ (2 * yMaxHeight)), 0, 0.5f) This equates to: s texture coordinate = (0.0 * vertex x) + (1.0/ 2 * yMaxHeight * vertex y) + (0.0 * vertex z) + 0.5; 240
Note: If you are looking for good and high quality web space to host and run your application check Lunarwebhost Tomcat Web Hosting services