Hello everyone,
I am trying to implement two functionalities in my application
2D drawing using normal MFC (already implemented using CView )
Import STL (3D model).I am using OpenGL.
Can anyone help me how it can be done. Similar functionality already implemented in one modeling software that I got from my colleagues.Below is the video location and anyone tell how could they have done it.Thank you.
Guess they created an user-drawn control (maybe based on Picture Control or CStatic, or created a complete new type/control for it) for the OpenGL context, and switch the visibility of it, when needed.
Hi Shinta,
Thank you.Actually am new to MFC technology.right now I derived a two class from CView and one is for 2D drawing and another is for OpenGL. I am switching between these two views .I thought my implementation was wrong. As you said they created a single class for both 2D drawing and OpenGL.I would be grateful if you could provide more information .
As you said they created a single class for both 2D drawing and OpenGL.
Nope. I didn’t said that.
Don’t mistake ‘class’ for ‘window’(/control).
They may have created a class that holds several (child-)windows.
Usually the MFC classes encapsule one specific GUI element (e.g. textbox, button…), which may be a ‘window’. CView describes afaik not a window itself, but the client area of one. A client area can be drawn to using GUI draw commands. For OpenGL (initialization) you need a real window (usually with some specific window and window class style settings), which is not a good practice (some say, its impossible to do correct; I’ve never tried it) to draw to with GUI draw commands. Hence my assumtion, that they creates a separate window/control, which they make visible when needed.
(I haven’t done much MFC in the last 10 year, or so, so my expertise shouldn’t be taken too serious.)
Guess that (the codeproject article) can work, too.
IIRC, I used to create a view with the dialog editor (CFormView, in a single view main frame window). I just put a CStatic into the form and used that window (or better it’s DC) to create a OpenGL Context. I never tried toggling the visiblity of the CStatic, though. But I you set up the window and class styles correct (WS_CLIPCHILDREN, WS_CLIPSIBLINGS, CS_OWNDC and stuff), and toggle their visibility, you should be able to use one CStatic for your GDI draws and the other for OpenGL.