How to scale and rotate the "camera" ?

BlitzMax Forums/BlitzMax Programming/How to scale and rotate the "camera" ?

Robert Cummings(Posted 2008) [#1]
In Blitzmax one of the main missing features in the 2D library is to scale and rotate the entire screen reliably in all the drawing drivers, such as ogl dx7 and dx9 etc.

I would like a module which allows me to affect the screen or "camera" scale, position and rotation without messing with my existing game...

Please tell me it can be done simply and reliably, or if it has already been done!


Digital Anime(Posted 2008) [#2]
Here are some examples in a previous topic:

http://www.blitzmax.com/Community/posts.php?topic=78579

hope it helps.


Robert Cummings(Posted 2008) [#3]
Thanks but there were absolutely no driver independant solutions there. I am hoping at minimum for a usable DX+OGL technique which would not call for an entire rewrite of my games graphics, but work regardless of driver used...

I only want to rotate, shake and zoom the camera if possible... one would assume it was built in.


Robert Cummings(Posted 2008) [#4]
no ideas?


Robert Cummings(Posted 2008) [#5]
Can we have a scale and rotate viewport command? would make max games look a lot more dynamic.


ziggy(Posted 2008) [#6]
You'll have to recode part of your game. If you derived every graphic object from a base class (this is highly recommended on every game), it should be as easy as adding this feature to the base class.


Robert Cummings(Posted 2008) [#7]
This is still using the wrong tool for the job.

What I am looking for is the guts of the projection matrix, or some better ideas. Transforming every single object by hand is needlessly computatively expensive for such a simple task, no?


EOF(Posted 2008) [#8]
There is some GL stuff here to get you started ..




Robert Cummings(Posted 2008) [#9]
Thats fantastic thanks jim, but my problem is that DX must be used on windows.


Robert Cummings(Posted 2008) [#10]
Anyone got a DX driver version?


Yan(Posted 2008) [#11]
http://www.blitzbasic.com/Community/posts.php?topic=72268

??


Robert Cummings(Posted 2008) [#12]
Thanks for that but apparently it "warps" and stretches. I have decided to abandon the idea of rotating the screen until its a feature. I still don't understand why the developer didn't make it a command.


christian223(Posted 2008) [#13]
You could take screenshots and move that.


Digital Anime(Posted 2008) [#14]
Thanks but there were absolutely no driver independant solutions there. I am hoping at minimum for a usable DX+OGL technique which would not call for an entire rewrite of my games graphics, but work regardless of driver used...


I didn't use any drivers in my version in that post

Try the following example with code included

http://server.dedicatedservices.org/upload/zip/retro.zip

I first wrote a game and after that I wanted to rotate and shake and zoom everything also when needed. What I did was create a load of new functions. After that I replaced all draw commands which are affected by zoom, rotate or movement by my own functions. And after that I just tell how much it must be zoomed in or rotated or moved.

You are free to use my example, but you might want to change stuff to make it easier to add to your game. At least try it to get the idea.


Robert Cummings(Posted 2008) [#15]
I tried out your retro zip and I'm very impressed. It wasn't what I was looking for as it requires calculating absolutely everything thats being drawn on screen so its processor intensive....

however I liked it so much and there seems to be no alternative so I may verywell give it a try

Thank you for your patience and contribution Mark G . :)


MGE(Posted 2008) [#16]
I agree with Lowcs. This needs to be a built in language independant feature. Why isn't it? Having to rotate all objects one at a time is not good.


Digital Anime(Posted 2008) [#17]
When using MiniB3D or Blitz3D you work with a camera view and you could move or rotate that, so using MiniB3d with flat 3D objects which look 2D will take the load away from the CPU and let the GPU do all the work.

I'm a bit new to MiniB3D, so I have no examples on how to do that yet...

But for BlitzMax calculating every tiles position is the fastest way I can come up with.


Robert Cummings(Posted 2008) [#18]
Changing the projection matrix is the fastest way to rotate all on screen, I'm not sure why max2d never bothered.