The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: xandaz on January 19, 2010, 11:17:29 PM

Title: opengl rotatef problems!!!
Post by: xandaz on January 19, 2010, 11:17:29 PM
   Hey guys. It's me again. I've been around opengl for about a two weeks or so and so i'm pretty new at this. I'm still studying this stuff and so.... many things remain unanswered. I've made several little programs. Some worked out and some didn't. The tihngy i'm working on now makes several geometric fugures rotate but the thing is, tho i gave the rotatef function different params they figures rotate all the same way. i don't know if it has something to do with the Push/popMatrix functions or if it is because of the Translate function which btw im not using? should I? What does it do?

   this is incomplete but i thing you'll understang
   is something among these lines that i'm doing

Draw    PROC
       
        invoke  glClear,GL_COLOR_BUFFER_BIT+GL_DEPTH_BUFFER_BIT
        invoke  glPushMatrix
        invoke  glRotatef,Angle,f0,f0,f1
        invoke  glRotatef,Angle,f0,f1,f0
        invoke  glRotatef,Angle,f1,f0,f0
        invoke  glCallList,1
        invoke  glLightfv,GL_LIGHT0,GL_POSITION,addr LtPosition
        invoke  glPopMatrix
;        invoke  glPushMatrix
        invoke  glRotatef,Angle2,f1,f0,f0
        invoke  glRotatef,Angle2,f0,f0,f1
        invoke  glRotatef,Angle2,f0,f1,f0
        invoke  glCallList,2
        invoke  glLightfv,GL_LIGHT0,GL_POSITION,addr LtPosition
;       invoke  glPopMatrix
        invoke  SwapBuffers,hDC

Draw    endp

.data

f25p
Figures    proc

                invoke  glNewList,1,GL_COMPILE
                invoke  glBegin,GL_QUADS

                invoke  glColor3i,50,50,50
               
                invoke  glVertex3f,f25n,f25p,f25n
                invoke  glVertex3f,f25p,f25p,f25n
                invoke  glVertex3f,f25p,f25n,f25n
                invoke  glVertex3f,f25n,f25n,f25n

                invoke  glVertex3f,f25n,f25p,f25n
                invoke  glVertex3f,f25n,f25p,f25p
                invoke  glVertex3f,f25n,f25n,f25p
                invoke  glVertex3f,f25n,f25n,f25n

                invoke  glVertex3f,f25n,f25p,f25p
                invoke  glVertex3f,f25p,f25p,f25p
                invoke  glVertex3f,f25p,f25n,f25p
                invoke  glVertex3f,f25n,f25n,f25p

                invoke  glVertex3f,f25p,f25p,f25p
                invoke  glVertex3f,f25p,f25n,f25p
                invoke  glVertex3f,f25p,f25n,f25n
                invoke  glVertex3f,f25p,f25p,f25n
 
                invoke  glVertex3f,f25n,f25p,f25n
                invoke  glVertex3f,f25n,f25p,f25p
                invoke  glVertex3f,f25p,f25p,f25p
                invoke  glVertex3f,f25p,f25p,f25n

                invoke  glVertex3f,f25n,f25n,f25n
                invoke  glVertex3f,f25n,f25n,f25p
                invoke  glVertex3f,f25p,f25n,f25p
                invoke  glVertex3f,f25p,f25n,f25n
               
                invoke  glEnd
                invoke  glEndList

                invoke  glNewList,2,GL_COMPILE
       
                invoke  gluNewQuadric
                mov     obj1,eax
                invoke  gluQuadricNormals,obj1,GLU_SMOOTH 
                invoke  gluQuadricDrawStyle,obj1,GLU_FILL     
                invoke  gluQuadricOrientation,obj1,GLU_OUTSIDE
                ;invoke  glMaterialfv,GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE,addr Color
                invoke  glColor3f,fRed,fGreen,fBlue
                invoke  gluCylinder,obj1,dword ptr BaseRad,dword ptr BaseRad+4,\
                                        dword ptr TopRad,dword ptr TopRad+4,\
                                        dword ptr Height,dword ptr Height+4,20,20

                invoke  glEndList
                invoke  glFlush
                ret

Figures endp

Title: Re: opengl rotatef problems!!!
Post by: Farabi on January 20, 2010, 02:25:44 AM
I dont get what you want, but if you want to rotate your object, you will need something like this
Quote
pushmatrix
rotatef
drawyourobject
popmatrix
Title: Re: opengl rotatef problems!!!
Post by: xandaz on January 20, 2010, 06:53:31 PM
    Hi Farabi. The thing is that there are two objects and i want to rotate them in different ways. But they always rotate the same way tho i give different params of rotation to each object. And when i use push/popMatrix to the damn thing stands still. Thanks for answering my call... see if you can eplain this if have some time.

   Many thanks and bests from xandaz. :U
Title: Re: opengl rotatef problems!!!
Post by: oex on January 20, 2010, 06:55:18 PM
pushmatrix
rotatef
drawyourobject1
popmatrix

pushmatrix
rotatef
drawyourobject2
popmatrix
Title: Re: opengl rotatef problems!!!
Post by: xandaz on January 20, 2010, 08:31:11 PM
   Hi oex. That's what i've done but then the screen just goes black and nothing to see there. can u tell why?
   Ty.
Title: Re: opengl rotatef problems!!!
Post by: xandaz on January 20, 2010, 10:47:27 PM
   Sorry. Problem solved. i thought the angle param didn't need no change and that it would always rotate increaseingly accoording to value given. So, i increased the angle by one at each execution of the routine and it works out.
   Thanks for the support you all
   Bests from xandaz :cheekygreen: