using MFC with OpenGL

I am a newbie to both MFC and OpenGL programming and I’ve been following a tutorial ( 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?

… 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!!

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.