News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

GPU Vertex Rotation Code

Started by Farabi, December 18, 2013, 03:59:59 PM

Previous topic - Next topic

Farabi


fGPURotateVertex  proc uses esi edi lpVertex:dword,RotX:real4,RotY:real4,RotZ:real4
LOCAL x[16]:dword
LOCAL buff[256]:dword
mov esi,lpVertex

invoke glPushMatrix
invoke glMatrixMode,GL_MODELVIEW
invoke glLoadIdentity
invoke glRotatef,RotX,FP4(1.),FP4(0.),FP4(0.)
invoke glRotatef,RotY,FP4(0.),FP4(1.),FP4(0.)
invoke glRotatef,RotZ,FP4(0.),FP4(0.),FP4(1.)
invoke glTranslatef,[esi].VERTEX.x,[esi].VERTEX.y,[esi].VERTEX.z
invoke glGetFloatv,GL_MODELVIEW_MATRIX,addr x
invoke glPopMatrix

lea edi,x

fld dword ptr[edi+12*4]
fstp [esi].VERTEX.x
fld dword ptr[edi+13*4]
fstp [esi].VERTEX.y
fld dword ptr[edi+14*4]
fstp [esi].VERTEX.z


ret
fGPURotateVertex endp


Very simple and fast, the faster your GPU the faster this code is.
http://farabidatacenter.url.ph/MySoftware/
My 3D Game Engine Demo.

Contact me at Whatsapp: 6283818314165