Is there any why to occluded object thats hidden behind the object

136 views Asked by At

I still learning how to use OpenGL and I wanna ask if there are any ways to use occlusion culling the occluded the object behind an object (which is not visible to the camera). I had used the frustum culling for detecting the object that is not inside the camera view. Also, I would like to purely use glut only. Don't want to mess with the ARB. Any tip is much appreciate

void render() {

    glColor3f(0,1,0);
    spheresTotal=0;
    spheresDrawn=0;

    for (int i = -3; i < 3; i+=4) 
            for(int k =  -3; k < 3; k+=4) {
                spheresTotal++;
                Vec3 a(i,0,k);
                if (!frustumOn || (frustum.sphereInFrustum(a,0.5) != FrustumG::OUTSIDE)) {

                    glPushMatrix();
                    glTranslatef(i,0,k);
                    glutWireSphere(0.5,5,5);
                    glPopMatrix();
                    spheresDrawn++;

                }
            }

}

This code is mostly refer to the http://www.lighthouse3d.com/tutorials/view-frustum-culling/radar-approach-testing-points/ . It is a good tutorial for beginner like me.

0

There are 0 answers