• Advertisement


This topic is now archived and is closed to further replies.

Window resizing problems..please help!

This topic is 5775 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey everyone, I am working on a windows/opengl application under MFC. The problem Im having is when the user resizes the openGL window the image doesn''t seem to scale properly. For example, I am drawing a Sphere at the center of the screen...a sphere is always a sphere..but when i resize the window I can get an ellipse. I have overrided the "OnSize" message that windows sends to properly set the viewport and perspective, yet this is unaffective. Anyhelp on this issue would be greatly appreciated. BTW : Anyone know how to fix the "flicker" effect when one is resizing a window? Perferati

Share this post

Link to post
Share on other sites

void CEditor::OnSize(UINT nType, int cx, int cy)

// OnSize

// Set OpenGL perspective, viewport and mode

CSize size(cx,cy);

Aspect = (cy == 0) ? (double)size.cx :



// if you want to use frustum , use this piece
// of code

double PI=3.14159265f;
right = Znear * tan( FovX/2.0f * PI/180.0f );
top = right / Aspect;
bottom = -top;
left = -right;
glFrustum(left, right, bottom, top, Znear, Zfar);

// if you don''t want to use frustum viewport
// uncomment here and let opengl do the rest



// note that this code comes from an mdi
// application , you have to change the
// base class onsize member

CMDIChildWnd::OnSize(nType, cx, cy);


let me know if this worked out , byez
by the way i have the flicker problem too and
i''m working to solve it...

Share this post

Link to post
Share on other sites

  • Advertisement