Ctrl size changed when im changing the resolution

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();

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.