gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Getting the projection- and modelviewmatrix

#59210 - TomschikSimon - Sun Oct 30, 2005 12:07 pm

Is there any possibility to get the projection- and modelviewmatrix after these were set?

I would like to do frustum-culling in my demo, so I have to build the frustum, but I can't find any possiblity to get these matrices, except creating my own matrixfunctions (like gluPerspective, glRotateX), which store the matrices.

But these function would decrease performance, because the original functions do these transformations in hardware.

#59220 - mike260 - Sun Oct 30, 2005 2:12 pm

I think you can get the combined modelview*projection matrix back from the hardware, but I don't know how exactly.
Also, I believe the DS supports hardware bounding-box testing against the current fustrum, but again I don't know how to do this.

In any case, there's no support for either of these things in libnds.
_________________
"Ever tried? Ever failed? No matter. Try Again. Fail again. Fail better."
-- Samuel Beckett

#59309 - TomschikSimon - Mon Oct 31, 2005 11:25 am

Thank you. It looks like I have to write my own matrix-functions or to hope, that somebody will find the address of the register holding these matrix soon.

But I have another question: How does the div32 and mod32 functions work.
I don't get any proper results

My code:
Code:
int test = mod32(3,6)

My result is 0, but why

#59315 - TomschikSimon - Mon Oct 31, 2005 12:47 pm

Sorry, Error of IDeaS. I've tested the same code in DSEmu and now it works.
Looks like IDeaS doesn't emulate the DIV_CR commands.

#59357 - dovoto - Mon Oct 31, 2005 8:19 pm

I will add functions for reading the matrix back from the stack to next release...i thought i had those in there. I am trying to decide if I want to do a glGetfloat/int type interface or just do a more practicle approach like glGetMatrix().
_________________
www.drunkencoders.com