07-23-2002, 08:19 AM

Hey, I am trying to use OpenGL to implement graphics for another program.

That program creates objects on a coordinate system in which each

coordinate ranges from -100 to 100. Thus, I have had to scale the objects

by 1/100 to get them to fit in the default OpenGL window. My problem is

this: I am now trying to implement transformations for these objects (so

that they will appear at their correct locations and orientations in

space), but the scaling factor is giving me trouble since I have to scale

translations by 1/100 while keeping rotations and scale factors the same

(which gets a little annoying since I'm working from the object

transformation matrices).

I think the easiest way to solve this problem would be to move the camera

way back and render the objects on their original scale. However, I tried

doing this and it didn't seem to work - the objects vanish into the background at a distance of about 3 from the camera. Is there some way to prevent this from happening?

If not, the other approach that I've been trying to use involves separating the object transformation into translation, scaling, and rotation components. The translation and scaling work just fine, but I'm having trouble converting the 3x3 rotation matrix I have into the 4x4 one required by OpenGL. Based on what I've read about the w coordinate, I've been trying to copy the 3x3 matrix into the upper left corner of the 4x4 matrix and then fill out the rest of the 4x4 matrix with zeroes and ones in the pattern of an identity matrix (I then feed this matrix into glMultMatrixd), but this doesn't seem to be working. Am I doing this wrong? Any other good suggestions on how to take a 3x3 matrix and implement that rotation in OpenGL? Would I, for example, be better off trying to calculate the axis and angle of rotation from the 3x3 matrix and using glRotate?

Thanks, Shannon

That program creates objects on a coordinate system in which each

coordinate ranges from -100 to 100. Thus, I have had to scale the objects

by 1/100 to get them to fit in the default OpenGL window. My problem is

this: I am now trying to implement transformations for these objects (so

that they will appear at their correct locations and orientations in

space), but the scaling factor is giving me trouble since I have to scale

translations by 1/100 while keeping rotations and scale factors the same

(which gets a little annoying since I'm working from the object

transformation matrices).

I think the easiest way to solve this problem would be to move the camera

way back and render the objects on their original scale. However, I tried

doing this and it didn't seem to work - the objects vanish into the background at a distance of about 3 from the camera. Is there some way to prevent this from happening?

If not, the other approach that I've been trying to use involves separating the object transformation into translation, scaling, and rotation components. The translation and scaling work just fine, but I'm having trouble converting the 3x3 rotation matrix I have into the 4x4 one required by OpenGL. Based on what I've read about the w coordinate, I've been trying to copy the 3x3 matrix into the upper left corner of the 4x4 matrix and then fill out the rest of the 4x4 matrix with zeroes and ones in the pattern of an identity matrix (I then feed this matrix into glMultMatrixd), but this doesn't seem to be working. Am I doing this wrong? Any other good suggestions on how to take a 3x3 matrix and implement that rotation in OpenGL? Would I, for example, be better off trying to calculate the axis and angle of rotation from the 3x3 matrix and using glRotate?

Thanks, Shannon