wxGLCanvas framerate-problen under win10 Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

Hello,

i've a problem with the OpenGL-framerate on wx 3.1.2 that is that my program slows down hardly the more wxGLCanvas-controls are visible.

Unfortunately it's like this: the problem seems to be older (not only in the last builts) but it was not really visible. Since i have a new notebook with Nvidia GTX1060 i expected to be able to render OpenGL-things with a much higer framerate then before, but fact is that i get the same or even less frames then on the old notebook.
The situation is now, that i'm in contact with the producer of my new notebook (razer), that i bought at first to run this application. They (really!) propsed last monday to take it back if i don't get satisfying results. So now i have to find out what the problem might be as fast as possible. Unfortunately the GPUs of the old (intel HD Graphics 4000) and the new notebook (Nvidia GTX1060) are not really compartible. So i have no version of my application that runs on both notebooks. Over this, on my old notebook, i've wx 2.9.3 and on the new one wx 3.1.2 - which have lots of differences conderning OpenGL-implementation.

To make it short: I've made tests with three different versions of my application on two different notebooks and i've got no significant result, except of that each additional canvas that is visible slows down the framerate and that this effect seems stronger on the new notebook.
The values are around:
1a) old notebook last built, one canvas: ~40fps
1b) old notebook last built, four canvases: ~30fps
2a) new notebook any built, one canvas: >60fps
2b) new notebook any built, four canvases: <20fps
Note that the difference on the old notebook seems to be plausible, as the system runs at it's limits there. So each additional thing to do will slow it down a bit. But at least i would have expected 2b to be faster then 1b.

As far as possible without weeks of work, i now mostly eleminated my code as reason. So the question would be, if there is something in my code, that i did not find (might still be possible), if it has to do with wxWidgets, or if is a more basic thing, like the nvidia-driver - and: how to find it out???

Edit: I posted no code here because i don't have any idea what could be the problem....

Best,
Frank
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGLCanvas framerate-problen under win10

Post by doublemax »

2a) new notebook any built, one canvas: >60fps
2b) new notebook any built, four canvases: <20fps
Based on these number my first guess that it's VSync-related. When each of the four panels waits for the VSync to swap buffers, you'd get 15fps. Disable VSync in the Nvidia settings panel and try again.
Use the source, Luke!
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

Hey doublemax,

you're fantastic!!! It Immideatly to worked. Not even the guys at razer had an idea...

Thank you so much!

PS. this new notebook i decided to buy not at least after you (last october) told me that intel-gpu-drivers are buggy. So now i have this one and (now, after this hint), it works as expected. I'll do some little clean up now. Then i upload a version that works with nvidia. I can send yo a link, if you're intresetd to look at...


Best,
Frank
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGLCanvas framerate-problen under win10

Post by doublemax »

Then i upload a version that works with nvidia. I can send yo a link, if you're intresetd to look at...
Yes, please.

BTW: What framerate did you get with VSync disabled?
Use the source, Luke!
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

BTW: What framerate did you get with VSync disabled?
This depends on several factors.
I've a fixed framrate (set by a control). At default my program starts with a fps-setting of 60 but i also tried 120. I use a one-shot-timer and adapt the interval permanently. So, mostly the rate stays constant if i do not request too many calculations:
I have i.e. a shader morphing two vertex-arrays of the same size. For this, there are three calulations needed. This slows down at around three times calculating 1/2 million vertices because of GPU-overload. On the other hand there might be CPU-limits if too many modules are active and my interpreter has to do too much (duobeling the framrate, leeds to 2x as much interpreted codelines).
A not really little part of the CPU-usage is consumed by drawing wxBitmaps that i use as ocilloscope and to draw small round color-inicators. Also there are some special modules that may need lots of CPU, like i.e. Module, that can copy the content of an external window to a texture.

At default state the program needs around 10-20% CPU (= 40-80% of one core). The system is a i7-7700HQ (4x2.8GHz), 16GB RAM and GTX1060 with 6GB.
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

