MFC & openGL

I want to implement window program using openGL.

But… How is the size of window (only viewport)


In openGL, I know that using

glutInitWindowSize(pixel_width, pixel_height);

can be implemented…

there’s a tutorial at on this

u mean like this??

GLvoid ReSizeGLScene(int width, int height)
height = 1; /don’t divide by zero/

glViewport(0, 0, width, height);

gluPerspective(45.0f, (GLfloat) width/(GLfloat) height, 0.1f, 100.0f);



No… window’s size is constant.

Only… I want to know how to set the

window size(SDI application)

Set the window size? That can always be changing depending on the end user.
Or do you mean determining the viewport?

When application is executed at the first

time, window appears.

I know the function, movewindow.

But this function sets the whole window’s

size(view+menu bar…etc.)

I want to know how to set only view size

(the part of drawing actually)


Ahh so you want to set the drawable area within the window, i.e so you could split the window into 4 panes or something similar?

Once the window has been created or resized, use GetClientRect(HWND hWnd, LPRECT rect) (Windows API) to get the size of the client area - that’s the area within the frame where you’ll be drawing.