PDA

View Full Version : help with a substitue for glulookat



mithun_daa
06-08-2004, 01:11 PM
hello everyone
im tryin to use some transformations instead of glulookat.
my scene contains a terrain. this terrain when read in, has elevations along the z-axis, so i rotate it by 90 degrees so that the elevations show along the y axis. there are some additional rotations added along all the axis and this is makin it very difficult to implement lookat using transformations.

i have a 2d window showin the same terrain. i get the x,y values by clickin on the 2d window. but when i try translating it, it doesnt work right.

can anyone plz help me out
heres a piece of code that performs all the translations on my scene

"look at code goes here"
........
glTranslated 0, 0, -mdblNearField - (mdblFarField - mdblNearField) / 2
glRotatef msngRoll, 0, 0, 1
glRotatef msngHeading, 1, 0, 0
glRotatef msngPitch, 0, 1, 0
glRotated -90, 1, 0, 0

'z scale distortion
glScalef 1, 1, mintzdistort

'translate to origin
glTranslated -mdblActualXMin - (mdblActualXMax - mdblActualXMin) / 2, -mdblActualYMin - (mdblActualYMax - mdblActualYMin) / 2, -mdblZmin - (mdblZmax - mdblZmin) / 2

....... draw the scene

CrazyButcher
06-08-2004, 11:19 PM
while I havent had time to think about the lookat stuff, when you have your terrain data read in, you could just as well "rotate the data" to get things into opengl coords.
ie just set up a matrix doing the proper rotations and then run thru all vertices of the terrain, then you wouldnt need ogl translations, and you would need to do it only once.