Archived

This topic is now archived and is closed to further replies.

problems with rotation

This topic is 5142 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im using vb and opengl to draw a terrain from a DEM file. i have (i think) the viewport and the view volume set right.i can move into the view volume using glulookat, and i can rotate using the glulookat statement, but i dont know what happens when i use the glrotate function. i just turns into a single line.can somebody help me, herez a part of the code : " display routine " wglMakeCurrent mlngPic1hDC,mlngWindowcontext glEnable (GL_DEPTH_TEST) glClearColor 0, 0, 0, 1 glClear clrColorBufferBit glClear clrDepthBufferBit glMatrixMode GL_MODELVIEW glLoadIdentity gluLookAt 0, 0, dblzcam, 0, 0, -(dblZMax - dblZMin) / 2, 0, 1, 0 glRotatef intRotate, 0, 1, 0 glTranslated -dblActualXMin + dblXMin, -dblActualYMin + dblYMin, dblZMin + (dblZMax - dblZMin) / 2 glPushMatrix glEnable glcLighting glEnable glcLight0 glEnable glcColorMaterial glColorMaterial faceFrontAndBack, cmmAmbientAndDiffuse glLineWidth 10 glColor3f 1, 0, 0 glBegin bmLines glVertex3d dblActualXMin, dblActualYMin, -dblZMin - 10 glVertex3f dblActualXMin, dblActualYMax, -dblZMin - 10 glEnd glColor3f 0, 1, 0 glBegin bmLines glVertex3f dblActualXMin, dblActualYMin, -dblZMax - 10 glVertex3f dblActualXMin, dblActualYMin, -dblZMin - 10 glEnd glcalllist 100 glPopMatrix glDisable (GL_DEPTH_TEST) glFinish SwapBuffers mlngPic1hDC blnBusy = False wglMakeCurrent mlngPic1hDC, 0 "viewvolume routine" intRotate = 0 glMatrixMode GL_PROJECTION glLoadIdentity dblzcam = 0 glFrustum dblXMin, dblXMax, dblYMin, dblYMax, 1, temp glMatrixMode GL_MODELVIEW glLoadIdentity glShadeModel smSmooth glEnable glcDepthTest glEnable (glcBlend) i dont think u have to worry bout the values of dblxmin..... what im doin is im settin a viewvolume n im drawin the axes in the viewvolume, n im tryin to rotate it. thank u

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I''m not sure but try moving the first glPushMatrix to just below glLoadIdentity. It could be an accumulation of matrix operations that are never reset thats screwing things up. The first glPushMatrix is redundant where it is presently. In fact I''d say you could safely do without the push and pop matrix calls, that is given you are not rendering anything else afterwards.

Of course I could be completely wrong.

Share this post


Link to post
Share on other sites
i tried commenting the push and pop matrices and i also tried moving the push up, but nothing works. as soon as i start rotating, the very first angle, 1 degree, the whole scene changes to a line. but i can move in n out using glulookat, before i try rotating the objects.

Share this post


Link to post
Share on other sites