MFC/OpenGL/GDI

Started by
1 comment, last by MAS 18 years, 1 month ago
Hi, I realise that there's a lot of resources and code samples out there on MFC and OpenGL - http://www.codeproject.com/opengl/ and so forth. I've been developing a commercial CAD package for the textile industry. However, I need to give the users an option to visualise structures in 3D. I use MFC, GDI and class CScrollView. Is it possible to display my 2D GDI (CAD) output and the 3D visualisation by mixing GDI and OpenGL? I'm guessing that maybe I'll have to render the 2D GDI stuff as normal in CView::OnDraw() and then set-up OpenGL ->render 3D data ->tear-down OpenGL and revert back to CView::OnDraw() for the 2D (GDI) CAD output. Any thoughts? I've committed a lot of effort to the MFC/GDI/Scrollbars (the scrollbars are essential) approach. I just don't know how to support switching between to MFC/GDI and MFC/OpenGL modes in the runtime. Eek. Regards, Martin.
Anthony
Advertisement
As I just found out yesterday, you can render directly to a DIB through OpenGL if you use the PFD_DRAW_TO_BITMAP flag when you create your pixel format.

There's a sample on MSDN about it too (a tad old, though). :)
Hi,

I shouldn't have been too impatient to post. It turned out to be simple to render the OpenGL output to a Dialog.

Cheers,

Martin.
Anthony

This topic is closed to new replies.

Advertisement