I want to create an OpenGL texture from a SDL_Surface.
Has anyone code for this purpose? Or, how is it done?
Thanks,
Pius
I want to create an OpenGL texture from a SDL_Surface.
Has anyone code for this purpose? Or, how is it done?
Thanks,
Pius
Hey, I found this the other day:
http://www.ards.net/Andreas/sdl_textures.html
That should help I think.
Thanks
Matt Johnson> I want to create an OpenGL texture from a SDL_Surface.
Has anyone code for this purpose? Or, how is it done?
Thanks,
Pius
Matt Johnson schrieb am 05 Mar 2001:
Hey, I found this the other day:
I wrote that code a long time ago, when SDL was still using that wierd
alpha inversion. This has changed (I think in 1.1.5) so it’s not
old code:
/* why on earth are the alpha values reversed? */
if(bpp == 32) {
*(data + (bpp / 8) * (y * image->w + x) + 3) =
255 - *(bufp + image->format->Ashift / 8);
but:
*(data + (bpp / 8) * (y * image->w + x) + 3) =
*(bufp + image->format->Ashift / 8);
Actually, the whole copying isn’t really necessary, SDL_ConvertSurface
can do the job for you.
I’ll update the page when I find a minute to do it right.
Olivier A. Dagenais - Software Architect and Developer
“Andreas Umbach” wrote in message
news:20010305183448.A5425 at baobab.hispeed.ch…
Matt Johnson schrieb am 05 Mar 2001:
Hey, I found this the other day:
I wrote that code a long time ago, when SDL was still using that wierd
alpha inversion. This has changed (I think in 1.1.5) so it’s notold code:
/* why on earth are the alpha values reversed? */
if(bpp == 32) {
*(data + (bpp / 8) * (y * image->w + x) + 3) =
255 - *(bufp + image->format->Ashift / 8);but:
*(data + (bpp / 8) * (y * image->w + x) + 3) =
*(bufp + image->format->Ashift / 8);Actually, the whole copying isn’t really necessary, SDL_ConvertSurface
can do the job for you.I’ll update the page when I find a minute to do it right.
- Andreas
–
Check out my 3D lightcycle game: http://www.gltron.org
A 0.60 preview/beta for win32/mac is available NOW!
More than 100’000 Downloads of the last version (0.59)
Actually, the whole copying isn’t really necessary, SDL_ConvertSurface
can do the job for you.
right, and that code is b0rken wrt endianness in 24bpp anyway
you might want to flip it upside down though, but that can probably
be accomplished just as well by rendering it upside down in GL
That seems to work, indeed, but I don’t feel good about doing it that way…
Is it really guaranteed to work fine on all 3D cards, without artifacts or
slowdowns? (Can’t see why it wouldn’t be safe, but there is some strange
hardware out there…)
//David
.- M A I A -------------------------------------------------.
| Multimedia Application Integration Architecture |
| A Free/Open Source Plugin API for Professional Multimedia |
----------------------> http://www.linuxaudiodev.com/maia -' .- David Olofson -------------------------------------------. | Audio Hacker - Open Source Advocate - Singer - Songwriter |
--------------------------------------> david at linuxdj.com -'On Monday 05 March 2001 19:40, Mattias Engdeg?rd wrote:
Actually, the whole copying isn’t really necessary, SDL_ConvertSurface
can do the job for you.right, and that code is b0rken wrt endianness in 24bpp anyway
you might want to flip it upside down though, but that can probably
be accomplished just as well by rendering it upside down in GL