gtk2/demos/gtk-demo/gtkshadertoy.h
Alexander Larsson 0092a08dfc gtk-demo: Add shadertoy demo
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.
2020-09-08 09:56:25 +02:00

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__ */