Jones
2006.09.19, 09:27 PM
I've got code with problems. (Doesn't it always start this way?) A little bit into the data loading procedure I get this:
OpenGL(3223,0xa000ed98) malloc: *** vm_allocate(size=3592814592) failed (error code=3)
OpenGL(3223,0xa000ed98) malloc: *** error: can't allocate region
OpenGL(3223,0xa000ed98) malloc: *** set a breakpoint in szone_error to debug
terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
I think their are two possibilities here:
1) OpenGL has no more memory. Not likely.
2) I've screwed up by passing OpenGL funky pointers or something. Likely.
I'm gonna leave out a lot of code and give you the short version, which I hope will suffice for this situation.
Here's the basics:
a) I have a class with a GLuint, it's not a pointer.
b) The above GLuint is for 3D OpenGL textures.
c) I have a function, that is *not* part of said class. But is called from the class.
d) This function expects a pointer to a GLuint. (It needs to be a pointer to avoid the funky address of stuff, of course.
e) I pass an address of before-mentioned GLuint to said function.
f) The function passes it to glGenTextures and glBindTexture and glTexImage3D and gluBuild3DMipmaps, etc...
Here's the even short info:
GLuint myTex;
void foo(GLuint *target) {
glGenTextures(1, target);
glBindTexture(GL_TEXTURE_3D, target);
gluBuild3DMipmaps(... STUFF ...);
}
foo(&myTex);
// Is it in anyway likely or possible that this sucks?
I don't think it's because I'm giving OpenGL the incorrect OpenGL data, it seems more like an allocation problem of some sort.
Thanks for opinions/war stories/druken ramblings! ;)
OpenGL(3223,0xa000ed98) malloc: *** vm_allocate(size=3592814592) failed (error code=3)
OpenGL(3223,0xa000ed98) malloc: *** error: can't allocate region
OpenGL(3223,0xa000ed98) malloc: *** set a breakpoint in szone_error to debug
terminate called after throwing an instance of 'std::bad_alloc'
what(): St9bad_alloc
I think their are two possibilities here:
1) OpenGL has no more memory. Not likely.
2) I've screwed up by passing OpenGL funky pointers or something. Likely.
I'm gonna leave out a lot of code and give you the short version, which I hope will suffice for this situation.
Here's the basics:
a) I have a class with a GLuint, it's not a pointer.
b) The above GLuint is for 3D OpenGL textures.
c) I have a function, that is *not* part of said class. But is called from the class.
d) This function expects a pointer to a GLuint. (It needs to be a pointer to avoid the funky address of stuff, of course.
e) I pass an address of before-mentioned GLuint to said function.
f) The function passes it to glGenTextures and glBindTexture and glTexImage3D and gluBuild3DMipmaps, etc...
Here's the even short info:
GLuint myTex;
void foo(GLuint *target) {
glGenTextures(1, target);
glBindTexture(GL_TEXTURE_3D, target);
gluBuild3DMipmaps(... STUFF ...);
}
foo(&myTex);
// Is it in anyway likely or possible that this sucks?
I don't think it's because I'm giving OpenGL the incorrect OpenGL data, it seems more like an allocation problem of some sort.
Thanks for opinions/war stories/druken ramblings! ;)