+static void expose_hud(GritsCallback *hud, GritsOpenGL *opengl, gpointer _env)
+{
+ GritsPluginEnv *env = GRITS_PLUGIN_ENV(_env);
+ g_debug("GritsPluginEnv: expose_hud");
+ gdouble x, y, z;
+ grits_viewer_get_rotation(env->viewer, &x, &y, &z);
+
+ /* Setup projection */
+ gint win_width = GTK_WIDGET(opengl)->allocation.width;
+ gint win_height = GTK_WIDGET(opengl)->allocation.height;
+ float scale = MIN(win_width, win_height) / 10.0;
+ float offset = scale+20;
+ glTranslatef(offset, offset, 0);
+
+ /* Setup lighting */
+ float light_ambient[] = {0.1f, 0.1f, 0.0f, 1.0f};
+ float light_diffuse[] = {0.9f, 0.9f, 0.9f, 1.0f};
+ float light_position[] = {-50.0f, -40.0f, -80.0f, 1.0f};
+ glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
+ glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
+ glLightfv(GL_LIGHT0, GL_POSITION, light_position);
+
+ /* Setup state */
+ glClear(GL_DEPTH_BUFFER_BIT);
+ glEnable(GL_COLOR_MATERIAL);
+ glEnable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+
+ /* Draw compas */
+ glRotatef(x, 1, 0, 0);
+ glRotatef(-z, 0, 0, 1);
+ glRotatef(-90, 0, 0, 1);
+ glRotatef(-90, 1, 0, 0);
+ glColor4f(0.9, 0.9, 0.7, 1.0);
+ glutSolidTeapot(scale * 0.5);
+}
+
+static void click_hud(GritsCallback *hud, GritsViewer *viewer)
+{
+ grits_viewer_set_rotation(viewer, 0, 0, 0);
+}