#24100 - dagamer34 - Wed Jul 28, 2004 12:52 am
Yes, it's been asked many times. Yes, you are getting tired of these kinds of posts. Yes, I did do a search on the forum to see if it has been asked already.
However, it isn't working exactly like I wanted it to. Here's what I'm using:
Code: |
*(unsigned short*)0x4000020 = 0;
*(unsigned short*)0x4000022 = -256;
*(unsigned short*)0x4000024 = 128;
*(unsigned short*)0x4000026 = 0;
*(unsigned short*)0x4000028 = 319 << 7;
|
The outcome is a stretched screen that is rotated 90 degrees counter-clockwise. I know the loading code isn't at fault, so what else could it be?
_________________
Little kids and Playstation 2's don't mix. :(
#24111 - tepples - Wed Jul 28, 2004 2:19 am
I had a bit of trouble interpreting what you meant by that. What exactly are you expecting, and what exactly are you getting instead of what you are expecting?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#24116 - dagamer34 - Wed Jul 28, 2004 3:39 am
My picture is rotated 90 degrees, then stretched across the screen. I just want the picture stretched across the screen. Am I clear now on what my problem is?
I didn't want any rotation. I found this piece of code from an old post on these boards.
_________________
Little kids and Playstation 2's don't mix. :(
#24140 - poslundc - Wed Jul 28, 2004 2:11 pm
That's what stretched Mode 5 is. It takes advantage of the fact that Mode 5 is normally 160x128 pixels. Since the width of the mode is the same as the height of the screen, and the height of the mode is just a little more than half the width of the screen, you can rotate it and double the height to obtain a double-buffered mode that completely fills the screen, just stretched to double-pixels on the horizontal, rather than having the ugliness and uneven scaling of trying to stretch out 160x128 to 240x160.
Because it's a rotated buffer, you write to it in (y,x) notation instead of (x,y). Which shouldn't pose a problem, and can actually be advantageous for speed in applications like raycasters.
Dan.
#24148 - tepples - Wed Jul 28, 2004 3:40 pm
If you just want your picture stretched and not rotated, use stretched mode 3:
Code: |
*(unsigned short*)0x4000020 = 128;
*(unsigned short*)0x4000022 = 0;
*(unsigned short*)0x4000024 = 0;
*(unsigned short*)0x4000026 = 256;
*(unsigned short*)0x4000028 = 0;
*(unsigned short*)0x400002C = 0;
|
Then write to either the left half or the right half of the buffer, and to switch buffers, do this:
Code: |
*(unsigned short*)0x4000028 = buffer ? (120 << 128) : 0;
|
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#24151 - poslundc - Wed Jul 28, 2004 4:04 pm
Hm, interesting. I was under the impression that you could only scale/rotate in Mode 5, which is what the Cowbite spec implies. It seems that GBATEK spec agrees with you, though.
So, is there a reason to use stretched/rotated Mode 5 other than if you're writing a raycaster and want to blit two pixels in a single instruction?
Dan.
#24161 - dagamer34 - Wed Jul 28, 2004 6:47 pm
poslundc wrote: |
That's what stretched Mode 5 is. It takes advantage of the fact that Mode 5 is normally 160x128 pixels. Since the width of the mode is the same as the height of the screen, and the height of the mode is just a little more than half the width of the screen, you can rotate it and double the height to obtain a double-buffered mode that completely fills the screen, just stretched to double-pixels on the horizontal, rather than having the ugliness and uneven scaling of trying to stretch out 160x128 to 240x160.
Because it's a rotated buffer, you write to it in (y,x) notation instead of (x,y). Which shouldn't pose a problem, and can actually be advantageous for speed in applications like raycasters.
Dan. |
Thanks, I did not know that. Though it makes it a little difficult to DMA copy data to the screen...
_________________
Little kids and Playstation 2's don't mix. :(
#24168 - Miked0801 - Wed Jul 28, 2004 7:54 pm
Actually, most ray casters work with Y stripes so it's even easier...
#24170 - dagamer34 - Wed Jul 28, 2004 10:14 pm
Miked0801 wrote: |
Actually, most ray casters work with Y stripes so it's even easier... |
I was thinking about copying a bitmap to the screen using DMA.
_________________
Little kids and Playstation 2's don't mix. :(
#24172 - poslundc - Wed Jul 28, 2004 10:34 pm
Not a problem if you encode the bitmap at 90 degrees...
Dan.