Hot Door CORE Forum
Custom widget rendering - Printable Version

+- Hot Door CORE Forum (http://hotdoorcore.com/forum)
+-- Forum: All forums (http://hotdoorcore.com/forum/forumdisplay.php?fid=1)
+--- Forum: Getting started (http://hotdoorcore.com/forum/forumdisplay.php?fid=6)
+--- Thread: Custom widget rendering (/showthread.php?tid=25)

Pages: 1 2


Custom widget rendering - Gaxx - 06-05-2014

Hello. It is me again. In my plugin I am using a CustomWidget object to initialize OpenGL context and to render my stuff in there and it works like magic. But there seems to be one thing I can't quite get. Every time this widget recieves a callback - be it mouse enter callback or click callback or whatever it resets whole widget to black color. I've been struggling to disable this, but to no avail. Currently I'm spamming widget with my OGL render function so that it won't reset, but it still results in black background flickering. Is there a way to do this that I didn't spot? I'm using CORE 0.5.4 with Illustrator CC 17.


RE: Custom widget rendering - brendon - 06-05-2014

(06-05-2014, 09:30 AM)Gaxx Wrote:
Currently I'm spamming widget with my OGL render function so that it won't reset, but it still results in black background flickering. Is there a way to do this that I didn't spot? I'm using CORE 0.5.4 with Illustrator CC 17.

Hello Gaxx,

Garrett is on vacation for the next couple weeks, returning near the end of June. He will be able to address this bug upon his return. Thanks for your patience.

Brendon


RE: Custom widget rendering - Gaxx - 07-03-2014

Status update. I've put my drawing function on every custom widget callback(in addition to timer) and it got better. But it still renders the widget black for a fraction of second causing flickering. Is it possible to disable native renderind function someow?


RE: Custom widget rendering - garrett - 07-04-2014

Hi Gaxx, sorry for the delay. I got back from vacation last week and have been catching up on things since then. This is an issue that we intend to resolve. I suspect that there is either an unintentional internal draw call that is making the widget's frame black or an issue with buffering/blitting is present. We have never used OpenGL to draw in a custom widget so I can't be certain, but off the top of my head I doubt OpenGL is the issue. I will look into this probably sometime next week.


RE: Custom widget rendering - garrett - 07-05-2014

Unfortunately, after a bit of testing, this issue isn't happening for me. However, we do have a call to "clear" the widget frame just before calling the draw callback (really it just paints the panel/dialog background color over the widget's frame). This shouldn't result in a black background, but perhaps you have the Illustrator UI set to the darkest option and you're drawing a light-colored widget?

In any event, I have added an option to hdi::core::CustomWidget to disable this frame clearing if a developer finds the behavior undesirable. You can try it once 0.5.5 is released.


RE: Custom widget rendering - garrett - 07-17-2014

I just thought I'd let you know that 0.5.5 is now available, and it has the option to disable automatic widget frame clearing before the user draw callback is executed.


RE: Custom widget rendering - Gaxx - 07-18-2014

Thank you for all the work that you have done. Plugin I'm working on is near comlete. But it seems that this flickering had some other origin.

I modified my rendering routine for Mac specific API and ran it on Mac and it results in no flickering.
I also added empty CustomWidget to panel and ran it on Mac and Win. On mac it seems to be completely transparent no matter what I do, while on Win it is black. Perhaps it is something extremely platform-specific. System I ran on is Windows 7 Ultimate SP1 x64. I built with Windows7.1SDK. Illustrators I ran it on are CC and CS6(both x32 and x64).
Also, can you please tell me what routine you used when you got clean rendering? Is it different from mine?
I did like this:
1 - create custom widget and add it to panel(enabling or disabling clearing does not seem to afect it)
2 - get platform specific widget and initialize ogl context with it
3 - create a timer that fires every 1/30 of second and put drawing routine in its handler.

Maybe there is some better way of doing it?


RE: Custom widget rendering - garrett - 07-24-2014

Now that I know how you are drawing into the custom widget using OpenGL, I should have explained my tests more clearly. Using our library alone, I tried every combination I could think of with drawing/redrawing in response to events, via a timer, etc. All of it results in a reasonably flicker-less experience.

Since you are drawing every 1/30 of a second with OpenGL regardless of widget events, I'm not sure I can be of much help. My OpenGL experience is limited, especially on Windows. Some thoughts: Is drawing every 1/30 of a second necessary? Have you tried drawing indirectly only when a widget event occurs, using OpenGL to draw into e.g. your own offscreen context/HWND, and then bit blit the result into the CustomWidget platform HWND?


RE: Custom widget rendering - Gaxx - 09-04-2014

Hello again. I've been on vacation, so didn't check here for some time. I've dug up some more info on this issue. Basically this is what happens - when I call UpdateWindow() winapi function for custom widget window handle, drawing area gets filled with black color. So basically, my functions redraws window as it can, but each WM_PAINT message, recieved by this window fills area black for some reason. Also, you have written that you used your library alone. Do you mean drawing API of a library or some specific method of using OGL?


RE: Custom widget rendering - Gaxx - 09-15-2014

I have finally figured it out. Writing solution here in case someone encounters similar problem. First thing to do is getting parent window handle for custom widget with GetParent() winapi function. Then you should set a new wndprc function with no paint routine for the parent with SetWindowLongPtr() function. You can optionally save old wndprc in case you need to transfer some control to it. And that's it.