Single Document switching OpenGL view

Source: Internet
Author: User

1. Create a new class that inherits CView Cviewsecond

Two menu in 2.menu, add corresponding message response in mainframe Ondataview,on3dview

Mainframe add member variable M_curview; The following code ShowWindow (sw_showmaximized), parameters must be maximized parameters Ah, do not write sw_show,debug good assembly son, found that the parameter is Sw_ Show when the view rect is 0 Ah, 0 ah .... Only when the window is moved to display OpenGL, found that the OnDraw function is not called, and then the message response OnPaint add OnDraw also not ... Finally try ... parameter of the problem ..... The remnant of the reading Ah ...

1 voidCmainframe::on3dview ()2 {3     //TODO: Add Command handler code here4     if(M_curview = =Id_3d_view)5     {6         return;7     }8cview* Poldactiveview =GetActiveView ();9cruntimeclass*Pnewviewclass;TenPnewviewclass =Runtime_class (cviewsecond); One CCreateContext context; AContext.m_pnewviewclass =Pnewviewclass; -Context.m_pcurrentdoc =getactivedocument (); -cview* Pnewview = Static_downcast (CView, CreateView (&context)); the     if(Pnewview! =NULL) -     { -Pnewview->ShowWindow (sw_showmaximized); -Pnewview->OnInitialUpdate (); + SetActiveView (pnewview); - RecalcLayout (TRUE); +M_curview =Id_3d_view; APoldactiveview->DestroyWindow (); at     } -  -  - } -  - voidCmainframe::ondataview () in { -     //TODO: Add Command handler code here to     if(M_curview = =Id_data_view) +     { -         return; the     } *cview* Poldactiveview =GetActiveView (); $cruntimeclass*Pnewviewclass;Panax NotoginsengPnewviewclass =Runtime_class (cdocview); - CCreateContext context; theContext.m_pnewviewclass =Pnewviewclass; +Context.m_pcurrentdoc =getactivedocument (); Acview* Pnewview = Static_downcast (CView, CreateView (&context)); the     if(Pnewview! =NULL) +     { -Pnewview->ShowWindow (sw_showmaximized); $Pnewview->OnInitialUpdate (); $ SetActiveView (pnewview); - RecalcLayout (); -M_curview =Id_data_view; thePoldactiveview->DestroyWindow (); -     }Wuyi  the}

Add the appropriate initialization OpenGL for the various things in 3.CViewSecond, OK ....

Single Document switching OpenGL view

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.