[SDL] problem rendering fonts to texture

Artem Baguinski artm at v2.nl
Sun Oct 29 07:57:51 PST 2006


On 29 Oct 2006, at 12:48, Sami Näätänen wrote:

> one dimensional array, which is handled like multi dimensional array.
> To get correct result with such an array, one have to know the row
> length. Normally this has no problem at all. It just works.
>
> When the array represents gfx like SDL surface there starts to be
> problems. Every row might have some extra values to keep the start of
> row in favorable memory alignment.
>
> SDL_surface.pitch is this real row length in bytes. OpenGL texture
> upload can't compensate these extra bytes.

i see what you mean.

OpenGL CAN compensate all this, see glPixelStore. you can specify  
alignment and row length and some other properties of pixel memory.

But will you ever get aligned array when using sdl_ttf? I'm using it  
with OpenGL and i just use surface->w and surface->h and everything  
looks fine with different fonts and font sizes etc.








More information about the SDL mailing list