[SDL] DirectX 7?
paul at theV.net
paul at theV.net
Wed Oct 2 09:20:01 PDT 2002
On Mon, Sep 30, 2002 at 04:12:13PM +0200, David Olofson wrote:
> On Friday 27 September 2002 03:34, paul at theV.net wrote:
> > So far it is working like a charm. I'll check if I am allowed to share
> > the source, but anyway, it isn't difficult stuff, I can post sample
> > binaries if anybody here is interested to take a look.
> Both would be very interesting. If you're allowed to share the source,
> I'd be happy to integrate it into glSDL.
I put up the two tests at
with binaries for both Windows and Linux. Attached is the README.
I'll get back to you on whether I'm allowed to share the source.
-------------- next part --------------
Managing 2D surfaces as GL textures
The directory contains two test programs that demonstrate how 2D
surfaces are managed as GL textures. Both Windows and Linux
(i386) binaries are provided. You may need to have SDL and
SDL_image (with jpeg support) installed on Linux before you can
run the binaries.
1. tiletest <width> <height>
It shows a window of the size width x height painted in red.
Left click mouse and drag to draw a green rectangle, which will
then show the details how such surfaces are splitted into square
quads and how it shall be rendered to the screen. Press key to
toggle a real image rendering.
This program demostrates how an arbitary sized surface can be
splitted into optimal number of textures and how the rendering
is done. Basically, it tries to fits the largest quad of 2^N to
the surface, and then fits the margins in similar fashion. Small
margins that is less than 128x128 are managed by a small surface
manager, which is demonstrated in the next program.
It shows a 128x128 (the minimum sized quad) rectangle in red.
Left click mouse and drag to draw small green rectangles, and
the program will try to arrange them on the quad in a particular
order so as to save wasted space.
This program shows how multiple small surfaces are managed onto
a single texture. It is not a global optimal solution, but
nevertheless, it tries to be local optimal at minimizing wasted
spaces. This especially useful for surfaces such as typeface
glyphs (font rendering), where they have similar sizes.
NOTE: In both programs, you can use option -gl at the command
line to turn on openGL rendering if your system supports it.
The programs in this package are for demo purpose only. For any
enquiries, please contact the author at paul at theV.net
By Paul H. Liu (paul at theV.net) -- Thu Oct 3 2002
More information about the SDL