gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > 3D both screens

#114612 - Risine - Tue Jan 09, 2007 3:28 pm

Hi there,
I am wondering if it is possible to use 3D on BOTH screens at the same time?

#114613 - Lord Raptor - Tue Jan 09, 2007 3:46 pm

Have a look here http://forum.gbadev.org/viewtopic.php?t=11364

#114614 - silent_code - Tue Jan 09, 2007 3:47 pm

yes, it is possible, but needs some trickery to do. it cuts down the framerate in half and uses up some valuable video memory.

search the forum for 'display capture' and '3d on both screens', there's plenty of info and demos here.

EDIT: oh, lord! you were quicker than me ;p

#114629 - Risine - Tue Jan 09, 2007 5:18 pm

Thanks, got the examples on the forum.
But unfortunately as soon as the framerate gets a little down, you see screen flickering and other messy stuff on both screens.
Is there no other way without this kind of problems?
Is it possible for instance to write the scene on a texture rather than the screen directly?

#114716 - silent_code - Wed Jan 10, 2007 10:32 am

there are some workarounds (afaik), just dig a bit deeper ;)

#114723 - Risine - Wed Jan 10, 2007 1:52 pm

Tried to play with the VBL, with no success :(
What's the trick? Do I have to dig unknown registers bits to find the answer?

#114724 - Dark Knight ez - Wed Jan 10, 2007 2:06 pm

In one of those "3D on both screens" topic, the solution to your problem is mentioned:
You can render a 3D scene to a screen AND rendering it into a VRAM bank as a 2D background at the same time.
You can use that captured 2D background to display the same "3D scene" again using 2D displaying methods for that screen, while you use the 3D displaying methods for the other screen.
_________________
AmplituDS website

#114762 - Risine - Wed Jan 10, 2007 6:02 pm

I have looked the forum everywhere again and again, haven't found more than what I already have.
Can you explain/show me the 1st part ?:
"render a 3D scene to a screen AND rendering it into a VRAM bank as a 2D background at the same time"

#114769 - Dark Knight ez - Wed Jan 10, 2007 7:20 pm

Use the search function.
http://forum.gbadev.org/viewtopic.php?t=11364&highlight=capture+vram
_________________
AmplituDS website

#114786 - Risine - Wed Jan 10, 2007 8:29 pm

Many thanks Dark Knight Ez.
I've seen this link ( and used the search function again and again ;) ), that's the same code that I already have.
what I've done is replacing the drawship/drawteapot functions by displaying the same one triangle on one screen and another same triangle on the other screen.

Example 1 :
Screen 1 : draw 1000* the same red triangle
Screen 2 : draw 1000* the same green triangle
works fine, no pb.

Example 2 :
Screen 1 : draw 1000* the same red triangle
Screen 2 : draw 1* the same green triangle
flickering problems,I see part of the red on the green in screen 2 and part of the green on the red in screen 1.

I suppose it has something to do with VBL, but didn't succeeded finding the right solution. Any idea?

#114818 - Goosey - Wed Jan 10, 2007 10:37 pm

Risine, I believe this might be caused from a bad alignment of drawing/waiting for vblank going on (I ran into something similar)

if I recall correctly make sure you do the commands in this order at the end of the frame:

Code:

GFX_FLUSH = 0; // aka 'glFlush();'
swiWaitForVBlank();
lcdSwap();
UpdateOAM();

#114922 - Vich - Thu Jan 11, 2007 5:54 pm

Goosey wrote:
Risine, I believe this might be caused from a bad alignment of drawing/waiting for vblank going on (I ran into something similar)

if I recall correctly make sure you do the commands in this order at the end of the frame:

Code:

GFX_FLUSH = 0; // aka 'glFlush();'
swiWaitForVBlank();
lcdSwap();
UpdateOAM();


Why would you want to call lcdSwap every time?
_________________
[project website] [personal website]

#114924 - Dark Knight ez - Thu Jan 11, 2007 6:10 pm

In order to put the actual 3D rendering on an other screen each time, instead of on the same.
Hence the subject of this thread.
_________________
AmplituDS website

#114925 - NeX - Thu Jan 11, 2007 6:12 pm

I know very little about this subject, but would it be possible to set the draw area to 256x384, write to a big capture buffer, and then display half of it on each screen?

#114930 - tepples - Thu Jan 11, 2007 7:10 pm

The draw area is frozen to 256x192. Inside the graphics hardware, the buffer is closer to 256x1; the capture hardware just lets the pixels go to RAM at the same time they're going to the LCD.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.