News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

opengl rotatef problems!!!

Started by xandaz, January 19, 2010, 11:17:29 PM

Previous topic - Next topic

xandaz

   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


Farabi

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
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

xandaz

    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

oex

pushmatrix
rotatef
drawyourobject1
popmatrix

pushmatrix
rotatef
drawyourobject2
popmatrix
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

xandaz

   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.

xandaz

   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: