PDA

View Full Version : Ctrl size changed when im changing the resolution



pnpvivek
10-29-2009, 08:44 AM
Hello friends,

I developed one activex control using openGL. Then i inserted into MFC MDI application. Im having problem when iam changing the screen resolution.when im using the control from one small resolution to another(bigger) the control size is getting reduced .After that i converted back to previous resolution i didnt get the correct control size.

Following are the code used in On size in activex control.Kindly give the solution.

thanks in advance.

-------------------
{
double aspect;

glViewport(0, 0, cx, cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

if (cx > cy)
{
if (cy==0)
aspect = (double)cx;
else
aspect = (double)cx / (double)cy;

glOrtho(-1*aspect, 1*aspect, -1, 1, -1, 1);
}
else
{
if (cx==0)
aspect = (double)cy;
else
aspect = (double)cy/(double)cx;

glOrtho(-1, 1, -1*aspect, 1*aspect, -1, 1);
}

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();