gfp91
04-23-2012, 05:55 PM
Hi i need help with moving a light.
at the start of the program i define the floats.
GLfloat Light_Ambient[] = {0.7f, 0.7f, 0.7f, 255.0f};
GLfloat Light_Diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat Light_Position[]= {0.0f, 1.0f, 3.5f, 1.0f};
but later on in the program while the scene is running i wanted to move the light to the players position
glLightfv(GL_LIGHT1, GL_AMBIENT, Light_Ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, Light_Diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, Light_Position);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
light_Position[]={tVector3.x,tVector3.y,tVector3.z, 1.0f};
but i get the following errors
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2059: syntax error : ']'
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '{'
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '}'
Thanks GFP91
at the start of the program i define the floats.
GLfloat Light_Ambient[] = {0.7f, 0.7f, 0.7f, 255.0f};
GLfloat Light_Diffuse[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat Light_Position[]= {0.0f, 1.0f, 3.5f, 1.0f};
but later on in the program while the scene is running i wanted to move the light to the players position
glLightfv(GL_LIGHT1, GL_AMBIENT, Light_Ambient);
glLightfv(GL_LIGHT1, GL_DIFFUSE, Light_Diffuse);
glLightfv(GL_LIGHT1, GL_POSITION, Light_Position);
glEnable(GL_LIGHT1);
glEnable(GL_LIGHTING);
light_Position[]={tVector3.x,tVector3.y,tVector3.z, 1.0f};
but i get the following errors
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2059: syntax error : ']'
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '{'
1>i:\year 2\graphics programming\mloader\main.cpp(318) : error C2143: syntax error : missing ';' before '}'
Thanks GFP91