Hi Mikael,
Thanks for your advice, i found that i was not passing the actual object of HDC ( Handle of Device Context, but was passing the CDC object, so it was giving me error at that time…) But it has been resolved but at the same time i m also getting the error with SetPixelFormat function just next call of that function. Because SetPixelFormat function allows only one time Pixel Formatting, it’s returning error#1 ( which is Invalid Functino call in Windows). Still i m facing the problem in it.. If you can help me out, it will be gr8..
This is the some code from my application:
void MyAppView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
pInfo->SetMaxPage(1);
Invalidate(TRUE);
// Intially, I was using this code to get the picture of the View in a bitmap and
// print that bitmap in my code. But as it is taking snap of the view, I m not
// gettting the perfect result. But on some computer it’s taking Snap of view,
// while on some, it’s taking snap of whole Frame including ToolBar and MenuBar..
// So i decided to use print function of the OpenCascade
/*
Handle(Aspect_Window) anAspectWindow = myView->Window();
Handle(WNT_Window) aWNTWindow = Handle(WNT_Window)::DownCast(anAspectWindow);
HWND hWindow = (HWND)aWNTWindow->HWindow();
CBitmap mybitmap;
RECT r;
::GetClientRect(hWindow,&r);
int WindowWidth=r.right;
int WindowHeight=r.bottom;
HDC hDCWindow=::GetDC(hWindow);
CDC* dcWindow = CDC::FromHandle( hDCWindow);
m_CDC.CreateCompatibleDC( dcWindow);
mybitmap.CreateCompatibleBitmap(dcWindow,WindowWidth,WindowHeight);
m_CDC.SelectObject(&mybitmap);
dcWindow->SelectObject(CBitmap::FromHandle((HBITMAP)aWNTWindow->HPixmap()));
m_CDC.BitBlt( r.left, r.top,WindowWidth,WindowHeight,dcWindow,0,0,SRCCOPY);
::ReleaseDC(hWindow,hDCWindow);
*/
// m_CDC is a memeber variable of MyAppView — object of CDC
CRect r;
GetClientRect( &r);
m_CDC.CreateCompatibleDC( pDC);
CBitmap l_bitmap;
l_bitmap.CreateCompatibleBitmap( pDC, r.Width(), r.Height());
m_CDC.SelectObject( &l_bitmap);
// myView is object of V3d_View
myView->View()->Print( m_CDC.m_hDC, true, NULL);
}
void MyAppView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
m_CDC.DeleteDC();
}
void MyAppView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
ASSERT(pDC) ;
ASSERT(pInfo) ;
CRect l_Rect;
GetWindowRect( &l_Rect);
CRect& l_DrawRect = pInfo->m_rectDraw;
double l_Wratio = l_Rect.Width() / ( double) l_DrawRect.Width();
double l_Hratio = l_Rect.Height() / ( double) l_DrawRect.Height();
if( l_Wratio > l_Hratio )
pDC->StretchBlt(0, 0, l_DrawRect.Width(), (int)(l_Rect.Height() / l_Wratio), &m_CDC, 0, 0, l_Rect.Width(), l_Rect.Height(), SRCCOPY);
else
pDC->StretchBlt(0, 0, (int)( l_Rect.Width() / l_Hratio), l_DrawRect.Height(), &m_CDC, 0, 0, l_Rect.Width(), l_Rect.Height(), SRCCOPY);
}
Help me if you can..
Thank you for your reply…
Ashesh
-
BAK
- Posts: 1
- Joined: Mon Mar 13, 2017 4:18 am
- Model of CNC Machine: Axiom AR8 PRO
ChoosePixelFormat failed
I googled error message and found a fix worth a try in the vectric forum by accident. The user didn’t name his help forum correctly. I will post and name it with the error so that other users can find the thread when they type in the error. It really made since especially with it happening on all of my computers running VCarve Pro. I’m sure others may have this same problem with windows 10. I have attached the screen shots below.
-
Adrian
- Vectric Archimage
- Posts: 13587
- Joined: Thu Nov 23, 2006 2:19 pm
- Model of CNC Machine: ShopBot PRS Alpha 96×48
- Location: Surrey, UK
Re: ChoosePixelFormat failed
Post
by Adrian » Thu Jun 01, 2017 8:26 pm
How old are the computers? I would only expect to see that error with outdated graphic drivers. It’s not a Windows 10 error as it’s been reported right back to Windows Vista.
Проблема с wine (ChoosePixelFormat failed :(()
Модератор: Модераторы разделов
-
Dreamslayer
- Сообщения: 13
Проблема с wine
Пытаюсь под wine запустить Another World — штука не особо известная, конечно Дык вылетает с сообщением «ChoosePixelFormat failed». Сам wine в консоль пишет:
…
err:opengl:X11DRV_ChoosePixelFormat glXChooseFBConfig returns NULL (glError: 0)
err:opengl:X11DRV_ChoosePixelFormat glXChooseFBConfig returns NULL (glError: 0)
Покопался немного в сети (насколько позволяет стоимость трафика ), но ничего путного не нашёл. Поколдовал с настройками — тоже безрезультатно. Не подскажете, что можно сделать?..
(Linux Fedora Core 4, wine 20050524)
The only thing to fear
Is running out of beer!
-
AlexeyAL
- Сообщения: 71
Re: Проблема с wine
Сообщение
AlexeyAL » 14.11.2005 19:10
Копаться следует не в настройкой wine, а с настройкой openGL. ChoosePixelFormat-одна из базовых функций, одна из первых в любой проге
Когда я вырасту и стану крутым программистом, я напишу свое ядро и подарю его Ричарду Столлмену
-
Dreamslayer
- Сообщения: 13
Re: Проблема с wine
Сообщение
Dreamslayer » 14.11.2005 20:34
AlexeyAL писал(а): ↑
14.11.2005 19:10
Копаться следует не в настройкой wine, а с настройкой openGL. ChoosePixelFormat-одна из базовых функций, одна из первых в любой проге
Спасибо, но это в целом понятно. Неясно — почему гадский ChoosePixelFormat упорно 0 возвращает?.. Не подскажете, в какую сторону копать?.. Я недавно из-под форточек вылез, поэтому не очень хорошо в настройках ориентируюсь
The only thing to fear
Is running out of beer!
-
YagMort
- Сообщения: 323
Re: Проблема с wine
Сообщение
YagMort » 16.11.2005 09:32
Кривая сборка Wine. У меня такое было с официальным релизом в SuSE 9.3. Поставил самосборный с сурсфорджа — все нормально заработало. Именно это сообщение — причем — во всех играх.
Ищи другую версию — желательно, сурсфорджевской сборки, а не сборки твоего дистроклепателя.
Athlon64-3000+/nForce4/1Gb/GF 6600-256Mb/HDD200Gb, 80Gb/SB Live! 5.1.
SuSE Linux 10.0_i586 DVD/Windows XP 64-bit SP1 eng.
-
Dreamslayer
- Сообщения: 13
Re: Проблема с wine
Сообщение
Dreamslayer » 17.11.2005 16:23
Простите меня пожалуйста, я — дурак Случайно влез в xorg.conf, а там по дефолту 16-битный режим стоял. Исправил на 24 бита — всё работает
The only thing to fear
Is running out of beer!
- Forum
- The Ubuntu Forum Community
- Ubuntu Specialised Support
- Wine
- OpenGL: ChoosePixelFormat failed
-
OpenGL: ChoosePixelFormat failed
I’m trying to run Sketchup7 under WINE 1.1.34 and Ubuntu Karmic. I’m getting a diagnostic on startup which says;
Sketchup was unable to initialize OpenGL!
Please make sure you have installed the correct drivers for your graphics card.Error: ChoosePixelFormat failed.
What does this error mean?
How do I fix it?
Where does OpenGL come from?
Is there a specific version I’m supposed to use?
Do I need Python to make OpenGL work?
-
Re: OpenGL: ChoosePixelFormat failed
This post is a little old but I decided to add some input to it since it might help some else trying to run Sketchup7 on Karmic Koala 9.10.
It is always better to download the last version of wine from their site since the Ubuntu repository is a little outdated.
The version wine version that is working for me is 1.1.43.
The fix is real simple:
Fix:
Open your wine menu and open the C drive (/home/user/.Wine)
Open the Windows Folder
Find Regedit.exe and run it with Wine
Find: HKEY_CURRENT_USERSoftwareGoogleSketchUp6GLConf igDisplay
There are three entries — Look at the bottom one, name ‘HW_OK»
Double click it and change the data from a 0 to a 1
Run Sketchup7that should do it. I read some postings mentioning problems with black screens, which are related to compiz; in that case just disable compiz.
I hope this can help someone. I’ve been trying get Sketchup running for the longest time, I finally got it working with this little trick.
good luck
-
Re: OpenGL: ChoosePixelFormat failed
I have Wine version 1.2 rc6 with karmic 9.10 and your regedit solution worked great. I too got the OpenGL error along with the «choosePixelFormat» until I put in your fix. THANKS!
(though also have a print problem — the picture is totally black when printed but on the screen it looks great — another problem to investigate…)
-
Re: OpenGL: ChoosePixelFormat failed
Woohoo
thanks so much noriegafam, working perfectly
I love Sketchup, another reason I don’t have to turn my windows box back on.
I tried this with Ubuntu 10.04 with Google Sketchup 7.1.
also wine from the Ubuntu Software center version 1.1.42
Last edited by gazm81; July 19th, 2010 at 12:42 AM.
Reason: Left out information
-
Re: OpenGL: ChoosePixelFormat failed
Your fix worked for me — brilliant. Now all I have to do is work out how to use Sketchup
-
Re: OpenGL: ChoosePixelFormat failed
Thanks noriegafam! I’ve been trying everything to try get this working
-
Re: OpenGL: ChoosePixelFormat failed
I wish it worked for me
I’m using a Dell 1545 running 10.04, wine 1.1.42.
it still crashes with the same message
maybe some day I get my dual boot working so I can run 9.04 or 9.10 and try it under that.
-DaveKenny
-
Re: OpenGL: ChoosePixelFormat failed
Thanks noriegafam, that solved my problem running Sketchup8 in Meerkat.
JohnIt’s like doing jigsaw puzzles in the dark.
-
Re: OpenGL: ChoosePixelFormat failed
Excellent Fix.
Worked with my current config of Ubuntu 10.10 running SketchUp version 7.1.6860 in Wine 1.2.1
-
Re: OpenGL: ChoosePixelFormat failed
Hi All,
I’ve tried this fix but when i open the regedit.exe and work thru the menu I get only as far as ;
HKEY_CURRENT_USERSoftwareGoogleSketchUp7GLConf igDisplay are missing.
Can anyone suggest why? Is it something to do with the graphics card?
Thanks
Tags for this Thread
Bookmarks
Bookmarks

Posting Permissions
View previous topic :: View next topic | |||||
Author | Message | ||||
---|---|---|---|---|---|
01mf02 Veteran Joined: 21 Nov 2004 |
|
||||
Back to top |
|
||||
xaos5 Apprentice Joined: 19 Apr 2005 |
|
||||
Back to top |
|
||||
01mf02 Veteran Joined: 21 Nov 2004 |
|
||||
Back to top |
|
||||
01mf02 Veteran Joined: 21 Nov 2004 |
|
||||
Back to top |
|
||||
01mf02 Veteran Joined: 21 Nov 2004 |
|
||||
Back to top |
|
||||
xaos5 Apprentice Joined: 19 Apr 2005 |
|
||||
Back to top |
|
||||
killertux Tux’s lil’ helper Joined: 11 Dec 2003 |
|
||||
Back to top |
|
||||
01mf02 Veteran Joined: 21 Nov 2004 |
|
||||
Back to top |
|
||||
killertux Tux’s lil’ helper Joined: 11 Dec 2003 |
|
||||
Back to top |
|
||||
xaos5 Apprentice Joined: 19 Apr 2005 |
|
||||
Back to top |
|
||||
killertux Tux’s lil’ helper Joined: 11 Dec 2003 |
|
||||
Back to top |
|
||||
|
You cannot post new topics in this forum |