PDA

View Full Version : a simple but strange problem



Nil_z
05-20-2003, 05:43 PM
My code is like this:

glBegin(GL_LINE_LOOP);
glColor3f(1.0f, 0.0f, 0.0f);
glVertex3f(m_near_vert[0][0], m_near_vert[0][1], m_near_vert[0][2]);
glVertex3f(m_near_vert[1][0], m_near_vert[1][1], m_near_vert[1][2]);
glVertex3f(m_near_vert[2][0], m_near_vert[2][1], m_near_vert[2][2]);
glVertex3f(m_near_vert[3][0], m_near_vert[3][1], m_near_vert[3][2]);
glEnd();

glBegin(GL_LINE_LOOP);
glColor3f(0.0f, 1.0f, 0.0f);
glVertex3f(m_far_vert[0][0], m_far_vert[0][1], m_far_vert[0][2]);
glVertex3f(m_far_vert[1][0], m_far_vert[1][1], m_far_vert[1][2]);
glVertex3f(m_far_vert[2][0], m_far_vert[2][1], m_far_vert[2][2]);
glVertex3f(m_far_vert[3][0], m_far_vert[3][1], m_far_vert[3][2]);
glEnd();

each glBegin()/glEnd() connects four points to make a frame. The strange thing is the first glBegin()/glEnd() will not output correct result, 2 lines are missing. I have met problem like this for a few times, when drawing primitives by GL_LINES, GL_LINE_STRIP or GL_LINE_LOOP. Does anyone what's wrong here?

the display card I use is GF4MX with latest driver.

Rog
05-21-2003, 08:07 AM
Make sure all your vertices are within the near and far clipping planes. Maybe you get the ends chopped off!