View Full Version : Circle looks like an ellipse

huseyin ozcelik
09-27-2011, 02:00 AM
My sample code belows. The screen resolution is 1280x1024. Promlem is that circle looks like an ellipse. How can I keep objects to be stretched.?

When resize window, the objects distorted.

glViewport(0, 0, a_nWidth, a_nHeight);
glOrtho(m_fLeft, m_fRight, m_fBottom, m_fTop, -10, 10);

09-27-2011, 03:58 AM
it's probably this line
glOrtho(m_fLeft, m_fRight, m_fBottom, m_fTop, -10, 10);

if the coordinates for glOrtho does not have the same aspect ratio as the rendering window then everything will look stretched.

huseyin ozcelik
09-27-2011, 04:08 AM
My aspect ratio currently is 1.238 something like that. I modified this line like this,

glOrtho(m_fLeft * 1.238, m_fRight * 1.238, m_fBottom, m_fTop, -10, 10);

Everything now looks like a circle. But I am not sure that is true or not.

Also I have a conversion from worldToScreen() and screenToWorld() method.

On screen, mouse position shows wrong place.

I do not know how to correct this problem.