#74347 - MrK - Sat Mar 04, 2006 5:53 pm
I have this code, heavily borrowed from the nehe's samples from libnds samples:
my idea is putting an ortho perspective matching the real nds coordinates, 256,192, using this
but using this for visibility's sake
the sample works correctly, it just displays a colored quad in the screen, but if you change XPOS to 6.0f, does a weird thing to the quad. could this be a bug in libnds, or it's just I'm doing something wrong?
TIA
MrK
p.s. or maybe an emulator bug, but I've tried in two emulators and both do the same
Code: |
// Turn on everything powerON(POWER_ALL); // Setup the Main screen for 3D videoSetMode(MODE_0_3D); vramSetBankA(VRAM_A_TEXTURE); //NEW must set up some memory for textures // Set our viewport to be the same size as the screen glViewPort(0,0,255,191); // Specify the Clear Color and Depth glClearColor(0,0,0); glClearDepth(0x7FFF); while (1) { // Reset the screen and setup the view glReset(); glOrtho (0,16,16,0,0,256); // ortho screen from 0,0 to 16,16 mapped to 0,0 to 256,192 (should be 256,192 to 256,192, but otherwise I can't see the polys being drawn ;) ) glPushMatrix(); glMatrixMode(GL_TEXTURE); glIdentity(); glMatrixMode(GL_MODELVIEW); //need to set up some material properties since DS does not have them set by default 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)); //ds uses a table for shinyness..this generates a half-ass one glMaterialShinyness(); //ds specific, several attributes can be set here glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); // Set the current matrix to be the model matrix glMatrixMode(GL_MODELVIEW); //Push our original Matrix onto the stack (save state) glPushMatrix(); glLoadIdentity(); // Reset The View glTranslatef(0.0f,0.0f,-5.0f); static float XPOS=4.0f; glBegin (GL_QUADS); glColor3f (1,1,1); glVertex3f(XPOS,0,16); glColor3f (1,0,0); glVertex3f(XPOS+2,0,16); glColor3f (0,1,0); glVertex3f(XPOS+2,4,16); glColor3f (0,0,1); glVertex3f(XPOS,4,16); glEnd(); // Pop our Matrix from the stack (restore state) glPopMatrix(1); // flush to screen glFlush(); } return 0; |
my idea is putting an ortho perspective matching the real nds coordinates, 256,192, using this
Code: |
glOrtho (0,256,192,0,0,256); |
but using this for visibility's sake
Code: |
glOrtho (0,16,16,0,0,256); |
the sample works correctly, it just displays a colored quad in the screen, but if you change XPOS to 6.0f, does a weird thing to the quad. could this be a bug in libnds, or it's just I'm doing something wrong?
TIA
MrK
p.s. or maybe an emulator bug, but I've tried in two emulators and both do the same