PDA

View Full Version : 1D Texture



wis mak
09-19-2002, 11:46 PM
Hi
I'm doing a kind of cartoon rendering. I use a 1D texture to store shade values. It looks working fine unless the single texture coordinate is 1.0; then every thing is messy.
Shade values are random and changing as I move or resize the window. I'm rendering trinagles as smooth shaded and 1D textured.
I tried to pass the 1.0 texcoord in a similar program, not mine, and I got the same distrubing results.
Is it a driver problem? or is it a normal thing?
Thanks.

Bob
09-20-2002, 12:11 AM
Maybe yuo have the wrap mode set to GL_REPEAT, so when sampling the texture coordinate 1.0, you get a sample from the other edge of the texture aswell (due to linear filterting). Try change the wrap mode to GL_CLAMP.



glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP);

vincoof
09-20-2002, 12:40 AM
Bob's right. The texture wrapping may be causing this.
Though, I'd rather recommend GL_CLAMP_TO_EDGE instead of GL_CLAMP.
Almost all todays cards (if not all) support GL_CLAMP_TO_EDGE.