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;
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement