PDA

View Full Version : CLAMP_TO_BORDER and bordered 3D texture can't work together?



parcalto
05-31-2004, 10:48 PM
Hi all,
Can GL_CLAMP_TO_BORDER and bordered 3D texture work together?
It will freeze the program without any OpenGL error.

I tried the following combination:
CLAMP_TO_EDGE + bordered 3D texture -> OK
CLAMP_TO_BORDER + unbordered 3D tex -> OK
CLAMP_TO_BORDER + bordered 3D tex -> The window goes blank and program freezes

"bordered texture" means glTexImage3D() with a
(2^n + 2)^3 image, and set parameter "border" to 1.

I tried the program on GeForce4, QudroFX and Raedon 9700.

I need this feature to write a simple volume renderer. To drop fragments that falls outside [0,1], I use GL_CLAMP_TO_BORDER and set border color's alpha value to zero. But such method will cause artifacts near the edge of the volume, because the linear filter will average the border color with the edge color. So I need to give the volume a border which RGB components are "borrowed" from adjacent volume data.

An alternative is to use GL_CLAMP_TO_EDGE and glClipPlane(.), but...I haven't try them. :p

vincoof
06-02-2004, 07:18 AM
Once more this just shows that bordered textures are not very well supported yet, even on "workstations" (QuadroFX).

CLAMP_TO_EDGE + bordered 3D texture -> that's ok because texturing ignores border thanks to clamp_to_edge, so it behaves like there was no border.

CLAMP_TO_BORDER + unbordered 3D tex -> because there is no border, a constant border color is used, which shouldn't kill performance very much

CLAMP_TO_BORDER + bordered 3D tex -> worst case scenario. Either your graphics cards won't support it, either it will kill your memory or kill performance. So it won't run or run very slowly (IMHO you're experiencing the latter).