View Full Version : using MFC with OpenGL

06-05-2001, 01:37 PM
I am a newbie to both MFC and OpenGL programming and I've been following a tutorial (http://www.arturmarques.com/tutorials/opengl/) that lets you make a window to display OpenGL graphics in. The problem is that when you resize the window, it resizes the scene. What I really need is to be able to make a scene that is bigger than the window and use scroll bars to scroll around it. Here is the code for resizing the window:

void CMy002_openglView::OnSize(UINT nType, int cx, int cy)
CView::OnSize(nType, cx, cy);

glViewport(0, 0, cx, cy);

Does anyone know how I can use scrollbars to scroll around a scene that is bigger than the display window?

06-05-2001, 01:45 PM
... I think the main problem is that I can't actually figure out how to put scroll bars onto the window. I'm using VCPP6 with a single document MFC application. I'm really stuck!! http://www.opengl.org/discussion_boards/ubb/eek.gif

Mr. Obvious
06-05-2001, 06:16 PM
Well the reason you are resizing the scene is that you are calling glViewport(0, 0, cx, cy). That will always resize your scene.

I think you need to use the CScrollView class for MFC. Find CScrollView in the help for more info.