Material Problem

My problem is that i cannot set up my material using my structure because the “data member initializer is not allowed”. This is deffo a simple mistake but its kinda annyoying. Here is the code.

struct material {
float ambient[4];
float diffuse[4];
float specular[4];
float shininess;
};

material redShinyMaterial = {
{0.80,0.05,0.05, 1.0},
{0.80,0.05,0.05, 1.0},
{1.0,1.0,1.0, 1.0},
100.0
};

greatful for any help thanks before hand.

This is a C question, not openGL. :stuck_out_tongue:
However, I compiled your code with
Visual studio 2010
GCC -> gcc test.cpp -std=gnu++98 -Wall -pedantic
and it work fine even if I would complain about the double to float cast.
Are you sure that you don’t have some define the change the meaning of material.
Why don’t you use a constructor?