How to force a redraw?

53 views
Skip to first unread message

Cardanine

unread,
Aug 15, 2011, 9:36:17 PM8/15/11
to Berkelium
Hi, is there any way to force the window to be repainted?

I'm using DX9 to render, and when I get a device lost event, I release
all my texture resources and recreate them when I reset my device. At
this point the textures are empty and I need to get the browser to
repaint everything. I can't use Window->Refresh() as that reloads the
URL, nor can I use Window->Resize() since the size of the window
didn't necessarily change (and passing the unchanged width and height
to Resize() does nothing).

Does anyone know how to get the window to simply repaint itself?

Thanks,
Nick

Ewen Cheslack-Postava

unread,
Aug 16, 2011, 12:28:09 AM8/16/11
to berk...@googlegroups.com
On Mon, Aug 15, 2011 at 6:36 PM, Cardanine <card...@gmail.com> wrote:
> Hi, is there any way to force the window to be repainted?
>
> I'm using DX9 to render, and when I get a device lost event, I release
> all my texture resources and recreate them when I reset my device. At
> this point the textures are empty and I need to get the browser to
> repaint everything. I can't use Window->Refresh() as that reloads the
> URL, nor can I use Window->Resize() since the size of the window
> didn't necessarily change (and passing the unchanged width and height
> to Resize() does nothing).

I don't think think there's a way to force it to redraw. You could, of
course, *actually* resize it and then resize it back.

> Does anyone know how to get the window to simply repaint itself?

Alternatively, you could force a redraw by causing it to reflow the
page (insert & remove an element that forces the layout to change) or
even just by plastering a absolutely positioned div over the entire
thing and then removing it.

Both hacks, but I think they'd work. Of course you can also just keep
a copy of the texture yourself.

-Ewen

>
> Thanks,
> Nick
>

Muhammed İkbal Akpaça

unread,
Sep 28, 2012, 10:57:45 AM9/28/12
to berk...@googlegroups.com
might help someone in future.

if you have jquery this does this does the job.

ExecuteScript("$('body').hide().show(0)");


Reply all
Reply to author
Forward
0 new messages