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

This commit is contained in:
Bill Meltsner
2011-10-12 00:06:15 -05:00
parent bc0cd3b2d5
commit c5cf3fefeb
+3 -1
View File
@@ -287,7 +287,7 @@ namespace opengl
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);
@@ -297,6 +297,8 @@ namespace opengl
strategy->bindFBO( 0 );
love::image::ImageData * img = image->newImageData(width, height, (void*)pixels);
delete[] pixels;
return img;
}