ebassi / glarea-example Goto Github PK
View Code? Open in Web Editor NEWExample of GtkGLArea use
License: Creative Commons Zero v1.0 Universal
Example of GtkGLArea use
License: Creative Commons Zero v1.0 Universal
This example works for me on openSUSE15.5.
I would however be interested on a working version for Mac also.
Some time ago, I could build it on a Mac Monterey, and it was okay (shader version 410 was necessary, as reported in #9). Most likely because of an update which happened meanwhile when doing brew install glm
(glm was required by some code using the OpenGL core profile), it now still compiles, but shows a grey window only. On an older MacBook I have access to (with renderer Intel Iris Pro OpenGL Engine), it is the same (grey window); also other people reported a grey window on fairly new Mac M1 .
Is there any workaround known for this?
Hi, Emmanuele.
Can you provide an example with just a single GtkWindow and GtkGlArea in a main.c (without GtkApplication, *.ui and other resources)? I'm trying to do just this, but it's not working.
Your application works at my lab notebook (which supports OpenGL 4.0), but not in my home notebook (which supports until OpenGL 2.1). It couldn't create a context, even though I use gtk_gl_area_set_required_version
.
Thanks
The code uses guint
when it should be using GLuint
or GLint
:
glarea-example/glarea-app-window.c
Lines 30 to 35 in c5573a0
That it happens to work may just be an (un)lucky accident.
This tutorial was really helpful in helping me port GTK2 OpenGL applications to GTK3. However, the resulting projects do not look as nice, as it is unclear how to enable multisampling with GTK3. This is best seen in high contrast edges, such as white on black. Below on the left is your GTK3 project with the background set to black and the top vertex set to white. Note the jagged appearance of the right triangle. The left is what is generated with GTK2 using x4 multisampling: the aliasing of the edges is much nicer, with partial volume represented by gray. Is there any way to enable multisampling with GTK3 OpenGL?
Hi, nice example.
To start this up in debian 9 it's a bit difficult. I solved starting the application by typing in terminal : MESA_GL_VERSION_OVERRIDE=4.5 MESA_GLSL_VERSION_OVERRIDE=450 ./glarea
Please add this start option to your readme file.
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;
i'm getting this warning and glarea is not generated. Libraries used and the msys2 (64 bits) ones.
The instructions in the README aren't up-to-date:
$ flatpak install --from http://ebassi.github.io/glarea-example/glarea-example.flatpakref
error: Can't load dependent file https://sdk.gnome.org/gnome.flatpakrepo: Error resolving “sdk.gnome.org”: Name or service not known
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.