Advertisement Jump to content


This topic is now archived and is closed to further replies.


Setup Pixel Format Bug?

This topic is 6181 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well it compiles but when i run it i seem to get my own created error that come up when running. let me post my code: //SetPixelFormat BOOL CWindow::SetPixelformat(HDC hDC){ int iPixelFormat; static PIXELFORMATDESCRIPTOR pfd = { sizeof(PIXELFORMATDESCRIPTOR), 1, PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, PFD_TYPE_RGBA, 32, 0,0,0,0,0,0, 0, 0, 0, 0,0,0,0, 24, 0, 0, PFD_MAIN_PLANE, 0, 0,0,0 }; if(!(iPixelFormat = ChoosePixelFormat(mDC, &pfd))){ ::MessageBox(NULL,"ERROR: Choose Pixel Format Failed","Error",MB_OK); return FALSE; } if(!(SetPixelFormat(mDC, iPixelFormat, &pfd))){ ::MessageBox(NULL,"ERROR: Set Pixel Format Failed","Error",MB_OK); return FALSE; } return TRUE; } //Create afx_msg int CWindow::OnCreate(LPCREATESTRUCT lpCreateStruct){ mDC = ::GetDC(hWnd); if(!SetPixelformat(mDC)){ ::MessageBox(::GetFocus(),"ERROR: Set Format Failed","Error",MB_OK); return -1; } mRC = wglCreateContext(mDC); int i = wglMakeCurrent(mDC,mRC); InitGL(); return 0; } i seem to get the Set Format Failed and the Choose pixel format failed errors if you see whats messed up it would help me out alot thanx!

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!