--- examples/simple.c	2013-08-06 02:17:49 +0000
+++ examples/simple.c	2013-09-08 14:08:59 +0000
@@ -1,4 +1,4 @@
-/*
+﻿/*
  * Copyright (C) 1998 Janne Löf <jlof@mail.student.oulu.fi>
  *
  * This library is free software; you can redistribute it and/or
@@ -21,12 +21,19 @@
 #include <gtkgl/gtkglarea.h>
 #include <GL/gl.h>
 
+
 gint init(GtkWidget *widget)
 {
+  g_print ("GTK+ version : %d.%d.%d\n", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+
   /* OpenGL functions can be called only if make_current returns true */
   if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
     {
+#if defined __GTK2__
       glViewport(0,0, widget->allocation.width, widget->allocation.height);
+#elif defined __GTK3__
+      glViewport(0,0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
+#endif
       glMatrixMode(GL_PROJECTION);
       glLoadIdentity();
       glOrtho(0,100, 100,0, -1,1);
@@ -40,9 +47,12 @@
 /* When widget is exposed it's contents are redrawn. */
 gint draw(GtkWidget *widget, GdkEventExpose *event)
 {
+
+#if defined __GTK2__
   /* Draw only last expose. */
   if (event->count > 0)
     return TRUE;
+#endif
 
   /* OpenGL functions can be called only if make_current returns true */
   if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
@@ -72,7 +82,11 @@
   /* OpenGL functions can be called only if make_current returns true */
   if (gtk_gl_area_make_current(GTK_GL_AREA(widget)))
     {
+#if defined __GTK2__
       glViewport(0,0, widget->allocation.width, widget->allocation.height);
+#elif defined __GTK3__
+      glViewport(0,0, gtk_widget_get_allocated_width(widget), gtk_widget_get_allocated_height(widget));
+#endif
     }
   return TRUE;
 }
@@ -114,8 +128,13 @@
   gtk_container_set_border_width(GTK_CONTAINER(window), 10);
 
   /* Quit form main if got delete event */
+#if defined __GTK2__
   gtk_signal_connect(GTK_OBJECT(window), "delete_event",
 		     GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
+#elif defined __GTK3__
+  g_signal_connect(GTK_WIDGET(window), "delete_event",
+		     G_CALLBACK(gtk_main_quit), NULL);
+#endif
 
 
   /* You should always delete gtk_gl_area widgets before exit or else
@@ -126,7 +145,11 @@
      for all your top level windows unless you are certain that they get
      destroy signal by other means.
   */
+#ifdef __GTK2__
   gtk_quit_add_destroy(1, GTK_OBJECT(window));
+#elif __GTK3__
+// WOT ?
+#endif
 
 
   /* Create new OpenGL widget. */
@@ -138,17 +161,36 @@
 
   /* Connect signal handlers */
   /* Redraw image when exposed. */
+#if defined __GTK2__
   gtk_signal_connect(GTK_OBJECT(glarea), "expose_event",
 		     GTK_SIGNAL_FUNC(draw), NULL);
+#elif defined __GTK3__
+  g_signal_connect(GTK_WIDGET(glarea), "draw",
+		     G_CALLBACK(draw), NULL);
+#endif
   /* When window is resized viewport needs to be resized also. */
+#if defined __GTK2__
   gtk_signal_connect(GTK_OBJECT(glarea), "configure_event",
 		     GTK_SIGNAL_FUNC(reshape), NULL);
+#elif defined __GTK3
+  g_signal_connect(GTK_WIDGET(glarea), "configure_event",
+		     G_CALLBACK(reshape), NULL);
+#endif
   /* Do initialization when widget has been realized. */
+#if defined __GTK2__
   gtk_signal_connect(GTK_OBJECT(glarea), "realize",
 		     GTK_SIGNAL_FUNC(init), NULL);
+#elif defined __GTK3__
+  g_signal_connect(GTK_WIDGET(glarea), "realize",
+		     G_CALLBACK(init), NULL);
+#endif
 
   /* set minimum size */
+#if defined __GTK2__
   gtk_widget_set_usize(GTK_WIDGET(glarea), 100,100);
+#elif defined __GTK3__
+  gtk_widget_set_size_request(GTK_WIDGET(glarea), 100,100);
+#endif
 
   /* put glarea into window and show it all */
   gtk_container_add(GTK_CONTAINER(window),GTK_WIDGET(glarea));
