Skip to content

Commit

Permalink
Init memory for screenshot to zero
Browse files Browse the repository at this point in the history
  • Loading branch information
raysan5 committed Jan 31, 2017
1 parent 495108a commit a081171
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/rlgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ void rlglUnloadMesh(Mesh *mesh)
// Read screen pixel data (color buffer)
unsigned char *rlglReadScreenPixels(int width, int height)
{
unsigned char *screenData = (unsigned char *)malloc(width*height*sizeof(unsigned char)*4);
unsigned char *screenData = (unsigned char *)calloc(width*height*4, sizeof(unsigned char));

// NOTE: glReadPixels returns image flipped vertically -> (0,0) is the bottom left corner of the framebuffer
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, screenData);
Expand Down

0 comments on commit a081171

Please sign in to comment.