Archived

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

Lurking

Setup Pixel Format Bug?

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