SDL Documentation Project

Ever wanted better documentation? Ever wondered what a function did
and had to look at the source code for the answer? Ever looked for a
demo doing exactly the effect you want?

Now’s your chance!

The SDL Documentation Project is a loose group of individuals who are
interested in adding to and maintaining documentation for SDL, including
an improved function reference, tutorials, and lots of examples.

I would love to see something like FAQ-O-Matic for the API, where people
could dynamically add notes to the API reference for each function.

Martin Donlon is organizing this effort to improve the SDL documentation.
If you have the time and interest in joining this project, send him some
e-mail at: akawaka at csn.ul.ie

[SDL documentation translators are specially invited to join this effort]

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

Just to keep people up to date with a few things that have been
happening over the past few weeks.

SDLDoc has moved from sourceforge to skynet.ie, some student run servers
that I admin here in the university. So the web address to the latest
documentation is now http://sdldoc.csn.ul.ie (the documentation there
comes straight out of my ~/src/sdldoc directory. The CVSROOT of the
project is now: :pserver:anonymous at cvs.csn.ul.ie:/services/cvs/sdldoc
If you are so inclined, you can browse the repository online at
http://cvs.csn.ul.ie. Remember, the sdldoc source is DocBook/SGML, not
HTML so its only really useful if you want to roll your own output (PS
for instance) or if you want to contribute.
The documentation at http://sdldoc.csn.ul.ie is now all PHP rather
than HTML, so makesure you have a .php extension when quoting
references. The PHP docs now have a dynamic commenting system which
allows you to add notes and helpful advice to any part of the
documentation, similar to the system at php.net. This system is there to
allow people to share code snippets or examples, comment of possible
uses or pitfalls that people should be aware of and generally to add
what you feel is currently missing from a section of the documentation.
It is not a guestbook or a message board, it is not somewhere to
request features or improvements to SDL and it is not the place to ask
questions about a certain part SDL or SDLDoc that you do not understand.
Most of that can be discussed here, questions or correctiosn related
directly to the documentation should be sent to sdldoc at skynet.ie (or if
sam wants to setup an alias sdldoc at libsdl.org :).

I think that about covers it.-- 

Martin

Bother! said Pooh, as @TO posted again.

hello,

i’ve read the messages concerning the SDL_Surface to oGL texture
conversion.
I’m using PNG images, and i’m loading them with the SDL_image library.
I don’t have any problem with colors, but I have the well-known “upside
down” texture problem.
I tried to use Andreas’s code, but it did nothing. I found the following
code in the openGL_and_SDL demo (i think), but the problem is : the
texture is no longer upside-down, but the colors are BGR. So i have either
bad colors and good up/down, or good colors and bad up/down. I don’t
understand all the following code : especially, i don’t understand why and
where it changes the color organization.
Can someone help me ?
Thanks in advance,

phneutre.

P.S. : I can use GL_BGR instead of GL_RGB when making the texture, but it
doesn’t seem to work on openGL 1.1…

— Here come the code ----

SDL_Surface *
ImageLoad (const char *filename)
{

SDL_Surface *image;
Uint8 *rowhi, *rowlo;
Uint8 *tmpbuf, tmpch;
int i, j;

image = IMG_Load (filename);
//

tmpbuf = (Uint8 *) malloc (image->pitch);
// <skipping the test (tmpbuf==0)>

rowhi = (Uint8 *) image->pixels;
rowlo = rowhi + (image->h * image->pitch) - image->pitch;
for (i = 0; i < image->h / 2; ++i)
{
for (j = 0; j < image->w; ++j)
{
tmpch = rowhi[j * 3];
rowhi[j * 3] = rowhi[j * 3 + 2];
rowhi[j * 3 + 2] = tmpch;
tmpch = rowlo[j * 3];
rowlo[j * 3] = rowlo[j * 3 + 2];
rowlo[j * 3 + 2] = tmpch;
}
memcpy (tmpbuf, rowhi, image->pitch);
memcpy (rowhi, rowlo, image->pitch);
memcpy (rowlo, tmpbuf, image->pitch);
rowhi += image->pitch;
rowlo -= image->pitch;
}

free (tmpbuf);

return (image);
}–
www.shmix.net
shmixman3d.shmix.net

Isn’t there a function to convert surfaces? SDL_ConvertSurface:

http://www.libsdl.org/docs/sdlconvertsurface.html--

Olivier A. Dagenais - Software Architect and Developer

“Clement Bourdarias” wrote in message
news:20010326194221.7c130145.cbour at noos.fr

hello,

i’ve read the messages concerning the SDL_Surface to oGL texture
conversion.
I’m using PNG images, and i’m loading them with the SDL_image library.
I don’t have any problem with colors, but I have the well-known “upside
down” texture problem.
I tried to use Andreas’s code, but it did nothing. I found the following
code in the openGL_and_SDL demo (i think), but the problem is : the
texture is no longer upside-down, but the colors are BGR. So i have either
bad colors and good up/down, or good colors and bad up/down. I don’t
understand all the following code : especially, i don’t understand why and
where it changes the color organization.
Can someone help me ?
Thanks in advance,

phneutre.

P.S. : I can use GL_BGR instead of GL_RGB when making the texture, but it
doesn’t seem to work on openGL 1.1…

— Here come the code ----

SDL_Surface *
ImageLoad (const char *filename)
{

SDL_Surface *image;
Uint8 *rowhi, *rowlo;
Uint8 *tmpbuf, tmpch;
int i, j;

image = IMG_Load (filename);
//

tmpbuf = (Uint8 *) malloc (image->pitch);
// <skipping the test (tmpbuf==0)>

rowhi = (Uint8 *) image->pixels;
rowlo = rowhi + (image->h * image->pitch) - image->pitch;
for (i = 0; i < image->h / 2; ++i)
{
for (j = 0; j < image->w; ++j)
{
tmpch = rowhi[j * 3];
rowhi[j * 3] = rowhi[j * 3 + 2];
rowhi[j * 3 + 2] = tmpch;
tmpch = rowlo[j * 3];
rowlo[j * 3] = rowlo[j * 3 + 2];
rowlo[j * 3 + 2] = tmpch;
}
memcpy (tmpbuf, rowhi, image->pitch);
memcpy (rowhi, rowlo, image->pitch);
memcpy (rowlo, tmpbuf, image->pitch);
rowhi += image->pitch;
rowlo -= image->pitch;
}

free (tmpbuf);

return (image);
}


www.shmix.net
shmixman3d.shmix.net

thanks a lot, i didn’t understand how to use this function, but now it’s
ok.
At last, I know how pixels conversions and PiwelFormats work :slight_smile:

Cheers,
phneutre.On Mon, 26 Mar 2001 10:07:34 -0800 “Olivier Dagenais” <olivier.dagenais at canada.com> wrote:

Isn’t there a function to convert surfaces? SDL_ConvertSurface:

http://www.libsdl.org/docs/sdlconvertsurface.html