#139182 - DiscoStew - Mon Sep 03, 2007 6:32 am
Currently in my code, I have some functions that have been relying on pushing and popping the matrix, with matrix manipulations in between as so....
But, I've been looking into optimizing my overall code for displaying 3D models, as the push takes 17 cycles and the pop takes 36 cycles (at 33 Mhz units). When diving through the spec sheet, I came across glRestoreMatrix, which if I am correct copies the matrix from the stack onto the current matrix. So, by moving some code around, I came up with this...
On No$GBA, it works out just fine, but on hardware, everything is screwed up. Of course emulation of the DS isn't perfect, and I don't know if this specific function is correctly working in the first place on the emulator (would be funny that a function not working correctly actually makes stuff look correct). Is there something I'm missing?
_________________
DS - It's all about DiscoStew
Code: |
*** loop start *** glPushMatrix(); *** do calculations *** glPopMatrix(1); *** loop end *** |
But, I've been looking into optimizing my overall code for displaying 3D models, as the push takes 17 cycles and the pop takes 36 cycles (at 33 Mhz units). When diving through the spec sheet, I came across glRestoreMatrix, which if I am correct copies the matrix from the stack onto the current matrix. So, by moving some code around, I came up with this...
Code: |
glPushMatrix(); LastMatrix = ((GFX_STATUS >> 8) & 0x001F) - 1; *** loop start *** glRestoreMatrix( LastMatrix ); *** do calculations *** *** loop end *** glPopMatrix(1); |
On No$GBA, it works out just fine, but on hardware, everything is screwed up. Of course emulation of the DS isn't perfect, and I don't know if this specific function is correctly working in the first place on the emulator (would be funny that a function not working correctly actually makes stuff look correct). Is there something I'm missing?
_________________
DS - It's all about DiscoStew