Results 1 to 3 of 3

Thread: in MDI in MDI how do I get correct DC

  1. #1
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    NZ
    Posts
    13

    in MDI in MDI how do I get correct DC

    m_hgldc = ::GetDC(m_hWnd);
    if(!SetPixelformat(m_hgldc)) // set pixel format
    {
    ::MessageBox(::GetFocus(),"SetPixelformat Failed!","Error",MB_OK);
    exit(0);

    }


    When I try to OpenGL SwapBackBuffer the whole screen goes black, this code works with one window. But not MDI. Can someone help me, much thanks and God bless ya.

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2002
    Location
    NZ
    Posts
    13

    Re: in MDI in MDI how do I get correct DC

    Oh and its in MFC.

  3. #3
    Senior Member OpenGL Pro
    Join Date
    Oct 2000
    Location
    Fargo, ND
    Posts
    1,753

    Re: in MDI in MDI how do I get correct DC

    Do you have that code in the CView derived classes?

    Also, be sure and use wglMakeCurrent when you redraw the scenes for each CView.

    Also, you should make sure that in the PreCreateWindow, you create a new window class to use which has the CS_OWNDC flag set.
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Replies: 0
    Last Post: 01-10-2017, 07:37 AM
  2. Getting the correct x y and z
    By Formatwizard in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 03-02-2011, 02:10 PM
  3. Is this correct?
    By MikeTS in forum OpenGL: Advanced Coding
    Replies: 4
    Last Post: 05-12-2004, 07:53 PM
  4. is it correct
    By schailan in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 05-29-2002, 07:25 AM
  5. Is this correct?
    By KRONOS in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 10-10-2000, 11:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean