3D on both screen + console print + indexed texture
Posted: Wed Aug 04, 2010 4:10 pm
Hi, i'm working on a project on nds and i have a problem with the print console.
actualy, i use 3D on the 2 screen and use indexed texture for rendering.
But, I notice that i can't use the print console when i use indexed texture...
according to : devkitPro\examples\nds\Graphics\3D\Mixed_Text_3D\source\main.cpp
here is parts of my code :
-> initialisation code
-> some printing fonctions:
-> texture manager code for indexed texture:
Well, I notice that if i comment
the console print normaly, but no texture render correctly, of course.
And, i try to uncomment
because i think that gluTexLoadPal() "clear the console memory", or something like that... but in this case, the texture is not rendered, and the console print not too.
any sugestion? help welcome ^^
actualy, i use 3D on the 2 screen and use indexed texture for rendering.
But, I notice that i can't use the print console when i use indexed texture...
according to : devkitPro\examples\nds\Graphics\3D\Mixed_Text_3D\source\main.cpp
here is parts of my code :
-> initialisation code
Code: Select all
...
glInit();
// Setup screen for 3D
videoSetMode(MODE_0_3D);
videoSetModeSub(MODE_5_2D);
//set up some memory for textures
vramSetBankA(VRAM_A_TEXTURE);
vramSetBankB(VRAM_B_TEXTURE);
vramSetBankE(VRAM_E_MAIN_BG);
//vramSetBankF(VRAM_F_TEX_PALETTE);
console = consoleInit(0, 1, BgType_Text4bpp, BgSize_T_256x256, 31,0, true, true);
bgSetPriority(0, 1);
// sub sprites hold the bottom image when 3D directed to top
initSubSprites(); // see devkitPro\examples\nds\Graphics\3D\Mixed_Text_3D\source\main.cpp for this fonction
// sub background holds the top image when 3D directed to bottom
bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
glEnable( GL_TEXTURE_2D | GL_BLEND | GL_ANTIALIAS | POLY_FORMAT_LIGHT0 | POLY_FORMAT_LIGHT1);
Code: Select all
static inline void DBG( int posX, int posY, const char* text)
{
#if DEBUG
char localStrBuf[100];
snprintf(localStrBuf, 100, "%s%d%s%d%s%s\n", "\x1b[", posY,";", posX,"H ",text);
printf(localStrBuf);
#endif
}
static inline void DBGi( const char* text)
{
#if DEBUG
iprintf("%s\n", text);
#endif
}
-> texture manager code for indexed texture:
Code: Select all
CTextureIndexed::CTextureIndexed(const u16 widthSize,
const u16 heightSize, const u8* imgData,
const int pal_ID, const int pal_Number,
const GL_TEXTURE_TYPE_ENUM format,
bool randomTransparence)
: CTexture( widthSize, heightSize, format)//, m_image(0)
{
...
glBindTexture(0, m_textureID);
glTexImage2D(0, 0, m_texFormat, getTexSize(m_width), getTexSize(m_height), 0, TEXGEN_TEXCOORD| GL_TEXTURE_WRAP_S | GL_TEXTURE_WRAP_T, imgData);
m_pal_addr = new uint32[pal_Number];
for (int i=0;i<pal_Number; ++i)
{
u16* palData = (u16*)paletteList[pal_ID+i];
m_pal_addr[i] = gluTexLoadPal( palData, getPalSize(m_texFormat), m_texFormat );
}
}
Well, I notice that if i comment
Code: Select all
m_pal_addr[i] = gluTexLoadPal( palData, getPalSize(m_texFormat), m_texFormat );
And, i try to uncomment
Code: Select all
//vramSetBankF(VRAM_F_TEX_PALETTE);
any sugestion? help welcome ^^