SDL_MapRGB always returns 0 on the display surf ace

For some reason, SDL_MapRGB always returns 0 for the color when I call it on the
display surface. For example, SDL_MapRGB (SDL_GetVideoSurface()->format, 100,
10, 10);

The display surface is of type SDL_SWSURFACE, created using the same bbp as the
desktop. I am using SDL 1.2.9 in Windows XP.

I can fill the display surface using a specific color by calling SDL_FillRect
and using an arbitrary integer as the color. But I would like to use SDL_MapRGB.
SDL_MapRGB does work on other surfaces, for example bitmaps.

Thanks,
-Luke

don’t use SDL_GetVideoSurface()…just use the surface your using…

Alex~On 2/20/06, Luke Crook wrote:

For some reason, SDL_MapRGB always returns 0 for the color when I call it on the
display surface. For example, SDL_MapRGB (SDL_GetVideoSurface()->format, 100,
10, 10);

The display surface is of type SDL_SWSURFACE, created using the same bbp as the
desktop. I am using SDL 1.2.9 in Windows XP.

I can fill the display surface using a specific color by calling SDL_FillRect
and using an arbitrary integer as the color. But I would like to use SDL_MapRGB.
SDL_MapRGB does work on other surfaces, for example bitmaps.

Thanks,
-Luke


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


Smith: "…Why, Mr Anderson, Why - Do - You - Persist?"
Neo: “Because I choose to.”
-Matrix Revolutions

Alex Barry <alex.barry gmail.com> writes:

don’t use SDL_GetVideoSurface()…just use the surface your using…

Alex,

I just tried but I get the same result. The weird thing is that I’m getting a
result of BitsPerPixel == 64 when I inspect the SDL_PixelFormat structure of the
display surface.

-Luke

I just tried but I get the same result. The weird thing is that I’m getting a
result of BitsPerPixel == 64 when I inspect the SDL_PixelFormat structure of the
display surface.

That’s really interesting. What platform are you running on?
The official SDL release doesn’t have support for 64-bit surfaces.

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment