Commits

Bill Meltsner committed 8513648

that awkward moment when you forget you can't automatically allocate arrays with variable expressions in C++

Comments (0)

Files changed (1)

src/modules/graphics/opengl/Canvas.cpp

 
 	love::image::ImageData * Canvas::getImageData(love::image::Image * image)
 	{
-		GLubyte pixels[4*width*height];
+		GLubyte * pixels = new GLubyte[4*width*height];
 
 		strategy->bindFBO( fbo );
 		glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
 			strategy->bindFBO( 0 );
 
 		love::image::ImageData * img = image->newImageData(width, height, (void*)pixels);
+		
+		delete[] pixels;
 
 		return img;
 	}