[SDL] 2D+3D
Kisai
kisai_z at yahoo.com
Fri Feb 22 01:50:00 PST 2002
> I don't understand what you guys have against the SDL_OPENGLBLIT, I
like
> having the option to ix 2D and 3D things.
If you peek at the SDL source code you will find out that SDL_OPENGLBLIT
creates four 256x256 quads and splits the blitted surface onto it. Very
inefficient. It's far more efficient to upload the image to a texture
and draw a quad with the image as a texture. This way you also have no
conversion, and the images are all in texture memory (OR AGP Memory
which is slower.) But you have to keep in mind that Video cards have a
limited amount of video memory, and that reading anything back from the
video card is painfully slow. So the idea is upload to the card, and
never modify the texture to keep performance.
That's what I did with renai.sf.net , it's messy, it originally started
as C code, there are hacks to cut images onto 4 256x256 textures for
3DFX cards (which is quite the waste of time.) and some other horrible
inefficient things that are nasty. Mainly SDL_TTF is unusable. I'm
looking at FTGL to try and make OpenGL render text and have pre-render
caching, because it is not pleasant to render a string as several images
and figure out the positions, and then have to upload a new text-image
every time. Even worse when you want to make a "typed" look where the
text is progressive. Have to render the entire string again but with an
additional letter(or use scissorbox or stencil clipping.) Very slow, and
you can't have a variable-width texture (with 256x256 3DFX hacks, it
becomes insanely stupid.)
Anyways I realized what the problem was going to be with OPENGLBLIT and
didn't use it.
More information about the SDL
mailing list