I need to dynamically create this structure array, at the beginning of my program and when the window is updated.

I am using GLUT (OpenGL) to create a gradient fill image and draw it's pixels on the screen, and I need the image to update itself when the window is resized.

Does anyone know how to get it working with malloc to dynamically create the array? Thanks in advance.

Code:
/* my image structure */
typedef struct tagColour{
	float r; /* red   */
	float g; /* green */
	float b; /* blue  */ 
} PIXEL_COLOUR;

PIXEL_COLOUR pixel_image[PIXEL_WIDTH][PIXEL_HEIGHT];