Hi,
I applied texturing using OpenGL in MFC activex control.I want to move the circle to the left corner of the window as well as i want to move the font which i mentioned near the right side of the circle.
whenever I resize the MFC activex control,texturing portion and also the Font is going out of the control.(ie, Half of the circle is displaying & Font is getting collapsed).Because I am using glRasterPos2d(....).
I want the circle and Font displayed to be clearly viewable AS ORIGINAL , if i resize the control
I AM ATTACHING MY CODE ALSO:
void CPPIDisplayCtrl::OnSize(UINT nType, int cx, int cy)
{
COleControl::OnSize(nType, cx, cy);
HWND hWnd = GetSafeHwnd() ;
HDC hDc = ::GetDC(hWnd) ;
wglMakeCurrent(hDc, m_hGLContext) ;
int width, height;
double aspect;
width = cx;
height = cy;
glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if (width > height)
{
if (cy==0)
aspect = (double)width;
else
aspect = (double)width/(double)height;
glOrtho(-1*aspect, 1*aspect, -1, 1, -1, 1);
}
else
{
if (cx==0)
aspect = (double)height;
else
aspect = (double)height/(double)width;
glOrtho(-1, 1, -1*aspect, 1*aspect, -1, 1);
}
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glDrawBuffer(GL_BACK);
}
void CPPIDisplayCtrl::DisplayParameterInfo()
{
glColor3ub(255,0,0);
glRasterPos2d(1.3, 0.3);
m_nFont.FontPrintf(m_glDegreeFont, 1, ā%dā, m_nCount) ;
}
I call the DisplayParameterInfo() in OnPaint() only.