Dear All,
i just started to learn OGL. and try to understand it.
and try to draw line. but it does not draw in negative value
my Setting is
int nCx = rect.Width();
int nCy = rect.Height();
double fAspect = (double)nCy / (double)nCx;
// setup orthographic projection
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(nCx >= nCy) {
glOrtho(0, m_dDocSize, 0, m_dDocSize * fAspect, -m_dDocSize, m_dDocSize);
}
else {
glOrtho(0, m_dDocSize / fAspect, 0, m_dDocSize, -m_dDocSize, m_dDocSize);
}
//glViewport(-1, -1, nCx + 2, nCy + 2);
glViewport(nCx/2,nCy/2,nCx,nCy); // x = y = 0 at the center of screen.
glColor3f(1.0f, 0.0f, 1.0f);
glBegin(GL_LINES);
glVertex3d(-x, -y,0);
glVertex3d(x, y,0);
glEnd();
will some one help me how to draw line with negative value
thanks in advance.
Amrit