Skip to content

Commit 3207faf

Browse files
committed
Request OpenGL 3.3 compat profile to fix crash on AMD/Intel Windows drivers
1 parent e0ed95c commit 3207faf

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/Processing.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3362,8 +3362,12 @@ void PApplet::run(){
33623362
this->settings();
33633363

33643364
glfwWindowHint(GLFW_RESIZABLE,isResizable?GLFW_TRUE:GLFW_FALSE);
3365-
glfwWindowHint(GLFW_SAMPLES,4); // 4x MSAA for crisp P3D rendering; 2D noSmooth() disables at runtime
3366-
glfwWindowHint(GLFW_STENCIL_BITS,8); // needed for concave shape fill
3365+
glfwWindowHint(GLFW_SAMPLES,4);
3366+
glfwWindowHint(GLFW_STENCIL_BITS,8);
3367+
// Request OpenGL 3.3 compatibility profile
3368+
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
3369+
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
3370+
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE);
33673371
gWindow=glfwCreateWindow(winWidth,winHeight,g_sketchName.c_str(),nullptr,nullptr);
33683372
if(!gWindow){
33693373
const char* err="unknown"; (void)err;
@@ -3422,8 +3426,8 @@ void PApplet::run(){
34223426
if(phongProg){glDeleteProgram(phongProg);phongProg=0;}
34233427
glEnable(GL_BLEND);glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
34243428
glEnable(GL_DEPTH_TEST);
3425-
#ifndef __EMSCRIPTEN__
3426-
glShadeModel(GL_SMOOTH);
3429+
#if !defined(__EMSCRIPTEN__) && defined(GL_SHADE_MODEL)
3430+
if (glShadeModel) glShadeModel(GL_SMOOTH);
34273431
#endif
34283432
glEnable(GL_NORMALIZE);
34293433
smooth();

0 commit comments

Comments
 (0)