'glutReshapeFunc'에 해당되는 글 2건

  1. 2011.04.24 glutReshapeWindow() 는 크기 변화가 없으면 안그려 OTL 2
  2. 2011.04.05 glViewport
Programming/openGL2011. 4. 24. 23:32
기본적인 예제에서 reshape 쪽에 glOrtho 나 gluPerspective 를 사용하도록 코드가 구현되어 있다.
이를 변경해서, o 와 p 키를 누르면 변경되게 했는데
이래저래 reshape쪽 루틴을 타지 않길래 실험을 해보았더니
reshape는 말그대로 window의 크기 변동에 따라 다시 그리도록 하는 녀석이기 때문에
"윈도우 크기의 변화가 없으면 glutReshapeFunc 에 등록된 루틴을 태우지 않는다.

이래저래 키보드 입력해서 처리를 해야 하나..
아니면 크기를 바꾸는 꽁수를 써야하나?

Usage
void glutReshapeWindow(int width, int height);

width  New width of window in pixels.
height New height of window in pixels.

Description

glutReshapeWindow requests a change in the size of the current window. The width and height parameters are size extents in pixels. The width and height must be positive values.

The requests by glutReshapeWindow are not processed immediately. The request is executed after returning to the main event loop. This allows multiple glutReshapeWindow, glutPositionWindow, and glutFullScreen requests to the same window to be coalesced.

In the case of top-level windows, a glutReshapeWindow call is considered only a request for sizing the window. The window system is free to apply its own policies to top-level window sizing. The intent is that top-level windows should be reshaped according glutReshapeWindow's parameters. Whether a reshape actually takes effect and, if so, the reshaped dimensions are reported to the program by a reshape callback.

glutReshapeWindow disables the full screen status of a window if previously enabled. 

[링크 : http://www.opengl.org/resources/libraries/glut/spec3/node23.html]

'Programming > openGL' 카테고리의 다른 글

openGL - DoF  (2) 2011.05.03
직교좌표계와 원근좌표계 전환하기  (0) 2011.05.01
glViewport  (0) 2011.04.05
glFrustum - 절두체  (6) 2011.03.30
openGL tutorial - 태양과 지구 돌리기  (0) 2011.03.29
Posted by 구차니
Programming/openGL2011. 4. 5. 21:08
솔찍히 어떻게 변화하는지 이해를 못한 함수중에 하나..

원본 이미지


glViewport를 사용하지 않고 창의 크기를 변화시켰을 경우



glViewport를 사용하고 창의 크기를 변화시켰을 경우



증상은 일단 접어두고, 
glViewport는 말그대로 뷰포트의 좌표를 설정한다.
glutReshapeFunc는 윈도우의 크기가 변화될 때 불려지는
callback 함수를 등록하는 함수로 변화된 창의 넓이와 높이가 전해진다.

기본적으로 glViewport의 x,y는 좌측 하단의 좌표를 의미하며 (0,0)을 일반적으로 사용한다.
즉 윈도우 좌표계를 설정하는 것으로 1사분면의 좌표를 따른다.

void glutReshapeFunc(void (*func)(int width, int height));
void glViewport(GLint x, GLint y, GLsize iwidth, GLsize iheight);

[링크 : http://www.opengl.org/documentation/specs/glut/spec3/node48.html]
[링크 : http://www.opengl.org/sdk/docs/man/xhtml/glViewport.xml]
 


---
2011.10.06 추가
glutReshapeFunc() 의 기본 callback 함수에는
glViewport(0, 0, (GLsizei) w, (GLsizei) h); 가 정의 되어 있다고 한다.

그리고 glViewport() 함수는 1사분면 처럼 좌측하단이 (0.0) 이다.
X, Y Specify the lower left corner of the viewport rectangle in pixels. The default is (0,0).

그리고  viewport는 화면을 분할하는 데에도 사용할수 있다.
[링크 : 
http://ivis.cwnu.ac.kr/wiki/index.php/MultipleViewport_Ex2] 
Posted by 구차니