Skip to content

Commit 85840b6

Browse files
author
eduardas.vitkus
committed
[opengl][windows] fix crash on startup, caused by using OpenGL API before it is initialized
1 parent a1c46c0 commit 85840b6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

PluginSource/source/RenderAPI_OpenGLCoreES.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ static GLuint CreateShader(GLenum type, const char* sourceText)
137137

138138
void RenderAPI_OpenGLCoreES::CreateResources()
139139
{
140+
# if UNITY_WIN && SUPPORT_OPENGL_CORE
141+
gl3wInit();
142+
# endif
140143
// Make sure that there are no GL error flags set before creating resources
141144
while (glGetError() != GL_NO_ERROR) {}
142145

@@ -154,10 +157,6 @@ void RenderAPI_OpenGLCoreES::CreateResources()
154157
# if SUPPORT_OPENGL_CORE
155158
else if (m_APIType == kUnityGfxRendererOpenGLCore)
156159
{
157-
# if UNITY_WIN
158-
gl3wInit();
159-
# endif
160-
161160
m_VertexShader = CreateShader(GL_VERTEX_SHADER, kGlesVProgTextGLCore);
162161
m_FragmentShader = CreateShader(GL_FRAGMENT_SHADER, kGlesFShaderTextGLCore);
163162
}

0 commit comments

Comments
 (0)