SFML community forums

Help => Window => Topic started by: SamuraiCrow on February 19, 2010, 06:41:07 pm

Title: Greyscale 8bpp mode?
Post by: SamuraiCrow on February 19, 2010, 06:41:07 pm
Hello,

In order to emulate an old-style paletted display mode, I was going to implement a CLUT fragment shader on a greyscale 8bpp mode.  It seems that 8bpp modes get promoted to higher depth or don't implement palettes in the way that I think they should.

Is there a way to insure that I get exactly 8 bits per pixel so that I can be sure that my colorize shader works correctly?  I need it to work correctly because my game will use palette cycling effects.

I'm using MacOSX 10.5.8 with SFML 1.5 under C++ native, if it makes any difference.

Thanks in advance,

--Sam
Title: Greyscale 8bpp mode?
Post by: Laurent on February 19, 2010, 06:57:15 pm
Hi

Could you give more details about what you (want to) do?

Where exactly do you want 8bpp (window? image? shader? everywhere?) ?

Do you handle the palette yourself or do you expect SFML to do it?
Title: Greyscale 8bpp mode?
Post by: SamuraiCrow on February 19, 2010, 07:11:27 pm
Since many modern graphics cards don't support palette graphics modes any more, I thought it would be a practical use of a palette shader that would do a color lookup table from an 8 bit per pixel screenmode.  I figured that allocating an 8 bit per pixel greyscale mode would be the most practical way to try to get 8 bits per pixel on the latest versions of OpenGL.

What I was planning on doing was having a bigger-than-screen-size texture that would be 8bpp and then use a shader to render it to the display window using a 1-dimensional 32-bit texture as my CLUT.  There would be part of the screen that would opaquely overlap the 256 color portion of the screen (I think that's called a billboard) which would be 32-bit truecolor.  The 1D texture would change every frame of animation.

Is what I'm doing possible in the current version of SFML?
Title: Greyscale 8bpp mode?
Post by: SamuraiCrow on February 23, 2010, 08:14:21 pm
On second thought I'll probably palette the billboard also.  It will make everything simpler that way.

The important part is that I need to cycle the entries in the palette manually so I need to have control over the palette.