[SDL] Get pixel value ...more in details

sragno at libero.it sragno at libero.it
Sat Aug 25 23:41:01 PDT 2001


I wrote SDL_LoadBMP, of course, I meant to say SDL_image

Peter

----- Original Message -----
From: Peter Venis <petervenis at zonnet.nl>
To: <sdl at libsdl.org>
Sent: Monday, August 13, 2001 10:49 AM
Subject: Re: [SDL] OpenGL Textures


> You could use SDL_LoadBMP to load the texture. And for many that is a
> sufficient way, but it has one great dissadvantadge. You have to store the
> bitmap in a standard format (like BMP) and so everybody can view the
images
> in your directory prior to playing your game or application. In many
cases,
> you don't want that.
>
> One easy way to make your own image file format is to make a small
seperate
> application that loads the image using a image library like SDL_LoadBMP or
> OpenIL(can load almost any image format) and then storing the pixel
> information using the following C++ functions:
>
> FILE *fout;
> fout = fopen("my_format.bmf", "wb");
> fwrite(pixel_data, 1, 256*256, fout);
> fclose(fout);
>
> You don't need a file header or other shit since no one else is supposed
to
> read the file. After this you write the code in your main application that
> loads the file my_format.bmf. You can use this simple code:
>
> FILE *fin;
> fin = fopen("my_format.bmf", "rb");
> GLubyte pixel_data[256*256];
> fread( pixel_data, 1, 256*256, fin );
> fclose(fin);
>
> You can also store numerous textures into one big file. After this you use
> the OpenGL functions to convert the array of pixel-data to an OpenGL
> texture.
>
> Hope this helps,
>
> Peter
>
> ----- Original Message -----
> From: Adam Gates <adam at preston.net>
> To: sdl_ml <sdl at libsdl.org>
> Sent: Monday, August 13, 2001 6:10 AM
> Subject: [SDL] OpenGL Textures
>
>
> > What is the best way to load image files into OpenGL textures?
> > Should I use SDL_image to load it and then convert to an OpenGL texture?
> > (Anybody have code for that?)
> > Or use some other library?
> >
> > Adam.
> >
> > _______________________________________________
> > SDL mailing list
> > SDL at libsdl.org
> > http://www.libsdl.org/mailman/listinfo/sdl
>
>
> _______________________________________________
> SDL mailing list
> SDL at libsdl.org
> http://www.libsdl.org/mailman/listinfo/sdl





More information about the SDL mailing list