Weird Problem !!!

Hi, im a newbie on OpenGL and what im trying to do is to render a square with 2 for-loops setting it pixel by pixel. The problem is that when i render it on some coordinates it works just fine but i have discovered that i get one horizontal and one vertical line going through the rectangle. I am doing this in XOR-mode and i need to keep doing that.

Pleas, please help me with this weird problem. Listed below is all my code.

#include <GL/glut.h>
#include <windows.h>
void myinit(void)
glClearColor(0.0, 0.0, 0.0, 0.0);
glColor3f(1.0, 1.0, 1.0);
gluOrtho2D(0.0, 500.0, 0.0, 500.0);

//enable XOR'ing

void display( void )
for(int y = 100; y <= 300; y++)
for(int x = 200; x <= 400; x++)
glVertex2i(x, y);
glFlush(); /* clear buffers /
void main(int argc, char
* argv)
/* Standard GLUT initialization */
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowPosition(0,0); glutCreateWindow(“Test”);

myinit(); /* set attributes */

glutMainLoop(); /* enter event loop */


Do you need to do it GL_POINTS?

Yes I do. This is just a simpler test but i have other drawinfunctions that in time will make up 3d-renering engine. So it has to be in points when im rendering my objects.

Anyway, im starting to suspect that this problem that im having lies in my 3d-card. Im not sure yet though.

Isnt there a GL_LINE_WIDTH eviqualent for points?
Set that to 1.0 which it already probably is.

Take a closer look at your glOrtho setup.
IIRC you should do a very small translation in the x and y direction ( 0.5, 0.5) or (0.375, 0.375) to make sure your OpenGL coordinates will correctly and reliably map to pixels in your window. This has to do with internal rounding errors.