PDA

View Full Version : Improper rendering with strange shading or what..?



papaonn
09-10-2012, 08:11 AM
i do not know what is happening with my rendering,
before i was using another computer to render and everything normal,
but then i migrate the program to another computer (acer laptop), then the graphic become like this,
what had i done wrong?

It is like having some missing fragments, but also looks like the shading is having problem, i don know what happened.

http://s12.postimage.org/4zzlygh0d/untitled.jpg


// Set color to use when clearing the background.
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClearDepth(1.0f);

/* Set up some light sources */
glLightfv(GL_LIGHT0, GL_POSITION, light0_pos);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light0_color);
glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION, 0.2);
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION, 0.00001);
//glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.00);
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambient_light);


glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);

// Turn on backface culling
glFrontFace(GL_CW);
glCullFace(GL_BACK);

// Turn on depth testing
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);

glShadeModel(GL_SMOOTH);

// enable blending
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glViewport(0, 0, width, height);

/* Create a viewing frustum */
glMatrixMode(GL_PROJECTION);

glLoadIdentity();

gluPerspective(FOV_ANGLE, 1.0f, CLIPPLANE_NEAR, CLIPPLANE_FAR);
gluLookAt(VIEWER_X, VIEWER_Y, -VIEWER_Z, CENTER_X, CENTER_Y, CENTER_Z, UP_X, UP_Y, UP_Z);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();



Above are my setup code for rendering, i wonder what am i missing to get it right.