#103553 - Izhido - Fri Sep 22, 2006 8:08 pm
Hi! Me, again :)
First, I'd like to apologize in advance if this was already asked before. You see, English is not my native language, and I'm just a newbie on the DS scene, so no matter how hard I try, sometimes I can't seem to find previously posted answers to issues I'm having with my programs. And, sometimes, looking at how quick you answer my posts, I feel like I should have tried harder to find the answer by myself :).
Now, on to the issue:
This program:
was compiled with the latest devkitPro as of today (Sep. 12, 2006). And this is what my DS shows at the top screen:
(Link to where the image's posted:)
http://img217.imageshack.us/my.php?image=onhardwaremk5.png
The image was actually taken from emulation, but it shows exactly what is seen in current hardware.
Any idea what could be happening here? The program (if I did it correctly) should draw a 8x8 "floor", of which I should see a 4x8 zone, since the camera's at center of it, at 1 unit above the "floor". However, many of the tiles at the left of the screen are not there... like they were clipped away from the scene. Why's that?
This program was meant to illustrate an issue on a project I'm currently working on, where this odd clipping behavior also occurs. I have two versions of the code, one for Windows, one for DS. The GL code for both versions is the same, save for one line:
DS:
Windows:
Would this change have any impact on what I'm seeing at my DS? Actually, I was forced into doing the change because, if I used the Windows version on the DS, the perspective of the scene would appear way too distorted. Would this affect somehow the way polygon clipping works?
I'm stuck at this point. I can't think of any workarounds for this. Any help will be greatly appreciated!
EDIT: Changed the URL of the image. Thanks, Lick.
Last edited by Izhido on Tue Sep 26, 2006 12:08 am; edited 2 times in total
First, I'd like to apologize in advance if this was already asked before. You see, English is not my native language, and I'm just a newbie on the DS scene, so no matter how hard I try, sometimes I can't seem to find previously posted answers to issues I'm having with my programs. And, sometimes, looking at how quick you answer my posts, I feel like I should have tried harder to find the answer by myself :).
Now, on to the issue:
This program:
Code: |
#include <nds.h> extern "C" int main() { bool IsRunning; float i; float j; powerON(POWER_ALL); videoSetMode(MODE_0_3D); glViewPort(0,0,255,191); glClearColor(0,0,0); glClearDepth(0x7FFF); IsRunning = true; while(IsRunning) { glReset(); glPolyFmt(POLY_ALPHA(31) | POLY_CULL_NONE); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(36.0, 256.0 / 192.0, 0.01, 6.4); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glTranslatef(0,-1,0); glBegin(GL_TRIANGLES); for(i = -4; i < 4; i++) { for(j = -4; j < 4; j++) { glColor3f(0.8,0.1,0.1); glVertex3f(i, 0, j); glVertex3f(i + 1, 0, j); glVertex3f(i + 1, 0, j + 1); glColor3f(0.1,0.1,0.8); glVertex3f(i + 1, 0, j + 1); glVertex3f(i, 0, j + 1); glVertex3f(i, 0, j); }; }; glEnd(); glPopMatrix(1); glFlush(); swiWaitForVBlank(); }; } |
was compiled with the latest devkitPro as of today (Sep. 12, 2006). And this is what my DS shows at the top screen:
(Link to where the image's posted:)
http://img217.imageshack.us/my.php?image=onhardwaremk5.png
The image was actually taken from emulation, but it shows exactly what is seen in current hardware.
Any idea what could be happening here? The program (if I did it correctly) should draw a 8x8 "floor", of which I should see a 4x8 zone, since the camera's at center of it, at 1 unit above the "floor". However, many of the tiles at the left of the screen are not there... like they were clipped away from the scene. Why's that?
This program was meant to illustrate an issue on a project I'm currently working on, where this odd clipping behavior also occurs. I have two versions of the code, one for Windows, one for DS. The GL code for both versions is the same, save for one line:
DS:
Code: |
gluPerspective(36.0, 256.0 / 192.0, 0.01, 6.4); |
Windows:
Code: |
gluPerspective(72.0, 256.0 / 192.0, 0.01, 6.4); |
Would this change have any impact on what I'm seeing at my DS? Actually, I was forced into doing the change because, if I used the Windows version on the DS, the perspective of the scene would appear way too distorted. Would this affect somehow the way polygon clipping works?
I'm stuck at this point. I can't think of any workarounds for this. Any help will be greatly appreciated!
EDIT: Changed the URL of the image. Thanks, Lick.
Last edited by Izhido on Tue Sep 26, 2006 12:08 am; edited 2 times in total