flat assembler
Message board for the users of flat assembler.
Index
> Windows > So... how does ValidateRect/InvalidateRect work, exactly? |
Author |
|
cod3b453 01 Sep 2013, 17:08
InvalidateRect tells the window that a region must be redrawn (schedule a WM_PAINT), while ValidateRect tells the window that a region must not be redrawn (de-schedule a WM_PAINT, regardless of whether it was drawn or not).
It sounds like your call to InvalidateRect is forcing a window redraw when it is not needed - in fact I believe this probably conflicts with normal openGL drawing loop. [The only openGL code I have shows a thread doing "while (1) { /*draw objects here*/ glFlush(); /* event handling code */ }" without any mention of window messages.] |
|||
01 Sep 2013, 17:08 |
|
Fred 01 Sep 2013, 18:20
Hmm, not quite sure what this means. I shouldn't be using InvalidateRect? Do my GL stuff outside of WM_PAINT, somehow get there and only swapbuffers in there? Invalidate after the openGL stuff? I've tried to move the GL code i have in the WM_PAINT (glClear, glTexSubImage2D, glVertexPointer, glTexCoordPointer, glDrawArrays) to where my InvalidateRect is, but that just crashes the program.
But yes - "It sounds like your call to InvalidateRect is forcing a window redraw when it is not needed" is probably what happens... maybe™. Edit: I'm trying to read up on the subject, and the openGL wiki suggests to not use WM_PAINT. I guess I shall figure out how this works. |
|||
01 Sep 2013, 18:20 |
|
Fred 04 Sep 2013, 12:13
Looked over NeHe's openGL tutorials and a openGL fps example written by someone here on the forums (forgot who), and it seems to work pretty good so far. It crashes on exit, but that's probably me doing something stupid.
I moved all openGL invokes to right before InvalidateRect in my main loop, and only did ValidateRect in WM_PAINT. I also skipped WM_CREATE, but dunno how much that matters. |
|||
04 Sep 2013, 12:13 |
|
edfed 04 Sep 2013, 13:30
BitRake made the fps demo
BitRake: have you finally used a sphere for the sky box or is it still a cube? |
|||
04 Sep 2013, 13:30 |
|
bitRAKE 04 Sep 2013, 14:40
|
|||
04 Sep 2013, 14:40 |
|
Fred 05 Sep 2013, 07:50
Yeah, that's it. Good guy bitshifter!
I noticed now that the call to InvalidateRect was unnecessary, btw. Now that all that works, I'm going to see if I can get this VBO thing to work. The wglGetProcAddress in this one is strong. Edit: It lives! (the window title is wrong by now, didn't bother to fix) |
|||
05 Sep 2013, 07:50 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.