#128332 - matkeupon - Thu May 10, 2007 6:48 pm
Hi,
I've got a problem trying to blit stuff to the screen, using the GPU. The quad shows up, but with no texture... Hope someone can help me, here's my source:
Also, I have another question: I can't find any doc that tells how to set up an extended rotation background, in tiled mode. I've read in many places that it was possible, and as I need a wide map, with a large set of tiles (more than 256), this mode is very interesting.
Thanks in advance
I've got a problem trying to blit stuff to the screen, using the GPU. The quad shows up, but with no texture... Hope someone can help me, here's my source:
Code: |
#include <nds.h> #include <stdlib.h> #include "texture_bin.h" #define SCREEN_WIDTH 256 #define SCREEN_HEIGHT 192 #define ulVertexUVXY(u, v, x, y) ({ GFX_TEX_COORD = ((u16)(v)) << 20 | ((u16)(u)) << 4; \ GFX_VERTEX16 = (((u16)(y)) << 16) | ((u16)(x)); \ GFX_VERTEX16 = 0; }) int main() { int textureID; powerON(POWER_ALL); irqInit(); irqEnable(IRQ_VBLANK); videoSetMode(MODE_0_3D); vramSetBankA(VRAM_A_TEXTURE); glViewPort(0,0,255,191); BG_PALETTE[0] = RGB15(0, 0, 0); glClearDepth(0x7FFF); glInit(); glEnable(GL_BLEND); glEnable(GL_TEXTURE_2D); GFX_CONTROL &= ~GL_OUTLINE; GFX_COLOR = 0x7fff; glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); glMatrixMode(GL_PROJECTION); glIdentity(); glOrthof32(0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, -4090, 1); glPushMatrix(); glMatrixMode(GL_TEXTURE); glIdentity(); glMatrixMode(GL_MODELVIEW); glIdentity(); glMatrixMode(GL_MODELVIEW); glGenTextures(1, &textureID); glBindTexture(0, textureID); glTexImage2D(0, 0, GL_RGB, TEXTURE_SIZE_128 , TEXTURE_SIZE_128, 0, TEXGEN_TEXCOORD, (u8*)texture_bin); while(1) { GFX_BEGIN = GL_QUADS; ulVertexUVXY(0, 0, 5, 5); ulVertexUVXY(0, 128, 5, 133); ulVertexUVXY(128, 128, 133, 133); ulVertexUVXY(128, 0, 133, 5); GFX_END = 0; GFX_FLUSH = 0; swiWaitForVBlank(); } return 0; } |
Also, I have another question: I can't find any doc that tells how to set up an extended rotation background, in tiled mode. I've read in many places that it was possible, and as I need a wide map, with a large set of tiles (more than 256), this mode is very interesting.
Thanks in advance