Programming/openGL

openGL 은선제거

구차니 2025. 7. 29. 18:14

숨겨진 선이나 면을 제거하는 건데

폴리곤의 방향에 따라서 해당 면을 앞면으로 판단해 렌더하냐 안하냐를 설정해 주어야 한다.

그런데 폴리곤의 normal vector를 이용해 cpu로 처리하는거 보다 이렇게 gpu에서 처리하도록 구현되어 있...겠지?

 

glEnable(GL_CULL_FACE);
glFrontFace(GL_CW);
glCullFace(GL_BACK);

glEnable(GL_DEPTH_TEST);

[링크 : https://blog.naver.com/thooy/10097790648]

 

Name
glCullFace — specify whether front- or back-facing polygons can be culled

C Specification
void glCullFace( GLenum mode);
 
Parameters
mode
Specifies whether front- or back-facing polygons are candidates for culling. Symbolic constants GL_FRONT, GL_BACK, and GL_FRONT_AND_BACK are accepted. The initial value is GL_BACK.

[링크 : https://registry.khronos.org/OpenGL-Refpages/es2.0/xhtml/glCullFace.xml]

 

은선 제거 기법에는 다음과 같은 기법들이 있다.


. 최대 최소법에 의한 은선 처리
. 법선 벡터법에 의한 은선 처리
. 능선 탐색법에 의한 은선 처리
. 공간 접근
. 객체 공간 알고리즘
. 리스트 순위 알고리즘
. 이미지 공간 알고리즘
. 워노크 알고리즘
. 프랭크린 알고리즘
. 웨일러-아델톤 알고리즘

[링크 : https://blog.naver.com/hwa7132/100096580196]

[링크 : https://learnopengl.com/Advanced-OpenGL/Face-culling]

[링크 : https://funnypr.tistory.com/m/entry/OpenGL-Normal-Vector]

[링크 : https://usingsystem.tistory.com/m/487]

[링크 : https://www.gamedev.net/forums/topic/620304-opengl-frustum-culling-with-glrotatef/]