[SDL] problem rendering fonts to texture

Artem Baguinski artm at v2.nl
Sat Oct 28 11:00:41 PDT 2006


On 28 Oct 2006, at 05:02, Ilya Olevsky wrote:

>>> Are the width and height power of two?
>> I havent checked that. Is there any way to force the surface to  
>> have an
>> specific size?
>>> The upload will fail if they are not.
>>> Have you checked that there is no error in the upload?
>> No, Im not making checks, except if the text is rendered to surface.
>
> You can make a new surface with the width and height being values that
> are powers of two, and blit the SDL_ttf generated surface to it.

better make an empty texture (pixels parameter to glTexImage2D ==  
NULL) with power of two sizes and update / use only a part of it (use  
glTexSubImage2D).

and use the following to find the size of the texture:

> A simple way to get power of two dimensions closest to the original  
> values
> is to use a while loop starting at 1, squaring each number until you
> find the first smallest power of two >= original number.






More information about the SDL mailing list