#123010 - zeGouky - Sat Mar 24, 2007 2:18 pm
Hi people,
I'm trying to draw a textured QUAD using the orthoview, but my code work on no$gba but not on the hardware :-/
here's the piece of the code :
Init :
Init Orthoview :
Back to perspective :
Rendering the quad :
On the device im just getting the QUAD with no texture but the QUAD is in color #0 of it.
If anyone can help :)
Thanks
I'm trying to draw a textured QUAD using the orthoview, but my code work on no$gba but not on the hardware :-/
here's the piece of the code :
Init :
Code: |
videoSetMode(MODE_0_3D); videoSetModeSub( MODE_0_2D | DISPLAY_BG0_ACTIVE ); // --- lower screen for console text vramSetMainBanks( VRAM_A_TEXTURE, VRAM_B_LCD, VRAM_C_SUB_BG, VRAM_D_SUB_SPRITE ); glViewPort(0,0,255,191); glClearColor(0,0,0); glClearDepth(0x7FFF); glGenTextures(1, &textureID); glBindTexture(0, textureID); glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)texture_bin); |
Init Orthoview :
Code: |
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glOrthof32(0, 256, 192, 0,0, 1); glMatrixMode(GL_TEXTURE); glIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glMaterialf(GL_AMBIENT, RGB15(16,16,16)); glMaterialf(GL_DIFFUSE, RGB15(16,16,16)); glMaterialf(GL_SPECULAR, BIT(15) | RGB15(8,8,8)); glMaterialf(GL_EMISSION, RGB15(16,16,16)); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); |
Back to perspective :
Code: |
glMatrixMode(GL_PROJECTION); glLoadIdentity(); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); |
Rendering the quad :
Code: |
// -- Rendering OrthoView(); glPushMatrix(); glBindTexture(GL_TEXTURE_2D, textureID); glBegin(GL_QUADS); glNormal(NORMAL_PACK(0,inttov10(-1),0)); glTexCoord1i(TEXTURE_PACK(inttot16(128), 0)); glVertex3v16( spr_x, spr_y+spr_h, 0); glTexCoord1i(TEXTURE_PACK(inttot16(128),inttot16(128))); glVertex3v16( spr_x+spr_w, spr_y+spr_h, 0); glTexCoord1i(TEXTURE_PACK(0, inttot16(128))); glVertex3v16( spr_x+spr_w, spr_y, 0); glTexCoord1i(TEXTURE_PACK(0,0)); glVertex3v16( spr_x, spr_y, 0); glEnd(); glPopMatrix(1); // --- Bactk to perspective PerspectiveView(); |
On the device im just getting the QUAD with no texture but the QUAD is in color #0 of it.
If anyone can help :)
Thanks