For n = 2 To (mOpenGL.datasetinfo.xsize * 2) Step 2
glPushMatrix
glRotatef 20#, 0#, 1#, 0#
glBegin bmLineStrip
glColor3f 1#, 0#, 0#
glVertex3f n + 0.5, world(i, n) + 1#, i
glVertex3f n + 0.5, world(i, n) + 1#, 1 + i
glVertex3f n, world(i, n) + 1#, i + 0.75
glVertex3f n + 1#, world(i, n) + 1#, i + 0.75
glVertex3f n + 0.5, world(i, n) + 1#, 1 + i
glEnd
glPopMatrix
Next n
I have a feeling it just has to do with the way I''m drawing, since I''m not changing the pivot point at any time, while I draw the actual terrain. For a proper rotation, I need to have the pivot point in the center of the object, correct? Do I need to use glTranslatef instead of drawing the vertices using the step values?
An image showing my problem can be found at:
http://minion.jaggedsoft.com/field.jpg
Any ideas? I know I''m really overlooking something, but right now, I just cant see what. I know it has to do with the pivot point for the rotation, but what is the obvious fix for it? I''m beginning to run out of time on this program, unfortunately.
TIA,
Chris
OpenGL: Rotation problems
Greetz,
I''m having some problems with rotations in my program. I have a crude terrain program that I''m using to visualize data (depth from a local river). I''m needing to add some kind of direction marker (arrow) over each data point in the terrain mesh to show flow direction. Below is the code I currently have, for the arrows, but it doesnt work, obviously.
January 01, 2001 08:37 AM
I you first do a translate and then rotate do I think that you get what you want. Yes, it seems like you should use glTranslatef insted of drawing the vertices using the step values.
The thing you overlooking is that the order of translate and rotate matters.
The thing you overlooking is that the order of translate and rotate matters.
Greetz,
After playing around some more, and fixing the foolish mistake of rotating before translating, I finally got it working. Now I''m just translating every time an arrow is drawn so the pivot point is changing and the rotation can be done to each individual arrow.
Thanks,
Chris
After playing around some more, and fixing the foolish mistake of rotating before translating, I finally got it working. Now I''m just translating every time an arrow is drawn so the pivot point is changing and the rotation can be done to each individual arrow.
Thanks,
Chris
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement