Square not being clipped correctly

Hello, I am doing a simple square using

glColor3f(0, 0, 0);
glVertex3f(0, 0, 1);
glVertex3f(1, 0, 1);
glVertex3f(1, 0, 2);
glVertex3f(0, 0, 2);

When I resize the window so that it slightly clips the square a diagonal line appears from the bottom left to the top right of the square. This only happens on my laptop which runs on XP, but works fine on my desktop which runs vista. Does this have to do with my drivers or something?

To put it bluntly, the XP implementation of OpenGL sucks. You’ve probably stumbled upon a bug. The only possible solution I can think of is to split your rectangle into two triangles.

Same happens for polygon stipple if the rect is partly out of the screen…

Thanks a lot! I’ll stick to using triangles instead

No problem. XP’s implementation is one of the driving factors for me to upgrade to Vista.

… For ATI you mean ?

Not sure what you mean? I use nVidia. Are ATi’s drivers better?

I’m confused, what implementation of OpenGL on XP sucks?? There isn’t one, there a driver for each card, and they implement OpenGL. There may be software implementations on certain OS’s, but that’s a different story. If you are hitting some part of the GL that the software backup is being used, it’s going to run badly, so this seems like a driver bug to me.

I may be stating it wrong. Everything I’ve read states that Microsoft basically forces all GL calls to be wrapped by calls to DirectX in XP or something like that. My personal experience is that GL is faster and more stable on Vista.

NoKKiE, can you post your code? I’ve just tried it and it works perfectly.

MarkS, that is certainly not the case. If your card does not have a native OpenGL driver there have been wrappers based upon direct X, but they have been pretty bad. A card with native OpenGL support does not have to go through DirectX, this includes nVidia, ATi, Intel parts, etc…

Read this:

XP should perform equally or better than Vista for most games, for instance.

I stand corrected and gratefully so. I must have misread.

It was a pretty simple test I used. I just drew the cube as above with the following transformations:
glLoadIdentity(); // clear current matrix

// Viewpoint Transformations
gluLookAt(5, 5, 0,
0, 0, 0,
0, 1, 0);

OnSize has this code:

glViewport(0, 0, (GLint) w, (GLint) h);
gluPerspective((GLdouble)45.0, (GLdouble) ((double)w)/h, 0, 10000);

I am now using glBegin(GL_LINE_LOOP); and it works perfectly. I’m sure it’s a bug with the implementation.