How do I rotate everything in OGL max2d. I thought i saw this a while ago, but after an hour of searching im turning up a blank.
Rotating Everything in OGL Max2D
BlitzMax Forums/BlitzMax Programming/Rotating Everything in OGL Max2D Here it is, posted by fredborg
Rem bbdoc: Set the rotation of the viewport about: SetViewRotation allows you to rotate the entire viewport, so that all drawing is rotated according to the @angle parameter. EndRem Function SetViewRotation(angle:Float) Global o_angle:Float glMatrixMode GL_PROJECTION glRotatef angle-o_angle,0,0,1 o_angle=angle glMatrixMode GL_MODELVIEW glLoadIdentity End Function Rem bbdoc: Set the offset of the viewport about: SetViewOffset allows you to offset the entire viewport, so that all drawing is offset according to the @offsetx and @offsety parameters. EndRem Function SetViewOffset(offsetx:Float,offsety:Float) Global o_offsetx:Float Global o_offsety:Float glMatrixMode GL_PROJECTION glTranslatef offsetx-o_offsetx,offsety-o_offsety,0 o_offsetx = offsetx o_offsety = offsety glMatrixMode GL_MODELVIEW glLoadIdentity End Function Rem bbdoc: Set the zoom factor of the viewport about: SetViewZoom allows you to zoom all drawn elements at once, instead of scaling each individual element. Use the @zoom parameter to define the level of zoom, a value of 0 is the default zoom, >0 zooms in, <0 zooms out. EndRem Function SetViewZoom(zoom:Float) Global o_zoom:Float glMatrixMode GL_PROJECTION glScalef 1.0+(zoom-o_zoom),1.0+(zoom-o_zoom),1.0+(zoom-o_zoom) o_zoom = zoom glMatrixMode GL_MODELVIEW glLoadIdentity End Function
Thanks alot :)
Thanks alot :)
hmmm, i used to like an atari tank game that did this, you looked down on a tank which was always in the centre of the screen, the background rotating when you turned
I must have wasted a fortune when I was a kid....
I must have wasted a fortune when I was a kid....