Unity-Technologies / NativeRenderingPlugin

C++ Rendering Plugin example for Unity
https://docs.unity3d.com/Manual/NativePluginInterface.html
MIT License
815 stars 163 forks source link

Windows - Fix crash on startup, caused by glGetError #30

Closed CoffeeLexer closed 1 year ago

CoffeeLexer commented 1 year ago

Recent PR cleared error flags before initialization which crashes Windows projects. On Linux this works fine as OpenGL is already initialized when program starts. On Windows you need to initialize OpenGL with gl3w, before calling any OpenGL function. That's why when we use glGetError(), program crashes as function points to nullptr.

To fix this, we initialize OpenGL before glGetError call.