ia3n_g
2006.08.12, 09:46 AM
I get the basic idea of the difference between a development and deployment build, as for why you would want to have the two different modes. From reading Apple's docs and things I've found on Google, I get the basic advantages of each, but I haven't been able to find out what about the underlying functionality causes some of the weird effects I've been getting.
Does Development mode change the way that extern works, or mess with inheritance in C++? I have a bug that shows up only in Development mode, and am trying to decide whether I have a problem with memory management that hasn't shown up yet in Deployment, or if this is just some Development linker error.
I have a class called Camera, which is built on top of a class called polarObject. A polarObject is anything with a location described in polar coordinates and angular velocity (my camera only orbits the scene, it doesn't not slide side to side). In Development mode, arguments to the Camera class's constructor don't get passed on to the polarObject's constructor. It just gets junk data for arguments, so the camera winds up placed right at the very center of the scene where it can't see anything.
In my various attempts at debugging, I've established that the Camera constructor gets the right arguments, the polarObject's this pointer stores the same address as the Camera's this pointer, and I can hack it to work for my current purposes by just hard-coding the values I want for the camera into the polarObject constructor. (That means I can't use polarObject for anything else though, so I need to fix that)
My code:
in globals.h:
extern Camera camera;
in camera.h:
class Camera: public polarObject
{
public:
//constructor with default arguments
Camera(GLfloat rad=30.0f,GLfloat horiz=0.0f,GLfloat vert=0.2f) : polarObject(rad,horiz,vert,kClamp) {}
...
};
in camera.cpp:
//Definition of global variable declared in "globals.h"
Camera camera;
in polarobject.h:
class polarObject
{
public:
//Constructor with default arguments for angular velocity
polarObject(GLfloat rad, GLfloat horiz, GLfloat vert, char clampMode, GLfloat radVel=0.0f, GLfloat horizVel=0.0f, GLfloat vertVel=0.0f);
...
};
in polarobject.cpp:
//Implementation of constructor
polarObject::polarObject(GLfloat rad, GLfloat horiz, GLfloat vert, char clampMode, GLfloat radVel, GLfloat horizVel, GLfloat vertVel) : clampMode(clampMode)
{
//cout statements here show the arguments having junk data
loc[0]=rad;
loc[1]=horiz;
loc[2]=vert;
...
//my hack to temporarily make it work
loc[0]=20;
loc[1]=0;
loc[2]=.2;
}
If I'm doing something stupid with the way the files are linked together, let me know. Otherwise I'll keep looking for some sort of pointer abuse...
Does Development mode change the way that extern works, or mess with inheritance in C++? I have a bug that shows up only in Development mode, and am trying to decide whether I have a problem with memory management that hasn't shown up yet in Deployment, or if this is just some Development linker error.
I have a class called Camera, which is built on top of a class called polarObject. A polarObject is anything with a location described in polar coordinates and angular velocity (my camera only orbits the scene, it doesn't not slide side to side). In Development mode, arguments to the Camera class's constructor don't get passed on to the polarObject's constructor. It just gets junk data for arguments, so the camera winds up placed right at the very center of the scene where it can't see anything.
In my various attempts at debugging, I've established that the Camera constructor gets the right arguments, the polarObject's this pointer stores the same address as the Camera's this pointer, and I can hack it to work for my current purposes by just hard-coding the values I want for the camera into the polarObject constructor. (That means I can't use polarObject for anything else though, so I need to fix that)
My code:
in globals.h:
extern Camera camera;
in camera.h:
class Camera: public polarObject
{
public:
//constructor with default arguments
Camera(GLfloat rad=30.0f,GLfloat horiz=0.0f,GLfloat vert=0.2f) : polarObject(rad,horiz,vert,kClamp) {}
...
};
in camera.cpp:
//Definition of global variable declared in "globals.h"
Camera camera;
in polarobject.h:
class polarObject
{
public:
//Constructor with default arguments for angular velocity
polarObject(GLfloat rad, GLfloat horiz, GLfloat vert, char clampMode, GLfloat radVel=0.0f, GLfloat horizVel=0.0f, GLfloat vertVel=0.0f);
...
};
in polarobject.cpp:
//Implementation of constructor
polarObject::polarObject(GLfloat rad, GLfloat horiz, GLfloat vert, char clampMode, GLfloat radVel, GLfloat horizVel, GLfloat vertVel) : clampMode(clampMode)
{
//cout statements here show the arguments having junk data
loc[0]=rad;
loc[1]=horiz;
loc[2]=vert;
...
//my hack to temporarily make it work
loc[0]=20;
loc[1]=0;
loc[2]=.2;
}
If I'm doing something stupid with the way the files are linked together, let me know. Otherwise I'll keep looking for some sort of pointer abuse...