PDA

View Full Version : Texture Problems



JoshB
06-21-2006, 09:40 AM
I experiencing issues when using large textures in the following code environment where I am using OpenGL to visualize image projections:

I am projecting the textures onto polys and I wish to clamp using a border to extend out the border color beyond the texture. A call to glGetIntegerv(GL_MAX_TEXTURE_SIZE, ... ) in my implementation returns 4096. Thus, per all documentation I have read, the max size is actually 4098 with borders included.

When I use a square texture of 4098 the border seems not to be respected on what is the bottom and right side of my texture image. The top and left of my texture image are "clamped" properly, but the bottom and right sides get "clamped" using information from the texture image proper and not the border. This also occurs when using a square texture of 2050 (2048 + 2 for border). I have to go all the way down to 1026 in order for the clamping aspect to work as expected.

It seems that there is something beyond the MAX_TEXTURE_SIZE that is coming into play here when using clamped borders. It appears that one cannot only rely solely upon information obtained by glGetIntegerv(GL_MAX_TEXTURE_SIZE, ... ) in order to get things running properly. The main concern is that I have no idea what the other limitations are.

To make sure I am using border and clamping properly . . . I am taking my texture image proper and copying the information into the center of a buffer that is two pixels larger in either dimension, leaving a single pixel border on all sides. This single pixel border is of the color I wish to use when clamping. Is this correct?

Speaking of which, if you must build your own border into your buffer, what is the purpose of calling 'glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor)'?

ZbuffeR
06-21-2006, 10:47 AM
Border color specifies a single color to be used for all border texels. Convenient for simple cases.

About these limitations, if your are really sure it works for smaller textures, it can be an implementation bug. What is you hardware/driver/os ?

Try to fiddle with proxy texture, it is more precise than GL_MAX_TEXTURE_SIZE :
http://www.opengl.org/resources/faq/technical/texture.htm#text0120

JoshB
06-21-2006, 11:31 AM
Thanks.

Yes. Smaller textures work fine.

I tried out the proxy texture concept to which you linked. In the proxy test I used a size of 4098 x 4098 with an identical *format* as my real texture and received successful results (results claiming I should be able to use the size and format).

I am rendering to an offscreen world created via a context created using AGL. I am running MacOS 10.3.9 with a GeForceFX 5200 card. When I call glGetString(GL_VERSION) I get "Apple 1.1".

You may have discovered the problem with the hardware question. A 4098 x 4098 x 4 texture is just over 67 meg. The VRAM of my card is only 64 MB. Do you believe that this is the problem?

Thanks again.

JoshB
06-21-2006, 11:40 AM
Though, now that I think of it, the 2050 x 2050 x 4 texture doesn't render properly either and that is well below the 64 MB mark. . .