Texture size limit?

I am writing a few classes that create a Shape3D that is textured so as to display a text.
I maintain a texture that contains all characters for a particular font in a single line, so the texture’s size is like 32*8192. This texture is not being rendered. If I artificially limit its size to 2048 it gets rendered properly.
Is there a limit on the texture size, and if so what is it?

Depends on the graphics card. Older cards have a limit of 512x512… others 2048x2048 or even higher, but you shouldn’t use anything bigger than 512x512 (since there are still alot of that cards around).

So put it into a 512x512 texture. It’s same amount of pixels… so if all chars are 32x32 it will fit :slight_smile:

All right, thanks!

After creating CanvasPeerImpl, you cal use

canvasPeer.getMaxTextureSize()

to determine actual max texture size for actual GL context.

Note that you have to render at least one frame before getting valid value due to lazy context creation implemented in JOGL. I typically render black screen or simple loading progress bar.

Yuri

Why don’t you just create many small textures?

wiesi

depending on how the video card is dealing with texture paging, you can seriously harm performance by doing this as large numbers of small textures tend to cause texture memory fragmentation as the GPU pages out textures that aren’t in use to get new textures in. Since those new textures require contiguous memory - all of the smaller textures can end up taking more texture memory than if they were just put onto one larger texture. This too has some disadvantages - but you won’t end up with memory fragmentation.