Handling Coordinate System Differences - example 3
[ example 2 ]
Handling Coordinate System Differences - example 3

OpenGL and RenderMan Handedness

You can compensate for the differences between OpenGL's right and RenderMan's left-handedness. When doing rotations, you simply negate the angle of therotation.

In the examples below, theta is declared as a float with avalue of 12 degrees. In the following rotate functions, glRotatef() is given thestraight theta, while RiRotate() is given -theta. Beingable to handle gemoetric transformations in this way allows for the sharing ofone set of data between the two interfaces.


Example 3
void display(void){
/*Rotation about the z axis*/

float theta = 0;

/* Figure 1*/
glRotatef(theta, 0, 0, 1);
/* Figure 2*/
RiRotate(theta, 0, 0, 1);
/* Figure 3 sign change*/
RiRotate(-theta, 0, 0, 1);

drawsquare(1.0, cube_flag);

theta = theta + 12;
}

Figure 1
Figure 2
Figure 3

[ contents ]