Flipping and Rotating the Viewport?

Blitz3D Forums/Blitz3D Programming/Flipping and Rotating the Viewport?

Gabriel(Posted 2005) [#1]
Ok, this is a bit weird, I know, but I have a big program already written with tens of thousands of lines of code. I now need to be able to mess with the way it renders, preferably without rewriting every piece of code I ever wrote, including a few third-party libraries.

Essentially, I need to be able to render the screen in normal orientation, as well as rotated 180 degrees ( as though you were looking at the screen upside down ) and also rotated 90 degrees in each direction ( as though you were looking at it from either side.

Now as far as I can see, there is no native way to do this ( I could be wrong? ) but Noel suggested that futzing with the projection matrix might do it. From what I've played with OpenGL, that does sound as though it would do it, but it's beyond my abilities to do it. So I'm wondering if anyone else knows how to do it ( you'll have to explain it in words of one syllable with code examples and possibly pretty pictures in wax crayon, cuz I'm a wee bit slow sometimes ;) )

I know Scouse did a lot of messing around with Blitz3d under the hood, so maybe someone remembers from that? I'm open to suggestions, but rewriting the game and all of someone else's HUD/GUI code ain't sounding like fun.


Sledge(Posted 2005) [#2]
This might sound dumb but, er, rotate/move the camera?

EDIT: Either that or render to a texture and orient that as you will on a quad.


Gabriel(Posted 2005) [#3]
Rotate the camera works up to a point, but like I said, it won't cut it with the hud stuff.

Rendering to a texture and orienting the quad works too, but that's a big performance hit with a high resolution view. ( And it will be high. )


Ross C(Posted 2005) [#4]
What about scaling the camera?


Ross C(Posted 2005) [#5]
Using minus values, like:

ScaleEntity camera,-1,-1,1


That seems to give the 180 rotated effect.


Zethrax(Posted 2005) [#6]
Rotate the camera works up to a point, but like I said, it won't cut it with the hud stuff.


I might be missing your point there, but if you render your HUD with a second camera, you should be able to rotate the main camera without interfering with the HUD.


Gabriel(Posted 2005) [#7]
I might be missing your point there, but if you render your HUD with a second camera, you should be able to rotate the main camera without interfering with the HUD.



That's precisely my worry. I *need* it to interfere with the HUD. The HUD needs to be rotated as well, which it won't be if it uses a second camera ( I'm pretty certain it does. )

It *might* be trivial to rotate the HUD camera as well, but we'll have to see. This is a game with thousands of lines of code, and I haven't looked at it seriously in 12 months. It's going to take me quite some time to get accustomed to it again before I can see how to do this.

Fiddling with the projection matrix sounded like a very simple idea which wouldn't require me to understand 20-30k lines of year old code.

Ross: Thanks, that does seem to work for 180 degrees. It probably is using the projection matrix, just that I can't rotate it 90 and -90 with Blitz commands. Hopefully the camera rotation will work out, but it'll probably be a few days of code-untangling before I can try it properly.