I have this code on the constructor of a class:
verts=new GLfloat[nVerts];
verts is a member variable of the class (GLfloat *) and nVerts is 4. Is something wrong with that code? I get the same error If i try to do malloc(sizeof(GLfloat)*nVerts) I think I'm not running out of memory, because If i change that line of code to another part of the code(for example to the method that calls the constructor just before calling it, like this: GLfloat *test=new GLfloat[4]
it works)
I'd check 3 things:
nVerts
is 4?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.