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 > print text in 3d mode

#127846 - wykz - Sat May 05, 2007 4:12 pm

Hi

how do i print simple text when I have 3d mode activated? I want the text to be on top of all the 3D objects

thankfull for every hint or url

#127847 - tepples - Sat May 05, 2007 4:27 pm

First approximation: Set the priority of BG0 to 1 and the priority of BG1 to 0 using the BGCTRL registers. Then use BG1 to display the text.

If you are using 3D mode, you'll probably want to use a VRAM layout similar to this:
  1. Textures
  2. Textures
  3. Textures
  4. Textures
  5. Main BG
  6. Main sprite cels
  7. Texture palettes
  8. Sub BG
  9. Sub sprite cels

_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#127848 - wykz - Sat May 05, 2007 5:45 pm

o sorry .. i dont mean textur as you putt on 3d objects .. i mean ordinary text from char[]

i have not find any sampel for libnds how to put out char text in 3d mode

have i game in 3d .. but it hard to tell other how to play it if i cant find solution how to put text on the screen that run 3d

#127850 - tepples - Sat May 05, 2007 5:59 pm

First try getting your existing text drawing routines to work in BG2 in VRAM bank E. (Because bank E is 64 KiB, you will have to use a display mode other than a hi-color extended rotation background.) Then you can overlay BG2, containing your text, on top of BG0, containing your 3D scene.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#127857 - wykz - Sat May 05, 2007 7:14 pm

i got text on bg2 now .

can you tell me how BGCTRL works (sampel how i change the bg)

#127859 - tepples - Sat May 05, 2007 8:53 pm

wykz wrote:
i got text on bg2 now .

Good job. Now do you have the main 2D core in VRAM E so that it doesn't interfere with your textures?

Quote:
can you tell me how BGCTRL works (sampel how i change the bg)

BGCTRL[2] is the same thing as REG_BG2CNT. See GBATEK: GBA LCD I/O Background Control and GBATEK: DS Video BG Modes / Control to learn how to change each background's priority.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#127863 - wykz - Sat May 05, 2007 10:47 pm

got it working now with help from here and dsdev on irc.. gona past the code if other fell in to the same trapp

http://rafb.net/p/Kit5Hj55.html

big thx for the god and fast answer

#128041 - Rajveer - Tue May 08, 2007 12:17 am

tepples wrote:
First approximation: Set the priority of BG0 to 1 and the priority of BG1 to 0 using the BGCTRL registers. Then use BG1 to display the text.

If you are using 3D mode, you'll probably want to use a VRAM layout similar to this:
  1. Textures
  2. Textures
  3. Textures
  4. Textures
  5. Main BG
  6. Main sprite cels
  7. Texture palettes
  8. Sub BG
  9. Sub sprite cels


How would one set VRAM bank G to store texture palettes? As libnds uses VRAM bank E by default.

#128052 - Ant6n - Tue May 08, 2007 4:51 am

would it make sense to put a rectangular polygon directly behind the near clipping plane (does that exist on DS?) that uses a 2bit paletted texture (thus using half the ram)?