rotating the entire screen.

BlitzMax Forums/BlitzMax Beginners Area/rotating the entire screen.

Ryan Burnside(Posted 2006) [#1]
Ok i want to rotate the image in the backbuffer around a center point. Is this possible? This is used for a game where they player does not move but the world must rotate.


CGV(Posted 2006) [#2]
Doesn't the rockout game in the samples\hitoro folder do just that?


Ryan Burnside(Posted 2006) [#3]
I looked through that and couldn't find how he was rotating the background.


H&K(Posted 2006) [#4]
setRotation
Then Redraw the backbuffer

Or if you are already useing Setrotation then SetRotation Whatever other rotation you have+ScreenRotation


Ryan Burnside(Posted 2006) [#5]
Do you mean

setrotation(angle)
flip


My main problem is that all my images are being rotated and drawn wrong the screen appears to be rotated but the images are incorrectly positioned. They appear to retain their x and y positions but the images ARE rotated.




H&K(Posted 2006) [#6]
No, what I mean is

Setrotation Whatever
DrawDackground
Setrotation 0
Do your other drawing
Flip

(If thats what you have done then yes I mean that) it rotates it all round 0,0 though)


Ryan Burnside(Posted 2006) [#7]
I don't have any external images or backgrounds. I'm only saving to the backbuffer. These images are rectangles and lines. I need to rotate the whole backbuffer after it contains all the image data. Sorry to be a burden...


H&K(Posted 2006) [#8]
You dont need to rotate the backbuffer after it contains all the image data. You could, as Ive suddjested Rotate all the drawing to the backbuffer.

If you really want to do it after, grab the whole backbuffer as a Image, cls, setrotation, then draw the image back to the backbuffer


Grey Alien(Posted 2006) [#9]
If you really want to do it after, grab the whole backbuffer as a Image, cls, setrotation, then draw the image back to the backbuffer
This will be way to slow, some cards it takes 300ms to grab the backbuffer.

Anyway will SetOrigin help you? or SetHandle?


tonyg(Posted 2006) [#10]
OGL code which might need updating.
The original post


Dreamora(Posted 2006) [#11]
Jupp, set origin to the middle of the screen if you want to rotate around the middle and then call setrotation to rotate the whole screen.


sswift(Posted 2006) [#12]
If you have lots of objects in your world drawn on top of this background and you want them all to rotate with the background, then you would do well to purchase my sprite system. It handles this sort of thing wonderfully through a robust parent-child system. You could even scale the background to zoom in on everything.

The only limitation with it is that you won't get the results you expect if you rotate a sprite and then scale the background non-uniformly, meaning more on the Y axis than the X axis for example. But as long as you scale the background uniformly you can still rotate and scale the sprites on it non-uniformly.

Of course there may be ways to do this in OpenGL directly, but then you're limited to using OpenGL. Copying the screen to a buffer is a bad idea because it is slow.


Defoc8(Posted 2006) [#13]
Use opengl + apply rotation to the projection matrix..
- you will need to restore it once your done rotating..
yes, you would be limited to gl doing it like this, although
you could probably write a dx equivalent..i cant remember
the specifics of matrix coding in dx..then again gl is cross
platform, and most cards/drivers support gl...