PDA

View Full Version : WGL_ARB_pixel_format + SetPixelFormat



MZ
01-21-2003, 07:28 AM
The problem is rather basic, but i tried hard and found no spec, presentation, tutorial or code example that would carify this.


BOOL SetPixelFormat(HDC hdc, iPixelFormat, CONST PIXELFORMATDESCRIPTOR * ppfd)My question: What value should be passed in the ppfd parameter, in situation where the iPixelFormat was obtained with WGL_ARB_pixel_format ?

When you use plain WGL, according to MSDN code example, may pass here the PIXELFORMATDESCRIPTOR struct you filled when obtaining iPixelFormat with ChoosePixelFormat.

But when you use WGL_ARB_pixel_format, there is problem, because wglChoosePixelFormat doesn't use PIXELFORMATDESCRIPTOR, so you don't have any struct ready to use.

I tried 2 ways:

1. pass NULL here
MSDN in some fuzzy (to me) way suggests the ppfd is somewhat useless, but it says nothing about passing NULL

2. use DescribePixelFormat on the iPixelFormat to fill the struct, and pass it here
But is it safe to call DescribePixelFormat on format which _cant_ be described by the PIXELFORMATDESCRIPTOR?

I tested both ways, and both seems to work http://www.opengl.org/discussion_boards/ubb/smile.gif But i'd like to know, what is the right and safe way, way that works on any HW, driver or Windows version...

NitroGL
01-21-2003, 10:56 AM
I use NULL.

This *REALLY* needs to be in the WGL_ARB_pixel_format spec, because NO ONE covers it.

The param seems to be ignored, so it really shouldn't matter what you put there.

Edit/Correction:

From the MSDN:
"Pointer to a PIXELFORMATDESCRIPTOR structure that contains the logical pixel format specification. The system's metafile component uses this structure to record the logical pixel format specification. The structure has no other effect upon the behavior of the SetPixelFormat function."

It only affects the pixelformat if it's a metafile, it doesn't do anything other than that apperently. Still should be in the extension's spec though, to clear up any questions.

[This message has been edited by NitroGL (edited 01-21-2003).]