PDA

View Full Version : somebody plz plz plz plz plzzzzzzzzzz help



mithun_daa
11-12-2003, 11:08 AM
im tryin to rotate the object in the scene. when the object is initially rendered it is perfect, but when i try rotatin it, it turns into a line. i dont know whatz happenin. can neone help?
herez 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
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

im sorry cause i posted this msg even in the begineers forum. iwanted to put it in the advanced cause therz hardly neone respondin in the beginers forum

zeckensack
11-12-2003, 11:24 AM
Oh, I see, two minutes is a heck of a lot of time.


Would you plz plz plz plzzzzzzzz give your topics meaningful names to begin with?

rgpc
11-12-2003, 08:10 PM
glBegin bmLines
glVertex3d dblActualXMin, dblActualYMin, -dblZMin - 10
glVertex3f dblActualXMin, dblActualYMax, -dblZMin - 10
glEnd


Take a piece of A4/Letter paper and hold it out in front of you. Rotate it (around the vertical axis) by 90degs. Naturally it looks like a line. That's because a blank piece of paper is essentially a 2D object. (ie. All the Z-coords are the same)

Now look at the above piece of code and see if you can find your error...

[EDIT]
PS. Learn how to type.

[This message has been edited by rgpc (edited 11-12-2003).]

mithun_daa
11-13-2003, 06:53 AM
Originally posted by rgpc:



glBegin bmLines
glVertex3d dblActualXMin, dblActualYMin, -dblZMin - 10
glVertex3f dblActualXMin, dblActualYMax, -dblZMin - 10
glEnd


Take a piece of A4/Letter paper and hold it out in front of you. Rotate it (around the vertical axis) by 90degs. Naturally it looks like a line. That's because a blank piece of paper is essentially a 2D object. (ie. All the Z-coords are the same)

Now look at the above piece of code and see if you can find your error...

[EDIT]
PS. Learn how to type.

[This message has been edited by rgpc (edited 11-12-2003).]


rpgc, u over egoistic dude, i guess u should take a close look at the code before u come to ur conclusions, no doubt its a beginer level Q, but whatz your problem helping some, after all this forum is to help one another. moreover, there was absolutely no response in the beginer forum.

ok, coming to the point, if u see the peice of code right above what u pointed out, u can see the 'z' axis being drawn. another thing i forgot to mention is that when i use glulookat, i can move into the view volume, and i can also rotate by setting the parameters in the lookat statement. this proves that the viewvolume is not 2D. i dont know why glrotate fails to work.

and im sorry if anyone did not understand for the way i typed.
thank u