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. GDI rendering on top of OpenGL

GDI rendering on top of OpenGL

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsgame-devtutorialquestionannouncement
7 Posts 3 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.
  • D Offline
    D Offline
    Dave Calkins
    wrote on last edited by
    #1

    Any tips on doing GDI rendering on top of OpenGL? We're doing our OpenGL rendering, then calling SwapBuffers, then doing GDI rendering on the same DC. This works fine with SW rendering pixel formats. When using HW accelerated pixel formats the window update/clipping/refresh is different the GDI rendering doesn't always update if you obscure the window with a dialog for example. So I thought I'd ask in case we're going about it the wrong way.

    D C 2 Replies Last reply
    0
    • D Dave Calkins

      Any tips on doing GDI rendering on top of OpenGL? We're doing our OpenGL rendering, then calling SwapBuffers, then doing GDI rendering on the same DC. This works fine with SW rendering pixel formats. When using HW accelerated pixel formats the window update/clipping/refresh is different the GDI rendering doesn't always update if you obscure the window with a dialog for example. So I thought I'd ask in case we're going about it the wrong way.

      D Offline
      D Offline
      Dave Calkins
      wrote on last edited by
      #2

      Well I found one solution to this. We've overridden OnEraseBkgnd in our view window and we just return TRUE. I added a call to Invalidate(FALSE) and that cleared up the GDI rendering. It looks like the GDI rendering was getting called, but the only region being allowed to update was the obscured region.

      1 Reply Last reply
      0
      • D Dave Calkins

        Any tips on doing GDI rendering on top of OpenGL? We're doing our OpenGL rendering, then calling SwapBuffers, then doing GDI rendering on the same DC. This works fine with SW rendering pixel formats. When using HW accelerated pixel formats the window update/clipping/refresh is different the GDI rendering doesn't always update if you obscure the window with a dialog for example. So I thought I'd ask in case we're going about it the wrong way.

        C Offline
        C Offline
        Code o mat
        wrote on last edited by
        #3

        You could also try rendering onto a memory bitmap, then use GDI on that and blit that onto your window. Because of the blit this could be a bit slower though. I see you already solved your problem but i thought i mention this possibility too.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. <

        S 1 Reply Last reply
        0
        • C Code o mat

          You could also try rendering onto a memory bitmap, then use GDI on that and blit that onto your window. Because of the blit this could be a bit slower though. I see you already solved your problem but i thought i mention this possibility too.

          > The problem with computers is that they do what you tell them to do and not what you want them to do. <

          S Offline
          S Offline
          Sarath C
          wrote on last edited by
          #4

          Blitting a bitmap may hide some part of the OpenGL rendered scene. Otherwise has to go for Transperant blitting.

          -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

          My blog - Sharing My Thoughts, An Article - Understanding Statepattern

          C 1 Reply Last reply
          0
          • S Sarath C

            Blitting a bitmap may hide some part of the OpenGL rendered scene. Otherwise has to go for Transperant blitting.

            -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

            My blog - Sharing My Thoughts, An Article - Understanding Statepattern

            C Offline
            C Offline
            Code o mat
            wrote on last edited by
            #5

            What do you mean? What i meant is not to draw GDI things onto a bitmap and then blit that onto the surface OpenGL rendered to, i mean, make OpenGL render onto a bitmap, use GDI on that and then display it on the window. See this.[^]

            > The problem with computers is that they do what you tell them to do and not what you want them to do. <

            D 1 Reply Last reply
            0
            • C Code o mat

              What do you mean? What i meant is not to draw GDI things onto a bitmap and then blit that onto the surface OpenGL rendered to, i mean, make OpenGL render onto a bitmap, use GDI on that and then display it on the window. See this.[^]

              > The problem with computers is that they do what you tell them to do and not what you want them to do. <

              D Offline
              D Offline
              Dave Calkins
              wrote on last edited by
              #6

              We do render OpenGL to an offscreen bitmap in some places, but not for our main rendering. If you render OpenGL to an offscreen bitmap are you still able to take advantage of hardware accelerated pixel formats? We've seen issues with trying to do that.

              C 1 Reply Last reply
              0
              • D Dave Calkins

                We do render OpenGL to an offscreen bitmap in some places, but not for our main rendering. If you render OpenGL to an offscreen bitmap are you still able to take advantage of hardware accelerated pixel formats? We've seen issues with trying to do that.

                C Offline
                C Offline
                Code o mat
                wrote on last edited by
                #7

                I'm not sure...that might vary dependant on drivers and hardware i guess.

                > The problem with computers is that they do what you tell them to do and not what you want them to do. <

                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