어디였나.. 뷰포트로 두개 하면 된다고 하는데
예전에 내가 스테레오 비전 만든것도 뷰포트였나? 기억이 안나네..
GLvoid display(GLvoid) { glDrawBuffer(GL_BACK); //draw into both back buffers glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //clear color and depth buffers glDrawBuffer(GL_BACK_LEFT); //draw into back left buffer glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //reset modelview matrix gluLookAt(-IOD/2, //set camera position x=-IOD/2 0.0, // y=0.0 0.0, // z=0.0 0.0, //set camera "look at" x=0.0 0.0, // y=0.0 screenZ, // z=screenplane 0.0, //set camera up vector x=0.0 1.0, // y=1.0 0.0); // z=0.0
glPushMatrix(); { glTranslatef(0.0, 0.0, depthZ); //translate to screenplane drawscene(); } glPopMatrix(); glDrawBuffer(GL_BACK_RIGHT); //draw into back right buffer glMatrixMode(GL_MODELVIEW); glLoadIdentity(); //reset modelview matrix gluLookAt(IOD/2, 0.0, 0.0, 0.0, 0.0, screenZ, //as for left buffer with camera position at: 0.0, 1.0, 0.0); // (IOD/2, 0.0, 0.0) glPushMatrix(); { glTranslatef(0.0, 0.0, depthZ); //translate to screenplane drawscene(); } glPopMatrix();
glutSwapBuffers(); } |
[링크 : http://www.orthostereo.com/geometryopengl.html]
The default framebuffer contains up to 4 color buffers, named GL_FRONT_LEFT, GL_BACK_LEFT, GL_FRONT_RIGHT, and GL_BACK_RIGHT. The left and right buffers are used for stereoscopic rendering. |
[링크 : https://www.khronos.org/opengl/wiki/Default_Framebuffer]
glulookat 쓴거 보면 맞는 듯?
기본 컨셉은 비슷한데 위에 예제는 openGL에서 스테레오 스코픽 지원 기능을 쓰고 있는 거군
void display(void) { glClear(GL_COLOR_BUFFER_BIT); glMatrixMode(GL_MODELVIEW); //GL_PROJECTION glPushMatrix(); glViewport(0, 0, 250, 250); gluLookAt(0.10, 0.0, 0.2, 0.0, 0.0, -2.0, 0.0, 1.0, 0.0); draw_sin(); glPopMatrix(); glPushMatrix(); glViewport(250, 0, 250, 250); gluLookAt(0.2, 0.0, 0.2, 0.0, 0.0, -2.0, 0.0, 1.0, 0.0); draw_sin(); glPopMatrix(); glutSwapBuffers(); } |
'Programming > openGL' 카테고리의 다른 글
glfw - gl framework (0) | 2019.05.07 |
---|---|
openGL 3.0 tutorial (0) | 2019.05.07 |
openGL cardboard lens distortion (0) | 2018.04.25 |
glxgears 소스 (0) | 2016.09.07 |
opencv opengl (0) | 2016.02.26 |