#165284 - Kaiser - Tue Dec 16, 2008 4:28 am
I've been searching for some tutorials covering this subject but I've had very little luck in finding any. I did find a demo covering this but I fail at understanding what exactly is going on.
Can someone explain the process in rendering 3D simultaneously on both screens?
#165287 - DiscoStew - Tue Dec 16, 2008 5:46 am
The Video Capture Hardware is the core of getting 3D on both screens at the same time (aside from the 3D hardware). Without it, you are stuck with either software rendering, or having 3D on only one screen at any time.
The trick behind it is that you are taking a snapshot of one frame, and displaying it elsewhere on the next frame, like on the other screen, or as a texture on the current 3D scene to be rendered ( like the Render to Texture example). Capturing requires that the destination VRAM bank be set to LCD mode, but once captured, you can set that VRAM bank to whatever mode is needed.
_________________
DS - It's all about DiscoStew
#165288 - Echo49 - Tue Dec 16, 2008 6:19 am
Does this effectively mean you only get 30fps instead of 60?
edit: also, looking at Antonio's example here: http://forum.gbadev.org/viewtopic.php?t=16251
Since glFlush() is called for both scenes, why isn't there a constant flickering?
#165291 - DiscoStew - Tue Dec 16, 2008 7:07 am
Yes, you can only achieve at max 30FPS using this method, because the DS is set at a refresh rate of 60Hz, and the 3D engine and capture unit can only perform their tasks once per frame, and it requires using both twice to get this effect.
There are 2 glFlush commands in this, but both are not called in the same frame. Each section takes a turn, occupying a frame each, but according to the example, the glFlush commands "could" be placed outside the if-split, making only one needed overall.
_________________
DS - It's all about DiscoStew
#165296 - Echo49 - Tue Dec 16, 2008 9:36 am
I mean, flush is called for scene1, then during the next frame it's called for scene2, then scene1, and so on, so why doesn't the screen flicker between the two screens?
#165308 - AntonioND - Tue Dec 16, 2008 3:38 pm
Because you show the 3D scene one frame and the next you show the captured image of last frame. For example, for dual 3D:
Frame A:
-Screen1: Rendered 3D scene1. -- Capture for next frame.
-Screen2: Captured scene2.
Frame B:
-Screen1: Captured scene1.
-Screen2: Rendered 3D scene2. -- Capture for next frame.
#165309 - DiscoStew - Tue Dec 16, 2008 4:02 pm
Hehe, just to let you know, the 3D layer "is" flickering between the 2 scenes in the texture example....you just can't see it. AntonioND and I came up with separate methods, but both have sort of the same principle; prevent the 3D layer itself from being shown. For that (as used in the example), you make BG0 inactive, and either use a Framebuffer mode or activate an extra background layer that "covers" the 3D layer (BG0). Unfortunately, this requires that an extra VRAM bank be used, because it isn't just one frame being captured, but both one after the other.
However, I'm thinking that there might be a way to free up one of the two VRAM banks used, but this method requires AntonioND's method with the framebuffer. I'll see if I can do it, and hopefully have my results tonight or tomorrow, but Finals come first. :P
_________________
DS - It's all about DiscoStew
#165313 - Kaiser - Tue Dec 16, 2008 7:21 pm
Interesting stuff. I'll try playing around with this and see what comes up. I think the main challenge here is timing the two frames and prevent any flickering.
#165315 - AntonioND - Tue Dec 16, 2008 8:01 pm
DiscoStew wrote: |
I'll see if I can do it, and hopefully have my results tonight or tomorrow, but Finals come first. :P |
Good luck in both things. :P
#165317 - DiscoStew - Tue Dec 16, 2008 11:16 pm
Nvm. My idea won't work. Don't know where I got the idea from, but I was under the assumption that the capture unit could also capture to Main Memory so then it could go through the Main Memory Display FIFO to output to Display A. My assumption was wrong. :(
Maybe have it capture to VRAM, then right afterwards do a manual copy into main memory, then follow along with the Main Memory Display FIFO? What that might do is allow one of two frames to only need 1 VRAM bank, but the other frame would still need two? Having unequal uses of VRAM wouldn't be ideal for displaying 2 3D screens of the same scene, but it might have other uses. This sort of thing is a bit more complicated than I'm used to. Don't know when I could get around for this one.
_________________
DS - It's all about DiscoStew