opentk / GLWpfControl

A fast native control for OpenTK 4.x + 3.x on WPF.
MIT License
194 stars 48 forks source link

Incorrect mathematical calculations when used in 32-bit applications #49

Open iborzenkov opened 3 years ago

iborzenkov commented 3 years ago

I created a primitive application (.NET Framework 4.6.1) by simply placing the GLWpfControl component in the WPF window. BugDemo.zip

In the project settings, I specified that the application is 32-bit.

The screenshot below shows the result of calculating the sum of two variables before initializing the GLWpfControl and after initializing it. It can be seen that after initialization, there are problems in calculating the sum. picture

If I specify in the project settings that the application is 64-bit, then the amount is calculated correctly.

I use OpenTK 3.3.1, OpenTK.GLWpfContol 3.3.0

NogginBops commented 4 months ago

It's possible this is because we don't specify FPU_PERSERVE when we create the DirectX 9 context which can affect rounding modes for the FPU in 32-bit processes. Would be weird if it effected the sum this much though.