Results 1 to 3 of 3

Thread: drawing an object on a dialog box

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000

    drawing an object on a dialog box

    I am trying to draw an object onto a dialog box in a win32 application. The dialog box has edit boxes and radio buttons and so forth.

    If I use single buffering then I can get both the object and the dialog controls to display on the dialog box, but the object is screwed up.
    If I use double buffering then the object is perfect, but I lose the dialog controls. Does anyone have experience or can provide some sort of help please.


  2. #2
    Senior Member Frequent Contributor
    Join Date
    Feb 2000

    Re: drawing an object on a dialog box

    I would create a child window on the dialog box use its Device Context to draw the object.

  3. #3
    Member Contributor
    Join Date
    Mar 2000
    PA, USA

    Re: drawing an object on a dialog box

    It sounds like you are drawing to the hWnd of the dialog box, which is incorrect. I think what happens is that the buttons and stuff are first drawn using GDI, then you are drawing with OpenGL and swapping buffers. The buffer swap causes the the entire dialog area to be replaced with your OpenGL scene.

    One thing to do is to include in your dialog resource a picture window (assuming you are using the VC++ dialog editor). In your code, you can use one of the get dialog item functions (with the resource identifier of the picture window that you added) in order to get the hWnd of the picture box. Set up a OpenGL rendering context for this hWnd instead of the hWnd of you dialog box. Now, you can issue OpenGL calls and have the results end up in the picture box rather than the entire dialog. Make sure you keep you do a wglMakeCurrent call to make the picture box's rendering context current when you need to draw it and a wglMakeCurrent(NULL, NULL) to make no RC current when you are done drawing.

    The only thing that you might see using this method is some flickering in the picture box. You might be able to fiddle with preventing the picture box from doing anything when the erase background message is received. This is what causes the flicker.

    Good luck.

Similar Threads

  1. Drawing object without VBO
    By MirzaSe in forum OpenGL ES
    Replies: 1
    Last Post: 09-27-2014, 10:30 PM
  2. Drawing behind another object
    By racumin in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 10-30-2009, 12:08 PM
  3. Drawing into a control in a dialog under XP...
    By MarkS in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 09-28-2008, 03:40 PM
  4. OpenGL drawing on more than one dialog
    By JoshWilczek in forum OpenGL: Windows
    Replies: 5
    Last Post: 11-18-2005, 09:52 AM
  5. Replies: 1
    Last Post: 10-11-2005, 07:39 PM

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