Pixel Formats OGL

Started by
6 comments, last by Ro_Akira 21 years, 2 months ago
Hi, I''m trying to get a list of pixel formats that my OpenGL app can render to. I''m basically going through describe pixel format handing it an ever increasing pixel format index and discarding modes I don''t want to consider (like bpp<16, no PDF_SUPPORT_OPENGL et cetera). What I''m not finding 100% clear from the docs is whether PDF_GENERIC_FORMAT and PDF_GENERIC_ACCELERATED are mutually exclusive. I took these meanings from the presence of the flags: PDF_GENERIC_FORMAT only = Only supported by the generic (software) implementation PDF_GENERIC_ACCELERATED = Only supported by the hardware) implementation PDF_GENERIC_FORMAT & PDF_GENERIC_ACCELERATED = Supported by both Is this the case? http://www.opengl.org/developers/faqs/technical/mswindows.htm says "...If PFD_GENERIC_ACCELERATED is clear and PFD_GENERIC_FORMAT is set, then the pixel format is only supported by the generic implementation. Hardware acceleration is not possible for this format..." It also says above that, a bit... "...Any format with the PFD_GENERIC_FORMAT attribute bit set will not be hardware accelerated..." The later statement seems to make PFD_GENERIC_ACCELERATED redundant as regards checking for hardware acceleration... Thanks, Ro_Akira
Advertisement

Hi again,

A little more background as to why I''m inquiring about this:

This is the filtering criteria for my list of formats...

if ((pfd.cColorBits >= 16) && (pfd.cDepthBits > 0) &&
((pfd.dwFlags&PFD_DRAW_TO_WINDOW) == PFD_DRAW_TO_WINDOW) &&
((pfd.dwFlags&PFD_DOUBLEBUFFER) == PFD_DOUBLEBUFFER) &&
((pfd.dwFlags&PFD_SUPPORT_OPENGL) == PFD_SUPPORT_OPENGL) &&
!((pfd.dwFlags&PFD_GENERIC_FORMAT) == PFD_GENERIC_FORMAT))

...and below are results in this list. I''ve changed the order and grouped them into two groups. The first is the 32bit colour 0bit alpha group, and the second is the 24bit colour 8bit alpha group. I''m doing this on Geforce3 40.19 reference drivers.

There''s a few questions I have:
1) Why are there some apparently identical formats e.g. 4 and 10? (This is really just as a matter of interest - can always just remove duplicates)
2) Where''s my 16-bit colour modes?
3) I was using the diagnostic tool, Quake3 and it claims to be using ''mode 4'' whether it''s using 16-bit or 32-bit colour. Where''s it getting it''s 16-bit pixel formats from?

DescribePixelFormat...
Pixel format : 4
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 32
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 0
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 0
Alpha bits : 0
Z buffer bits : 24
Stencil buffer bits : 0
DescribePixelFormat...
Pixel format : 10
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 32
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 0
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 0
Alpha bits : 0
Z buffer bits : 24
Stencil buffer bits : 0
DescribePixelFormat...
Pixel format : 6
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 32
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 0
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 0
Alpha bits : 0
Z buffer bits : 24
Stencil buffer bits : 8
DescribePixelFormat...
Pixel format : 12
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 32
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 0
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 0
Alpha bits : 0
Z buffer bits : 24
Stencil buffer bits : 8

DescribePixelFormat...
Pixel format : 5
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 24
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 8
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 24
Alpha bits : 8
Z buffer bits : 24
Stencil buffer bits : 0
DescribePixelFormat...
Pixel format : 11
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 24
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 8
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 24
Alpha bits : 8
Z buffer bits : 24
Stencil buffer bits : 0
DescribePixelFormat...
Pixel format : 7
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 24
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 8
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 24
Alpha bits : 8
Z buffer bits : 24
Stencil buffer bits : 8
DescribePixelFormat...
Pixel format : 13
PFD_SUPPORT_OPENGL : Yes
PFD_GENERIC_ACCELERATED : No
PFD_SWAP_LAYER_BUFFERS : No
PFD_SUPPORT_GDI : No
PFD_DRAW_TO_BITMAP : No
PFD_GENERIC_FORMAT : No
PFD_TYPE_RGBA : Yes
Colour bits : 24
Red bits : 8
Green bits : 8
Blue bits : 8
Alpha bits : 8
Red position : 16
Green position : 8
Blue position : 0
Alpha position : 24
Alpha bits : 8
Z buffer bits : 24
Stencil buffer bits : 8

Thanks,
Ro_Akira
The way I see it:

PFD_GENERIC_FORMAT only = Software
PFD_GENERIC_ACCELERATED only = Accelerated through MCD
Neither = Accelerated through ICD


And your questions:

1. Maybe one of them has an accumulation buffer? Maybe one has PFD_SWAP_COPY and the other has PFD_SWAP_EXCHANGE?
2. Set your screen to 16 bit color.
3. See 2


