#154128 - SiW - Fri Apr 11, 2008 7:49 pm
I'm having trouble getting my textures to update dynamically. I know the subject has come up before, but I'm making a new thread rather than digging up one from last year to make sure any discussion is on current practices.
I wait for vblank, then every ~2 seconds call this function:
What happens is that my textured quads blink invisible when the function runs, but when they are visible again the original texture is displayed - no updating happens.
I presume I would avoid the blinking if I speed up my texture updating, but that's not my concern right now, I just want to get the texture animating.
So what am I doing wrong?
I wait for vblank, then every ~2 seconds call this function:
Code: |
void Jigsaw::UpdateFrame( int frame ) { u8 *img; [point img at the right bits for this frame] u8 *piece_color = new u8[tileSize]; // tileSize may be e.g. 128*128 while ( (REG_VCOUNT < 192) || (REG_VCOUNT > 214) ) {} if ( (REG_VCOUNT >= 192) && (REG_VCOUNT <= 214) ) { // unlock texture memory vramSetBankA( VRAM_A_LCD ); vramSetBankB( VRAM_B_LCD ); for ( int i = 0; i < numPieces; i++ ) { int width = 0; int height = 0; [ get correct dimensions, e.g. TEXTURE_SIZE_64 ] [ modify piece_color ] // update gl info and copy texture data glBindTexture( GL_TEXTURE_2D, textureIDs[i] ); uint32* address = 0x06800000 + (uint32*)glGetTexturePointer( textureIDs[i] ); glTexParameter( width, height, address, GL_RGB256, TEXGEN_TEXCOORD | GL_TEXTURE_COLOR0_TRANSPARENT ); dmaCopy( piece_color, address, tileSize ); } // lock texture memory again vramSetBankA( VRAM_A_TEXTURE ); vramSetBankB( VRAM_B_TEXTURE ); } delete []piece_color; } |
What happens is that my textured quads blink invisible when the function runs, but when they are visible again the original texture is displayed - no updating happens.
I presume I would avoid the blinking if I speed up my texture updating, but that's not my concern right now, I just want to get the texture animating.
So what am I doing wrong?