Palette with 3D

Post Reply
WhiteSkull
Posts: 9
Joined: Tue Aug 18, 2009 2:29 pm

Palette with 3D

Post by WhiteSkull » Tue Sep 08, 2009 5:49 pm

Hi guys! Here I show part of my work... http://rapidshare.com/files/277312291/D ... I.nds.html

The problem is that I want to animate through the palette, the marquee lights of the scenary ... and do not know

Someone who has done with 3D, please tell me... thank

elhobbs
Posts: 358
Joined: Thu Jul 02, 2009 1:19 pm

Re: Palette with 3D

Post by elhobbs » Tue Sep 08, 2009 9:33 pm

it is really just a matter of updating the palette in vram. you will need to switch the vram bank to LCD mode, update the palette, then switch the bank back to texture palette. one small caveat is that you probably want to do this during vblank as you can get black lines on the screen if the vram bank is actively being used.

you can use this function to upload the new palette

Code: Select all

void glTexLoadPal(const u16* pal, u16 count, u32 addr) {
where addr is the value returned from

Code: Select all

int gluTexLoadPal(const u16* pal, u16 count, uint8 format) {
these functions take care of the vram bank switch, but I gave the background info so you would understand the black lines.

WhiteSkull
Posts: 9
Joined: Tue Aug 18, 2009 2:29 pm

Re: Palette with 3D

Post by WhiteSkull » Wed Sep 09, 2009 9:07 am

Yeah, well i planned to use glTexLoadPal, but not how to use it, there are no examples or clear references to its use ...

Parameters:
  • pal pointer to the palette to load [OK]
    count the size of the palette [OK]
    addr the offset in VRAM to load the palette <--- gluTexLoadPal :?:
elhobbs wrote:where addr is the value returned from

Code: Select all

int gluTexLoadPal(const u16* pal, u16 count, uint8 format)
...
and

Loads a palette into the next available palette slot, returns the addr on success or -1.

Parameters:
  • pal pointer to the palette to load [OK]
    count the size of the palette [OK]
    format the format of the texture ... sorry, but this has to do?
So that means changing the palette of all the textures stored in the VRAM? You can not change the palette of a specified texture? mmm.... :idea: Well, and how to change the texture at runtime? if I get the address of the texture with glGetTexturePointer, and copy a new texture in the address obtained, work :?:

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests