 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Tue Jul 03, 2007 6:47 pm Post subject: strange problem with vector declaration |
|
|
Hi folks,
i have this vector:
| Code: | | std::vector<ObjColFace*> collisionFaces; |
and the pointer points to :
| Code: | | typedef struct { ScePspFVector3 vertices[3]; } ObjColFace; |
if i use the first line, my psp crashes with an address load / inst fetch error using psplink. when i comment it out it all works fine. I do not use the collisionFaces anyway yet in the program (all usage is commented out)
it gives not compiler errors, what am i doing wrong here ? _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
hlide
Joined: 10 Sep 2006 Posts: 750
|
Posted: Tue Jul 03, 2007 8:32 pm Post subject: |
|
|
*sigh* please don't forget to output the code which uses your std::vector. Nothing can be said here with that very few infos
My hint is that your std::vector has deleted or null pointers because of your blunders or something like. |
|
| Back to top |
|
 |
Ghoti
Joined: 31 Dec 2005 Posts: 288
|
Posted: Tue Jul 03, 2007 8:50 pm Post subject: |
|
|
*sigh* please read correct :p , i stated that I do not use the std::vector in my code at all, just putting in the std::vector makes my psp crash when rendering, but in my render sub it does not use the std::vector:
| Code: | void Obj::Render(float x, float y, float z, float turn) {
//char s[256];
//sprintf(s, "Render location: %f, %f, %f and the TURN: %f", x, y, z, turn);
//DebugTools::PrintText(s);
matrix_identity((float*)&world);
if (turn != 0) {
matrix_identity((float*)&tmpworld);
matrix_rotate((float*)&tmpworld,0,turn,0);
matrix_multiply((float*)&world, (float*)&world, (float*)&tmpworld);
}
matrix_identity((float*)&tmpworld);
matrix_translate((float*)&tmpworld,x,y,z);
matrix_multiply((float*)&world, (float*)&tmpworld, (float*)&world);
sceGuSetMatrix(GU_MODEL,&world);
sceGuTexMode(GU_PSM_8888, 0 ,0 ,0);
sceGuTexFunc(GU_TFX_REPLACE, GU_TCC_RGB);
sceGuTexFilter(GU_LINEAR, GU_LINEAR);
sceGuTexScale(1.0f, 1.0f);
sceGuTexOffset(0.0f, 0.0f);
int i;
for (i=0;i<iNumberOfParts;i++)
{
sceGuTexImage(0, ObjMeshParts[i].texture->textureWidth, ObjMeshParts[i].texture->textureHeight, ObjMeshParts[i].texture->textureWidth, (void*)ObjMeshParts[i].texture->data);
sceGuDrawArray(GU_TRIANGLES,GU_TEXTURE_32BITF|GU_COLOR_8888|GU_VERTEX_32BITF|GU_TRANSFORM_3D,ObjMeshParts[i].iFaces*3,0,ObjMeshParts[i].Vertices);
}
return;
}; |
the std::vector is used to store collisionfaces but is not used at the moment so the only thing i did was adding those two rows in a working application and then it stopped working :s I will look into it more but maybe you have some advice how to find the real error in this or something.
P.S. the sigh and :p were meant as a joke :)[/quote] _________________ My PSP games:
Boxy II: http://www.ghoti.nl/boxyii.php
Elementals: http://www.ghoti.nl/Elementals.php |
|
| Back to top |
|
 |
ufoz
Joined: 10 Nov 2005 Posts: 86 Location: Tokyo
|
Posted: Tue Jul 03, 2007 10:45 pm Post subject: |
|
|
| Your bug is probably elsewhere, and adding the extra variable makes it go away. Try tracking down where it crashes with psplink..? |
|
| Back to top |
|
 |
danzel
Joined: 04 Nov 2005 Posts: 182
|
Posted: Tue Jul 03, 2007 10:49 pm Post subject: |
|
|
Alignment of variables would be my guess.
Search the forum for "alignment", most of the results should be useful.
When you add the vector your variables are no longer aligned in memory as they need to be, so when you try use them with something that requires alignment (VFPU for example, which I assume those matrix functions use) it doesn't work. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|