By the way: Concernig drawing bitmaps etc.: Is there any way to apply physical coordinate to wxDC? It would be nice to have smaller borders around my buttons (using DrawLine()).
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGLCanvas framerate-problen under win10

Post by doublemax »

Concernig drawing bitmaps etc.: Is there any way to apply physical coordinate to wxDC?
Sorry, i don't understand what you mean by that.
Use the source, Luke!
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

Sorry for delay (see below)...

What i meant is: i've an UHD-display on my notebook. So i applied global scaling by the system otherwise several applications have too small controls and text. Therefore my desktop has a virtual resolution of (i think) 1920x1080 and with wxDC i can't refer more, even if my physical resolution is higher...


-----------

The last days i needed to clean up huge parts of my shader- and script-codes, and to add some additional "modules" to my program (therfore the delay...) Now i think i have a (somehow) presentable version that don't make me embrassed to show it. So - as promised - i've uploaded it as zip-file on my server (=> http://www.art-ganseforth.de/glLive3D/1 ... upload.rar). But it's without sources, because they are absolutly chaotic and not presentable (and somehow embrassing). So i'll provide them only on request.
I really would be happy about hints and critics from an outside-view - especiallys from you, doublemax. In fact, without your help, i won't have got so far. I'd really like to metion this in still to write credits, if you don't mind.

Thank you,
Frank
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGLCanvas framerate-problen under win10

Post by doublemax »

What i meant is: i've an UHD-display on my notebook. So i applied global scaling by the system otherwise several applications have too small controls and text. Therefore my desktop has a virtual resolution of (i think) 1920x1080 and with wxDC i can't refer more, even if my physical resolution is higher...
This means that you didn't mark your application as "dpi-aware". You can do this through an entry in the manifest:
https://msdn.microsoft.com/en-us/librar ... 85%29.aspx

The application looks pretty solid now, much, much better than the last version i saw =D>

The only problem is that it crashes when you leave the application. Do you see the same?
Use the source, Luke!
art-ganseforth
Earned some good credits
Earned some good credits
Posts: 147
Joined: Mon Sep 01, 2014 10:14 am

Re: wxGLCanvas framerate-problen under win10

Post by art-ganseforth »

Yes, it crashes on closing. Exiting the application with a correct clean-up will be a chapter for itself.
Currently it's like this: pressing the button will call an event-function, that calls the interpreter-instance associated with this button to "execute" a string that is stored as event-function, that redirects the execution the topmost interpreter-instance (representing the main-window), that interprets the exit-statement.
So, when the interpreter-instance of the main-window reaches the exit call, there is an unfinished event-call and a partly interpreted term in the button-interpreter. At this point, i normally shold implemet a one-shot-timer, to initiate the closing-process later, so that the interpreter can finish the line. Currently the interpreter-instance closing the main-window is called by an interpreter-instance, that is a child of the main-window.
But even a timer will be no guaranty that, it works immideately and because all this gets really complicated and because this is nothing that is a problem while the program is running, i currently just call exit() without any claning up.

There are also some other minor issues that would be more important to find, like that somtimes wxFrame is not shown if it shold be. So i.e. there is a (currently empty) startup-window created and shown (which mean, that i call "show()"). But obviously it's not there.
Also, the editor-window stays hidden if you close it and then press the button left of the CPU-usage-display, that should show it again. But there are other ways to show it again. So, it's not totally lost. Only pressing the button next to the CPU-display does not work for some reasons.

Finally there is a memory-leak in the interpreter, that loses ~200MB / hour (i think i will have to learn how to use a debugger, to find it).


But all these bugs do not really reduce the functionality. So the next weeks i'll probably program more shaders and modules. Also i want to repair the midi-connectivity that has got lost somewhere on the way...


Thanks again for your kind help,
Frank
Post Reply