Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Windows Menus & OpenGL Window

Windows Menus & OpenGL Window

Scheduled Pinned Locked Moved C / C++ / MFC
c++graphicsgame-devarchitecturehelp
7 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sabry1905
    wrote on last edited by
    #1

    Hello All I am using MFC with OpenGL to code multimedia application, I am using SDI architecture, and I found that when I open any menu item and select it, windows sometimes don’t erase the menu area immediately, and it appears like a shadow over the OpenGL window, until I do any repaint action it disappears It seems to me that it is windows issue, but I am not sure!

    C 1 Reply Last reply
    0
    • S Sabry1905

      Hello All I am using MFC with OpenGL to code multimedia application, I am using SDI architecture, and I found that when I open any menu item and select it, windows sometimes don’t erase the menu area immediately, and it appears like a shadow over the OpenGL window, until I do any repaint action it disappears It seems to me that it is windows issue, but I am not sure!

      C Offline
      C Offline
      Cedric Moonen
      wrote on last edited by
      #2

      A-M-S-S wrote:

      It seems to me that it is windows issue

      I would say the opposite ;P . Whenever windows need to refresh a window (like for example in your case because something went in front of it), it will send a WM_PAINT message to it. So it is up to you to repaint the window whenever you receive that message.

      Cédric Moonen Software developer
      Charting control [v1.2]

      S 1 Reply Last reply
      0
      • C Cedric Moonen

        A-M-S-S wrote:

        It seems to me that it is windows issue

        I would say the opposite ;P . Whenever windows need to refresh a window (like for example in your case because something went in front of it), it will send a WM_PAINT message to it. So it is up to you to repaint the window whenever you receive that message.

        Cédric Moonen Software developer
        Charting control [v1.2]

        S Offline
        S Offline
        Sabry1905
        wrote on last edited by
        #3

        The action that done with my menu item is to set some flags and variables then call InvalidateRect(NULL,FALSE); To repaint the entire client area, so the menu drawing area should disappear, and this the normal situation that happen in any windows application -the menu disappear, if you just click outside it-

        C 1 Reply Last reply
        0
        • S Sabry1905

          The action that done with my menu item is to set some flags and variables then call InvalidateRect(NULL,FALSE); To repaint the entire client area, so the menu drawing area should disappear, and this the normal situation that happen in any windows application -the menu disappear, if you just click outside it-

          C Offline
          C Offline
          Cedric Moonen
          wrote on last edited by
          #4

          A-M-S-S wrote:

          The action that done with my menu item is to set some flags and variables then call InvalidateRect(NULL,FALSE);

          InvalidateRect will simply have as an result to send a WM_PAINT message to your window. If you don't handle that message or you don't repaint your window correctly, then it's logical that the menu doesn't disappear.

          A-M-S-S wrote:

          To repaint the entire client area, so the menu drawing area should disappear, and this the normal situation that happen in any windows application -the menu disappear, if you just click outside it-

          Sorry, I don't understand what you are trying to say :confused:. What you call a normal situation (the menu "just"disappear when you click outside it) is simply because that window reacts on the WM_PAINT message and repaints itself. What you have to understand is that Windows doesn't keep the 'image' of your window. So it means that if something is drawn over it (like with the menu), there is no way to recreate the image unless it asks the window to repaint itself.

          Cédric Moonen Software developer
          Charting control [v1.2]

          S 1 Reply Last reply
          0
          • C Cedric Moonen

            A-M-S-S wrote:

            The action that done with my menu item is to set some flags and variables then call InvalidateRect(NULL,FALSE);

            InvalidateRect will simply have as an result to send a WM_PAINT message to your window. If you don't handle that message or you don't repaint your window correctly, then it's logical that the menu doesn't disappear.

            A-M-S-S wrote:

            To repaint the entire client area, so the menu drawing area should disappear, and this the normal situation that happen in any windows application -the menu disappear, if you just click outside it-

            Sorry, I don't understand what you are trying to say :confused:. What you call a normal situation (the menu "just"disappear when you click outside it) is simply because that window reacts on the WM_PAINT message and repaints itself. What you have to understand is that Windows doesn't keep the 'image' of your window. So it means that if something is drawn over it (like with the menu), there is no way to recreate the image unless it asks the window to repaint itself.

            Cédric Moonen Software developer
            Charting control [v1.2]

            S Offline
            S Offline
            Sabry1905
            wrote on last edited by
            #5

            For sure I am doing handling for my paint message, this is where I am call my OpenGL render function and I didn't do any thing else, So every thing should be ok And as I told before, this phenomena doesn’t appear every time I open the menu I was trying to send a screen shot of what I got If you are interested write your mail in a private message and I will send you the screenshot

            C 1 Reply Last reply
            0
            • S Sabry1905

              For sure I am doing handling for my paint message, this is where I am call my OpenGL render function and I didn't do any thing else, So every thing should be ok And as I told before, this phenomena doesn’t appear every time I open the menu I was trying to send a screen shot of what I got If you are interested write your mail in a private message and I will send you the screenshot

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              A snippet of code would be more usefull I think. Could you post what you do on the WM_PAINT message ?

              Cédric Moonen Software developer
              Charting control [v1.2]

              S 1 Reply Last reply
              0
              • C Cedric Moonen

                A snippet of code would be more usefull I think. Could you post what you do on the WM_PAINT message ?

                Cédric Moonen Software developer
                Charting control [v1.2]

                S Offline
                S Offline
                Sabry1905
                wrote on last edited by
                #7

                here it is void CChildView::OnPaint() { CPaintDC dc(this); glClear(GL_COLOR_BUFFER_BIT); RenderScene(); //calling my OpenGL drawing function glFlush(); SwapBuffers(m_pDC->GetSafeHdc()); }

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups