Updating screen on screen refresh

I am updating a single colour on my screen’s palette and I want to do it
every refresh. Currently it seems to do it much faster and so I get
tears in the resulting display.

I’ve been told that I need to wait for the vertical refresh before
redefining the colour. Can anybody tell me how I should do this?

Thanks

Henry Gomersall

I’ve been told that I need to wait for the vertical refresh before
redefining the colour. Can anybody tell me how I should do this?

Sorry but I don’t know how to do it with SDL. I think that the flip()
does it automatically. Try to do a flip() each time you change the
RGB although you don’t need it. It will wait for a vertical refresh, but
be sure that the flip does a “hardware” flip and not a fullscreen blit().
I would use SDL_FULLSCREEN|SDL_DOUBLEBUF|SDL_HWSURFACE
flags on the video init, and be sure that the to pages (frontbuffer
and backbuffer) all full-filled with the same color. To do that, when you
draw the rect do:

rect(…) // in the actual backbuffer
flip(…) // backbuffer <=> frontbuffer
rect(…) // in the actual backbuffer

Good luck !