How to switch to unaccellerated view?

I would like to let the user choose between hardware and software openGL rendering. Currently I’m using the mesa-dll’s for software rendering. Is there a possibility to switch in native openGL? I tried the PFD_GENERIC in the pixel format descriptor but it didn’t work.


In Windows, I have read that it is a bad idea to switch pixel formats on a DC on the fly. However, I might be wrong.

Generally, you’ll have to iterate through the available pixel formats and if you don’t want acceleration, pick one that has the PFD_GENERIC_FORMAT descriptor. Note if you are using the ChoosePixelFormat function that you are never guaranteed to get what you ask for. I found that the ChoosePixelFormat function is OK in many cass, but if you want to anything special (like picking a non-accelerated pixel format when there are accelerated ones available) then the ChoosePixelFormat function becomes pretty useless.

Never wanted to switch it on the fly. The user can decide it before the app starts.

As I wrote, I never get an unaccellerated view with the ChoosePixelFormat. But is there an other way?

Yes, there is another way. Do not use the ChoosePixelFormat function. Write your own version that can be forced to pick an unaccelerated pixel format index. This is fairly easy to do. You’ll use DescribePixelFormat to discover how many pixel formats you have available. Then use DescribePixelFormat in a for-loop to inspect each pixel format. When find a pixel format that fits what you want, end the loop and return the index.

Writing your own version of ChoosePixelFormat gives you much more control on precisely what characteristics the pixel format has.