🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

lighting problem

Started by
0 comments, last by chris82 23 years, 11 months ago
what the hell i''m doing wrong? i have wrote an utility that import a 3d model and now i''m trying to display it but it look like too flat!the model is correctly imported but i need to initialize the light in the right way .can someone tell me what i''m doing wrong i have tried a lot of setting but the model looks ever flat. my setting are : glClearColor( 0.0f, 0.0f, 0.0f, 0.0f ); glShadeModel(GL_SMOOTH); glEnable(GL_LINE_SMOOTH); glEnable(GL_POINT_SMOOTH); static float fog_color[4] = { 1.0f, 0.0f, 1.0f, 1.0f}; glEnable(GL_CULL_FACE); glEnable(GL_FOG); glFogf(GL_FOG_MODE, GL_LINEAR); glFogfv(GL_FOG_COLOR, fog_color); glClear( GL_COLOR_BUFFER_BIT |GL_DEPTH_BUFFER_BIT); glLightfv(GL_LIGHT1, GL_AMBIENT, LightAmbient); glLightfv(GL_LIGHT1, GL_DIFFUSE, LightDiffuse ); // glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, dir ); // Setup The Diffuse Light // glLightfv(GL_LIGHT1, GL_SPOT_CUTOFF ,∠ ); glLightfv(GL_LIGHT1,GL_POSITION,LightPosition); glMaterialfv(GL_FRONT,GL_AMBIENT,noamb); glMaterialfv(GL_FRONT, GL_SHININESS,&shin); glMaterialfv(GL_FRONT, GL_EMISSION,gray); glLoadIdentity(); glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA); //glEnable(GL_BLEND); glEnable(GL_LIGHTING); glEnable(GL_LIGHT1); glViewport(0, 0, 800, 600); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glLoadIdentity(); glTranslatef(0.0f,0.0f,-10.0f); glRotatef(theta,0.0f,-11.0f,1.0f); glColor4f(1.0f,0.0f,0.0f,0.1f); initdis(); glCallList(1); glTranslatef(0.0f,-1.0f,-7.0f); SwapBuffers( hdc ); and the variable are : GLfloat LightAmbient[]= { 1.0f, 1.0f, 1.0f, 1.0f }; GLfloat LightPosition[]= { 0.0f, 0.0f, 2.0f, 1.0f }; GLfloat LightDiffuse[]= { 0.3f, 0.0f, 1.0f, 1.0f }; GLfloat gray[]= { 1.0f, 0.0f, 0.0f, 0.3f }; GLfloat noamb[]={0.0f,0.0f,0.0f,1.0f}; GLfloat dir[]= {0.0f,0.0f,0.0f}; GLfloat angle=15.0f; GLfloat shin=60.3f;
Advertisement
see reply to your post "this."

This topic is closed to new replies.

Advertisement