Results 1 to 6 of 6

Thread: PIXELFORMATDESCRIPTOR problems

  1. #1
    Guest

    PIXELFORMATDESCRIPTOR problems

    I am using Visual C++ code that ran perfectly on an Alpha platform. I have ported the code over to an Intel-based platform and now I get the following message when I run the program:

    "Couldnt Set Pixel Format"

    This message didn't appear when the program was run on the Alpha. I have gone in to the debugger and it tells me that the "Best Matching Pixel Format Index is 5" but then it can't set that format. Not knowing what else to try to remove this message I have gone in to my code and changed the PIXELFORMATDESCRIPTOR settings so they match up with the Pixel Format Index specified as the best match but the error still remains. This is all new to me so I really don't know what else to do.

  2. #2
    Halcyon
    Guest

    Re: PIXELFORMATDESCRIPTOR problems

    Um, you should check to see that the device context is defined before actually setting it. That's about the only thing i can say right now. Put up the code with you defining the PIXELFORMATDESCRIPTOR instance and the code for you setting it up, and we'll see where we can go from there .

    - Halcyon

  3. #3
    Halcyon
    Guest

    Re: PIXELFORMATDESCRIPTOR problems

    Try using this code for your project just to see if it works out:

    Code :
    	//Describes pixel format
    	PIXELFORMATDESCRIPTOR pfd;
    	//stores pixel format type
    	int pixelFormat;
     
    	//Fill pfd
    	pfd.bReserved = 0;
    	pfd.cAccumAlphaBits = 0;
    	pfd.cAccumBits = 0;
    	pfd.cAccumBlueBits = 0;
    	pfd.cAccumGreenBits = 0;
    	pfd.cAccumRedBits = 0;
    	pfd.cAlphaBits = 0;
    	pfd.cAlphaShift = 0;
    	pfd.cAuxBuffers = 0;
    	pfd.cBlueBits = 0;
    	pfd.cBlueShift = 0;
    	pfd.cColorBits = 32;
    	pfd.cDepthBits = 16;
    	pfd.cGreenBits = 0;
    	pfd.cGreenShift = 0;
    	pfd.cRedBits = 0;
    	pfd.cRedShift = 0;
    	pfd.cStencilBits = 0;
    	pfd.dwDamageMask = NULL;
    	pfd.dwFlags = PFD_DRAW_TO_WINDOW|PFD_SUPPORT_OPENGL|PFD_DOUBLEBUFFER;
    	pfd.dwLayerMask = NULL;
    	pfd.dwVisibleMask = NULL;
    	pfd.iLayerType = PFD_MAIN_PLANE;
    	pfd.iPixelType = PFD_TYPE_RGBA;
    	pfd.nSize = sizeof PIXELFORMATDESCRIPTOR;
    	pfd.nVersion = 1;
     
    	//obtain pixel format
    	pixelFormat = ChoosePixelFormat(hDC,&pfd);
     
    	//makes sure pixel format was obtained
    	if(pixelFormat == NULL){
    		MessageBox(NULL,"Could no choose pixel format.",
    			"Periodic Table of Elements - v1.0", MB_OK|MB_ICONERROR);
    	}
     
    	//Set pixel format & make sure it was set
    	if(!SetPixelFormat(hDC,pixelFormat,&pfd)){
    		MessageBox(NULL,"Could no set pixel format.",
    			"Periodic Table of Elements - v1.0", MB_OK|MB_ICONERROR);
    	}
    This is code i used in my old project, and you can change what the message boxes say and stuff. Good luck.


    -Halcyon

  4. #4
    Member Contributor
    Join Date
    Feb 2000
    Location
    Germany
    Posts
    87

    Re: PIXELFORMATDESCRIPTOR problems

    I had the same effect some time ago. It seemed to be a driver problem (nvidia, I forgot the revision number, but it was the one before 41.09). However the problem never ever occured after installing v41.09, the latest driver.

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: PIXELFORMATDESCRIPTOR problems

    One of those older nVidia drivers had a bug in the Pixelformat extension. It took me two days until i gave it up. After installing the latest driver i tried exactly the same stuff again and then it worked.
    Blame nVidia

    Jan.
    GLIM - Immediate Mode Emulation for GL3

  6. #6
    Senior Member OpenGL Guru
    Join Date
    Dec 2000
    Location
    Reutlingen, Germany
    Posts
    2,042

    Re: PIXELFORMATDESCRIPTOR problems

    PS: Even their own Demo Program, which showed the Pixelformat extension, crashed on my PC
    GLIM - Immediate Mode Emulation for GL3

Similar Threads

  1. About PIXELFORMATDESCRIPTOR
    By Meu in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-29-2005, 02:39 PM
  2. PIXELFORMATDESCRIPTOR
    By pietro1 in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 06-23-2003, 10:27 AM
  3. confused : PixelFormatDescriptor
    By Super13 in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 02-14-2003, 10:02 PM
  4. Replies: 2
    Last Post: 12-03-2002, 03:01 AM
  5. PIXELFORMATDESCRIPTOR Blues
    By Shag in forum OpenGL: Basic Coding
    Replies: 11
    Last Post: 01-27-2002, 12:09 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean