PDA

View Full Version : Problem with clipping (glClipPlane)



akshay
03-28-2007, 02:17 AM
I am using VC++ 6 with the default OpenGL (v1.3.0 build 4.13.01.3317) on Windows 2000 with an Intel 82845 graphics adapter.
Without clipping, my application works fine. This is what I see (as expected):
http://www.sharemation.com/singhaxn/global/without_clipping.jpg

But when I apply clipping as follows:

double arrEq[] = {0, -1, 0, 40};
glClipPlane(GL_CLIP_PLANE0, arrEq);
glEnable(GL_CLIP_PLANE0);This is what I expect to see:
http://www.sharemation.com/singhaxn/global/should_look_like.jpg

But when I rotate the image slightly, this is what happens:
http://www.sharemation.com/singhaxn/global/looks_like.jpg
:confused:

What could the problem be? Is this some bug that I've encountered?

Thanks in advance.

plasmonster
04-05-2007, 02:55 AM
Clip planes are transformed by the current modelview matrix (into eye space), so any modification to the modelview stack is going to affect your planes in some way, depending on where you set them.

There is some more info and an example here (near bottom of page):
http://fly.cc.fer.hr/~unreal/theredbook/chapter03.html

Relic
04-05-2007, 03:33 AM
Anyway the image given shows a bug in the Intel drivers.
User clipping planes divide the space into two half spaces, there is no way how that would generate such stray lines from the initial block outlines.

The modelview dependency just allows to transform the clip plane conveniently. e.g. standing still or rotating with the object is just a matter of when in the transform hierachy you send the clip plane equation.

For a second opinion on your graphics driver's quality, you can manually select a PIXELFORMATDESCRIPTOR with the PFD_GENERIC_FORMAT flag set in the dwFlags field.
Use DescribePixelFormat() to find one, ChoosePixelFomat() is not smart enough.
These will use the Microsoft GDI generic OpenGL implementaiton and return "Microsoft" when asking glGetString(GL_VENDOR).

plasmonster
04-05-2007, 03:50 AM
Leaping lizards, I didn't even see the image (I have them turned off in Firefox, and I always forget).

That does look rather nasty. It's hard to tell what's being drawn.

Akshay, if you could post the code that reproduces the image (or the problem), that might help too.