powervr
1
Hi guy,
I use the following codes to draw a rectangle:
glBegin(GL_LINES);
glVertex2i(100,100)
glVertex2i(200,100)
glVertex2i(200,100)
glVertex2i(200,200)
glVertex2i(200,200)
glVertex2i(100,200)
glVertex2i(100,200)
glVertex2i(100,200)
glEnd();
The upper left of the rectangle is “losing 1-pixel”, any suggestion for this error?
Thanks! 
why dont u use
glRectf(100,100,200,200).
Btw, the code u posted should be
glVertex2i(100,200);
glVertex2i(100,100);
Another alternative is to use GL_LINE_STRIP instead of GL_LINES.
The problem with pixel alignment is probably because of your matrix setup, have a look at the faq on this website about transformations.
Mikael
powervr
4
Originally posted by Only Sophoo…:
[b]why dont u use
glRectf(100,100,200,200).
Btw, the code u posted should be
glVertex2i(100,200);
glVertex2i(100,100);
[/b]
yes, i know glrecti() do the trick for me.
but the requirement is to draw rectangle from line segments.
i just want to find out the reason.
thanks anyway 