Results 1 to 7 of 7

Thread: refreshing windows

  1. #1
    Member Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    85

    refreshing windows

    I was wondering why windows doesn't automatically refresh my SDI view? I had a dialog in front of my view and when i moved or minimized the dialog, the graphic in the SDI view becomes obsured by a white patch, how do i refresh it again?

  2. #2
    Senior Member OpenGL Guru Relic's Avatar
    Join Date
    Apr 2000
    Posts
    2,450

    Re: refreshing windows

    With SDI you mean single document interface?
    Then put your OpenGL drawing code into the WM_PAINT message handler where it belongs and you'll be done.
    Windows automatically sends repaint messages when window areas are exposed.
    Be careful, you must not assume that regions beneath other windows are still correct in any of the OpenGL buffers associated with that area, like front, back, depth, stencil. All have to be repainted, a SwapBuffers is not enough.

  3. #3
    Member Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    85

    Re: refreshing windows

    yup I am using single document interface... I actually put my Opengl coding in my didalog.cpp because i need user inputs from that dialog and i have several dialogs too for drawing different things... u mean windows will only automatically re-display my graphics if i put my drawing code in the View class OnPaint handler? is there any other way whereby i can re-display the grphics while keeping my codes in the dialog.cpp?

  4. #4
    Member Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    85

    Re: refreshing windows

    i tried coding the drawing into my dialog's OnPaint's handler but the white patch still there.

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

    Re: refreshing windows

    You put it in the OnPaint of the dialog? The one that is doing the covering of the SDI window? How do you expect that to help you? It's the OnPaint of the SDI window that will get called when it needs to be re-painted. Put your code in there.

    All the drawing should be done in the OnPaint call of the method that is actually displaying the OpenGL. Everything else you have, shouldn't be doing the drawing itself, but instead should be setting state variables to let the drawing method know what and how it should be drawn.

    [This message has been edited by Deiussum (edited 10-24-2003).]
    Deiussum
    Software Engineer and OpenGL enthusiast

  6. #6
    Member Contributor
    Join Date
    Aug 2003
    Location
    singapore
    Posts
    85

    Re: refreshing windows

    okie i get your point, but because i need the user inputs from the dialog in order to draw say a rectangle, then since i am coding into the on_paint of the SDI window, how to I ensure that the image will only appear after i input my dimensions and close the dialog through the OK button? that is, i not sure where to call the on_paint to draw only when i have close the dialog...

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

    Re: refreshing windows

    You should be keeping a list of some sort of everything you are drawing. Then in the OK handler of the dialog to create a rectangle, you would add a new rectangle to that list and invalidate the main SDI window so that a WM_PAINT is generated. You SHOULD NOT call the OnPaint method directly.
    Deiussum
    Software Engineer and OpenGL enthusiast

Similar Threads

  1. Screen isn't refreshing?
    By ByDreaM in forum OpenGL: Basic Coding
    Replies: 6
    Last Post: 09-09-2013, 08:28 AM
  2. refreshing the same data
    By rafal in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 06-22-2011, 08:24 AM
  3. refreshing screen?
    By coda in forum OpenGL: Basic Coding
    Replies: 1
    Last Post: 10-07-2003, 06:40 AM
  4. Refreshing Window
    By haitang in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 02-25-2001, 06:57 PM
  5. Refreshing Window
    By haitang in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 02-25-2001, 05:20 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