error C2664: 'glMaterialfv'

The following is code i am trying to apply to an object in opengl:
GLfloat material_Ka[] ={0.11,0.06,0.11,1};
GLfloat material_Kd[] ={0.43,0.47,0.54,1};
GLfloat material_Ks[] ={0.33,0.33,0.52,1};
GLfloat material_Ke[] ={0,0,0,0};
GLfloat material_Se =5.0;

	glMaterialfv(GL_FRONT, GL_AMBIENT, material_Ka);
	glMaterialfv(GL_FRONT, GL_DIFFUSE, material_Kd);
	glMaterialfv(GL_FRONT, GL_SPECULAR, material_Ks);
	glMaterialfv(GL_FRONT, GL_EMISSION, material_Ke);

-> glMaterialfv(GL_FRONT, GL_SHININESS, material_Se);

And I get the following error message in relation to the last line:
cannot convert parameter 3 from ‘float’ to ‘const float *’

And Solutions?

Originally posted by gerire:
And Solutions?

How about learning C and pointers prior to OpenGL?

This is a very basic C pointer mistake and has nothing to do with OpenGL (not even with OpenGL beginners).

Learn to walk before you try to run.

Declare the material property as below:
GLfloat material_Se[] = {5.0};

This should work. Hope that helps!!

vijay.

Thanks for tryin to help but it didnt work either

G

Replace

glMaterialfv(GL_FRONT, GL_SHININESS, material_Se);

with

glMaterialfv(GL_FRONT, GL_SHININESS, &material_Se);

Notice the ‘&’ characterc before the last parameter? That means the address_to_material_Se…
cannot convert float to float* means that it requires an address rather than a value.

What vijaykiran said SHOULD work too BTW, why it doesn’t beats me…

since shininess is only 1 floating point value, you could leave off the v:

glMaterialf(GL_FRONT, GL_SHININESS, material_SE);

jebus