Advertisement

viewport problem.... my circle is displayed elliptic

Started by January 07, 2003 03:12 PM
-1 comments, last by bbbilen 21 years, 10 months ago
hi all, I draw a circle but it is displayed elliptic, I think it''s because of the viewport.. Here''s my code... my application is fullscreen... doesn''t glViewport exactly do? My scrren resolution is 1024*768 but cx and cy values in runtime are 656 and 276 respectively... my code : void CView::OnSize(UINT nType, int cx, int cy) { CView::OnSize(nType, cx, cy); GLdouble aspect_ratio; // width/height ratio if ( 0 >= cx || 0 >= cy ) { return; } /*if I change the below line as glViewport(0,0,cx,cy+200) then my circle becomes a real circle*/ glViewport(0, 0, cx, cy); aspect_ratio = (GLdouble)cx/(GLdouble)cy; // select the projection matrix and clear it glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(-14.0f, 14.0f, -14.0f, 14.0f); // switch back to the modelview matrix and clear it glMatrixMode(GL_MODELVIEW); glLoadIdentity(); }

This topic is closed to new replies.

Advertisement