我的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