glarea-example icon indicating copy to clipboard operation
glarea-example copied to clipboard

GLSL version on Mac OS X

Open biochem-fan opened this issue 3 years ago • 0 comments

In case someone is having the same trouble as mine:

Apparently GTK-3 (installed via Homebrew) on Mac OS X Big Sur (Mac Book Pro 2015, Intel Iris Graphics 6100) requires a higher version of GLSL. The original code failed to compile:

Shader compilation failed: ERROR: 0:1: '' :  version '130' is not supported

410 worked.

diff --git a/glarea-app-window.c b/glarea-app-window.c
index cd78360..f7708b2 100644
--- a/glarea-app-window.c
+++ b/glarea-app-window.c
@@ -100,6 +100,8 @@ create_shader (int          shader_type,
                GError     **error,
                guint       *shader_out)
 {
+  printf("Supported GLSL version: %s\n", (char *)glGetString(GL_SHADING_LANGUAGE_VERSION));
+
   guint shader = glCreateShader (shader_type);
   glShaderSource (shader, 1, &source, NULL);
   glCompileShader (shader);
diff --git a/glarea-fragment.glsl b/glarea-fragment.glsl
index c331ad2..273ec33 100644
--- a/glarea-fragment.glsl
+++ b/glarea-fragment.glsl
@@ -1,4 +1,4 @@
-#version 130
+#version 410
 
 smooth in vec4 vertexColor;
 
diff --git a/glarea-vertex.glsl b/glarea-vertex.glsl
index 83dda48..9c36b3c 100644
--- a/glarea-vertex.glsl
+++ b/glarea-vertex.glsl
@@ -1,4 +1,4 @@
-#version 130
+#version 410
 
 in vec3 position;
 in vec3 color;

biochem-fan avatar Apr 04 '22 04:04 biochem-fan