sansan

04-13-2009, 07:10 AM

Can anybody explain me the following piece of OpenGL documentation related to glClipPlane() function:

void glClipPlane( GLenum plane, const GLdouble * equation);

Parameters

plane

Specifies which clipping plane is being positioned. Symbolic names of the form GL_CLIP_PLANEi, where i is an integer between 0 and <u>GL_MAX_CLIP_PLANES</u>-1, are accepted.

...

Description

... To determine the maximum number of additional clipping planes, call <u>glGetIntegerv</u> with argument <u>GL_MAX_CLIP_PLANES</u>.

I am pretty sure the correct way to determine the maximum number of supported clipping planes is calling glGetIntegerv(), but I am also sure that meaningful value for "plane" parameter above also varies from GL_CLIP_PLANE0 to GL_CLIP_PLANEn,

where n = glGetIntegerv(GL_MAX_CLIP_PLANES) - 1.

Is it true or not?

Apart from that, what is the correct way to iterate through all supported clipping plane IDs among the two ones below:

a.

for ( int i = 0, n = glGetIntegerv(GL_MAX_CLIP_PLANES); i < n; i++ ) {

int clipPlaneId = GL_CLIP_PLANE0 + i;

// Setup clipPlaneId-th clipping plane

...

}

or

b.

for ( int i = 0, n = GL_MAX_CLIP_PLANES; i < n; i++ ) {

int clipPlaneId = GL_CLIP_PLANE0 + i;

// Setup clipPlaneId-th clipping plane

...

}

Thank you in advance for answering!

void glClipPlane( GLenum plane, const GLdouble * equation);

Parameters

plane

Specifies which clipping plane is being positioned. Symbolic names of the form GL_CLIP_PLANEi, where i is an integer between 0 and <u>GL_MAX_CLIP_PLANES</u>-1, are accepted.

...

Description

... To determine the maximum number of additional clipping planes, call <u>glGetIntegerv</u> with argument <u>GL_MAX_CLIP_PLANES</u>.

I am pretty sure the correct way to determine the maximum number of supported clipping planes is calling glGetIntegerv(), but I am also sure that meaningful value for "plane" parameter above also varies from GL_CLIP_PLANE0 to GL_CLIP_PLANEn,

where n = glGetIntegerv(GL_MAX_CLIP_PLANES) - 1.

Is it true or not?

Apart from that, what is the correct way to iterate through all supported clipping plane IDs among the two ones below:

a.

for ( int i = 0, n = glGetIntegerv(GL_MAX_CLIP_PLANES); i < n; i++ ) {

int clipPlaneId = GL_CLIP_PLANE0 + i;

// Setup clipPlaneId-th clipping plane

...

}

or

b.

for ( int i = 0, n = GL_MAX_CLIP_PLANES; i < n; i++ ) {

int clipPlaneId = GL_CLIP_PLANE0 + i;

// Setup clipPlaneId-th clipping plane

...

}

Thank you in advance for answering!