我的C++/openGL程序有问题。运算符分配数组时遇到的问题
在代码的一些点,像这样的(这是一个构造函数):
MyObject(MyMesh * m, MyTexture* t, float *c=NULL, float *sr=NULL, int sh=100){
texture=t;
mesh=m;
subObjects=NULL;
texCoords=NULL;
if (texture!=NULL){
texCoords=new float[mesh->numSurfacePoints*2];
新抛出的std :: bad_alloc异常。在另一个地方是一样的。 是否有可能,我用完了内存?我不这么认为,所以如果你能帮助我,我会很高兴! 再见!
mesh-> numSurfacePoints的值是多少? – 2009-11-18 15:33:35
你知道numSurfacePoints有多少点吗? – 2009-11-18 15:34:02
是否有可能将网格作为null传入? – ChadNC 2009-11-18 15:51:07