---
Visit Da Shovvkejs.
---Mikael Lax
Thanks for the reply.
You're right about the PDF_GENERIC_FORMAT & PDF_GENERIC_ACCELERATED flags. I think I should aim for just ICD support.

1. I can't find any flags that are different (including PFD_SWAP_COPY and PFD_SWAP_EXCHANGE) and I'm filtering out accumulation buffer bit information for any mode that has an accumlation buffer bits != 64 (I was just tired of seeing it).
2. You're right about the need to change to 16-bit colour desktop to get the 16-bit modes. Is this why Half-Life likes one to change to a 16-bit desktop before starting?
3. I was thinking that each pixel format was 'set in stone', like mode 4 is always 32-bit with a certain z-buffer etc. Obviously not...

I have another question related to pixel formats now.

// Only want 16-bit+ colour formats
if ((pfd.cColorBits >= 16) &&

// We want a depth buffer
(pfd.cDepthBits > 0) &&

// We want to be able to draw to a window((pfd.dwFlags&PFD_DRAW_TO_WINDOW) == PFD_DRAW_TO_WINDOW) &&

// We want double buffering
((pfd.dwFlags&PFD_DOUBLEBUFFER) == PFD_DOUBLEBUFFER) &&

// We want OpenGL support
((pfd.dwFlags&PFD_SUPPORT_OPENGL) == PFD_SUPPORT_OPENGL) &&

// Only bother with ICD (no MCD or software)
!((pfd.dwFlags&PFD_GENERIC_FORMAT) == PFD_GENERIC_FORMAT) &&
!((pfd.dwFlags&PFD_GENERIC_ACCELERATED) == PFD_GENERIC_ACCELERATED))

The above are the criteria I now use to filter pixel formats. The thing is, according to the DirectX Caps Viewer, I should have these modes:

Depth buffer bits | Stencil Buffer bits
24 8
24 0
16 x

With DescribePixelFormat (...) I only get:

Depth buffer bits | Stencil Buffer bits
24 8
24 0

Where's my 16-bit z-buffer gone? I've tried 16-bit and 32-bit colours modes (not that it should make a difference). Geforce3 64MB is the card, 41.09 are the reference drivers.

Thanks,
Ro_Akira

[edited by - Ro_Akira on January 29, 2003 1:03:12 AM]
1. I dunno, they should be different in some way (I think). Try the memcmp function on them to see if they're totally equal.

16 bit zbuffer is uncommon on nvidia hardware (maybe on others too, I only have my gf3 as reference). I don't think I have any hardware accelerated opengl supporting pixelformat with 16 bit zbuffer.

(edit because I'm stupid)

---
Visit Da Shovvkejs.

[edited by - TheSalmon on January 29, 2003 12:15:47 PM]
---Mikael Lax
Thanks for the reply.

1. Well I''ve got that sorted. Due to a copy and paste, I was was trying to do ((pfd.iPixelType&PFD_SWAP_COPY) == PFD_SWAP_COPY), which wasn''t going to work was it?! It turns out PixelFormat4 has PFD_SWAP_EXCHANGE and PixelFormat10 has PFD_SWAP_COPY. I think I should have a preference for modes with PFD_SWAP_EXCHANGE.

On the 16-bit Z-Buffer front, I saw this page : http://developer.nvidia.com/view.asp?IO=geforce3_faq.

Answer22 seems to suggest that the card does support a 16-bit Z-Buffer. However, it does mention in Answer32 things like D24X8 which is Direct3D speak for 24-bit depth buffer, no stencil.

What I''m saying is that maybe it''s just that the OpenGL drivers, or maybe just the version of the drivers I''m using now (41.09 reference), don''t support it. As always, one is at the mercy of what the drivers tell you is on the card. I''ll try some other/earlier drivers, and see what they tell me...

Thanks,
Ro_Akira
quote:Original post by Ro_Akira
On the 16-bit Z-Buffer front, I saw this page : http://developer.nvidia.com/view.asp?IO=geforce3_faq.

Answer22 seems to suggest that the card does support a 16-bit Z-Buffer. However, it does mention in Answer32 things like D24X8 which is Direct3D speak for 24-bit depth buffer, no stencil.

What I''m saying is that maybe it''s just that the OpenGL drivers, or maybe just the version of the drivers I''m using now (41.09 reference), don''t support it. As always, one is at the mercy of what the drivers tell you is on the card. I''ll try some other/earlier drivers, and see what they tell me...

Thanks,
Ro_Akira


Yeah, I could be wrong. Not that it matters to me, 24 > 16

---
Visit Da Shovvkejs.
---Mikael Lax
i didnt read the whole post but

PFD_GENERIC_FORMAT only = Software
PFD_GENERIC_ACCELERATED only = Accelerated through MCD
Neither = Accelerated through ICD

if either of the first two flags are set then u have software ie PFD_GENERIC_ACCELERATED is not accelerated.
the only way u have true hardware acceleration is if NEITHER are set.

http://uk.geocities.com/sloppyturds/kea/kea.html
http://uk.geocities.com/sloppyturds/gotterdammerung.html

This topic is closed to new replies.

Advertisement