Clipping oddness...

So I’ve been having a problem for a while now (with multiple pieces of code) where the left hand edge of my vieport seems to be clipping weirdly. The clear color fills in just fine, but anything that I render close to the edge of the viewport dissapears. Sometimes. Resizing the window changes the amount that is clipped oddly, but it’s not a uniform change. One movement will have no effect, the same movement again might make the problem go away (or become unnoticably small…).

I have a picture of what I’m talking about at http://www.geocities.com/hloew/edge.html

That particular example happens to be an Ortho projection into a pane of an MFC app, but it could just as well be perpective in a normal window.

I’ve done some searches looking for similar problems on the forum, but honestly I’m not even sure what to call this… At first I thought I might be doing my viewport sizing calculations wrong (in some very odd way) but I’ve confirmed all of them as good. I also figure that if it were a vieport size issue then the clear color wouldn’t be drawn into the “dead” spot.

Edit:
Oh… this only happens on the left edge. I’ve never seen it anywhere else, and believe me, I’ve been looking!
End of Edit

Anyone have any ideas what the heck this might be?

[This message has been edited by kabir (edited 04-17-2002).]

This looks like bitmaps getting clipped as soon as the current rasterposition is outside the viewing volume. That’s how OpenGL is supposed to work.

Jean-Marc.

Originally posted by JML:
[b]This looks like bitmaps getting clipped as soon as the current rasterposition is outside the viewing volume. That’s how OpenGL is supposed to work.

Jean-Marc.[/b]

But they’re being drawn, rather specifically, inside the current viewing volume. I’m also confused about the resizing: If the window is size X initially, and I resize it some number of times until the problem goes away, then return it to size X the problem doesn’t necessarily come back… this doesn’t seem to indicate viewing volume issues… or am I missing something?

Following up on JML. Are they bitmap images? When you resize are you resizing exactly with some thing like a MoveWindow() call, or are you sizing the box with a mouse. If the latter, even though you think you’ve gotten it back to the same size it more than likely will be a pixel or two off and that is enough to make your raster position valid or invalid.

Originally posted by Furrage:
Following up on JML. Are they bitmap images? When you resize are you resizing exactly with some thing like a MoveWindow() call, or are you sizing the box with a mouse. If the latter, even though you think you’ve gotten it back to the same size it more than likely will be a pixel or two off and that is enough to make your raster position valid or invalid.

I’m sorry, perhaps I chose a bad example to show the problem… this same thing happens if I render a quad which covers the entire viewport… it gets drawn everywhere except in the “dead” area along the left.

Also, when using bitmaps (as in the font example the picture is of) there are plenty of cases where half of the 0 is missing rather than the whole thing… I thought that when raster positions are invalidated that the whole bitmap would always dissapear…

Ok, so I’ve done some more investigating into this problem.

For reference, I’m doing this in my window resize function:

glViewport( 0, 0, w, h );

fRange = m_fFarClipPlane - m_fNearClipPlane;
if (w <= h) {
glOrtho (-fRange, fRange, -fRangeh/w, fRangeh/w, -fRange, fRange);
}
else {
glOrtho (-fRangew/h, fRangew/h, -fRange, fRange, -fRange, fRange);
}

Edit: w & h come to me from the low & high words of the lParam associated with the WM_RESIZE message. /Edit

Which is pretty much right out of the OpenGL Superbible.

So at this point I’m using an orthographic projection, and drawing a quad at the near clip plane with dimensions larger than the viewport.

When this first draws I have again a dead strip along the left (filled with my clear color though). This time, though, rather than resizing the window I just move it (drag the title bar). For some reason that changes the dimensions of the dead strip in a non-uniform way (as well as making an additional dead strip along the top)

?!?

I’ve enabled super verbose debugging and sure enough the window resizing function isn’t getting called when I move the window, so now I’m very, very unclear on what the
heck is going on.

BTW - I’m on WinME with a GeForce3 card (so I’m pretty sure it’s not this: http://support.microsoft.com/default.aspx?scid=kb;ES-VE;q272222)) if that will make any difference.

[This message has been edited by kabir (edited 04-22-2002).]


So at this point I’m using an orthographic projection, and drawing a quad at the near clip plane with dimensions larger than the viewport.

Have you tried drawing the quad slightly away from the near plane? Perhaps you are not experiencing left-side clipping but front-side clipping…

HTH

Jean-Marc

If your window resizing function isn’t being called then it has to do with message handleing. So start by tracing the path from your WM_SIZE event and see if it leads to your resize code. Also check to see what causes a WM_SIZE event (just in case something really screwy is happeing). Alterantively, post your full resize and message handleing code.

No, no, no…

The fact that the window resize function isn’t being called is expected and correct. Re-read the post: I’m not resizing the window. I’m moving the window, as a whole unit. I just added that the resize function wasn’t being called in order to firmly eliminate it from the discussion, because it’s not an issue.

As for near plane clipping: The quad I’m drawing isn’t being competely clipped, and is paralell with the viewport, so that shouldn’t be an issue. Just to double check though, I drew it furthur into the view volume and still have the same issue.

Solution!

So it was a driver problem. It would seem that the nVidia/Hercules drivers that shipped with my GeForce 3 card (3D Prophet III) had a bug in them, or something, as upgrading to the latest and greatest has completely eliminated my problem.

It’s nice to know I’m not insane