mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
0092a08dfc
This adds a small demo of using OpenGL shaders, it renders a quad over the entire widget with a custom fragment shader. The coordinates and the uniform names are compatible with the ones on shadertoy.com (although some features, like texture inputs are missing currently). The default shader in the demo is https://www.shadertoy.com/view/wsjBD3 which is CC0, so it is redistributable by Gtk+ (most other shaders are CC-BY-NC-SA which isn't obviously compatible). I also added a set of buttons loading a few other CC0 shaders I found.
35 lines
1.0 KiB
C
35 lines
1.0 KiB
C
#ifndef __GTK_SHADERTOY_H__
|
|
#define __GTK_SHADERTOY_H__
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
#define GTK_TYPE_SHADERTOY (gtk_shadertoy_get_type ())
|
|
#define GTK_SHADERTOY(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
|
|
GTK_TYPE_SHADERTOY, \
|
|
GtkShadertoy))
|
|
#define GTK_IS_SHADERTOY(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
|
|
GTK_TYPE_SHADERTOY))
|
|
|
|
typedef struct _GtkShadertoy GtkShadertoy;
|
|
typedef struct _GtkShadertoyClass GtkShadertoyClass;
|
|
|
|
struct _GtkShadertoy {
|
|
GtkGLArea parent;
|
|
};
|
|
|
|
struct _GtkShadertoyClass {
|
|
GtkGLAreaClass parent_class;
|
|
};
|
|
|
|
GType gtk_shadertoy_get_type (void) G_GNUC_CONST;
|
|
GtkWidget *gtk_shadertoy_new (void);
|
|
const char *gtk_shadertoy_get_image_shader (GtkShadertoy *shadertoy);
|
|
void gtk_shadertoy_set_image_shader (GtkShadertoy *shadertoy,
|
|
const char *shader);
|
|
|
|
G_END_DECLS
|
|
|
|
#endif /* __GTK_SHADERTOY_H__ */
|