From b3f55e7f8b0c6964779f5df683467e8061c67c13 Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Mon, 23 Jan 2023 22:52:18 -0500 Subject: [PATCH] Ensure glew is initialized in the 3d model viewer Fixes KICAD-7M --- .../3d_model_viewer/eda_3d_model_viewer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp index f52241042f..d0f8c6a36f 100644 --- a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp +++ b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp @@ -27,6 +27,7 @@ * 3d models that come in the original data from the files without any transformations. */ +#include // Must be included first #include #include "3d_rendering/opengl/3d_model.h" #include "eda_3d_model_viewer.h" @@ -38,6 +39,7 @@ #include #include #include +#include /** * Scale conversion from 3d model units to pcb units @@ -182,6 +184,20 @@ void EDA_3D_MODEL_VIEWER::Clear3DModel() void EDA_3D_MODEL_VIEWER::ogl_initialize() { + const GLenum err = glewInit(); + + if( GLEW_OK != err ) + { + const wxString msgError = (const char*) glewGetErrorString( err ); + + wxLogMessage( msgError ); + } + else + { + wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::ogl_initialize Using GLEW version %s" ), + FROM_UTF8( (char*) glewGetString( GLEW_VERSION ) ) ); + } + glHint( GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST ); glHint( GL_LINE_SMOOTH_HINT, GL_NICEST ); glHint( GL_POLYGON_SMOOTH_HINT, GL_NICEST );