Hi,
it’s me again.
I found this Tutorial.
But if I use this code
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
GLfloat spot_direction[] = {0.0, 0.0, -5.0};
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION,
spot_direction);
glLightf(GL_LIGHT0, GL_SPOT_CUTOFF, 90);
glLightf(GL_LIGHT0, GL_SPOT_EXPONENT, 0);
GLfloat light_specular[] = {1.0, 1.0, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
GLfloat light_ambient[] = {1, 1, 1, 1.0};
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
GLfloat light_diffuse[] = {1.0, 1.0, 1.0, 1.0};
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
- If I rote my model, the light seems to rotate too
void render(void)
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
static float fXrot = 0.0f;
static float fYrot = 0.0f;
static float fZrot = 0.0f;
fXrot += 10.1f * g_fElpasedTime;
fYrot += 10.2f * g_fElpasedTime;
fZrot += 10.3f * g_fElpasedTime;
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
glTranslatef( 0.0f, 0.0f, -5.0f );
glRotatef( fYrot, 0.0f, 1.0f, 0.0f );
glBindTexture( GL_TEXTURE_2D, g_textureID );
Model.Display();
SwapBuffers( g_hDC );
}
So what does fYrot do (why do I need it) ?
-
Can’t I make my model brighter than it is normally ?
-
Why can’t I use specular light ?
-
What is the difference between “ambient” and “diffuse” ?
-
What does alpha ( 4. param of “ambient”) mean ?
-
What does GL_SPOT_CUTOFF make ?
-
What does GL_SPOT_EXPONENT make ?
All my asked params didn’t change anything if I canged them…
Sorry for this long post and its questions, but I couldn’t figure this out :(.