60 likes | 112 Views
OpenGL Visibility Detection Functions. Ravindra R Patil (15CS62 ). OpenGL Visibility Detection Functions. Back-face removal:. glEnable(GL_CULL_FACE); glCullFace(mode);. GL_BACK, GL_FRONT, GL_FRONT_AND_BACK. default. glDisable(GL_CULL_FACE);.
E N D
OpenGL Visibility Detection Functions Ravindra R Patil (15CS62)
OpenGL Visibility Detection Functions • Back-face removal: glEnable(GL_CULL_FACE); glCullFace(mode); GL_BACK, GL_FRONT, GL_FRONT_AND_BACK default glDisable(GL_CULL_FACE); • GL_BACK is default. Sometimes we want to see the back faces, for example if we are in a room we can use GL_FRONT
OpenGL Visibility Detection Functions Depth-buffer functions: • Request depth buffer when initializing: glutInitDisplayMode(GLUT_SINGLE|GLUT_RGB|GLUT_DEPTH); • Clear depth buffer each time a new frame is displayed: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); • OpenGL depth-buffer visibility-detection routines can be activated with glEnable(GL_DEPTH_TEST); • and deactivated with glDisable(GL_DEPTH_TEST);
OpenGL Visibility Detection Functions • Wire-frame surface visibility: glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
OpenGL Visibility Detection Functions • Depth cueing: glEnable(GL_FOG); glFogi(GL_FOG_MODE, GL_LINEAR); • This applies the linear depth function to object colors using dmin=0.0 and dmax=1.0. We can set different values for dmin and dmax with the following function calls glFogf(GL_FOG_START, minDepth); glFogf(GL_FOG_END, maxDepth);