54 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
55 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
58 float ambient[] = {0.0f, 0.0f, 0.0f, 1.0f};
59 float diffuse[] = {0.5f, 0.5f, 0.5f, 1.0f};
60 float position[] = {0.0f, 3.0f, 3.0f, 0.0f};
62 float lmodel_ambient[] = {0.2f, 0.2f, 0.2f, 1.0f};
63 float local_view[] = {0.0f};
66 if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
71 glClear(GL_COLOR_BUFFER_BIT);
74 glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
75 glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);
76 glLightfv(GL_LIGHT0, GL_POSITION,
position);
77 glLightModelfv(GL_LIGHT_MODEL_AMBIENT, lmodel_ambient);
78 glLightModelfv(GL_LIGHT_MODEL_LOCAL_VIEWER, local_view);
82 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
83 gdk_gl_drawable_gl_end(gldrawable);
99 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
100 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
101 view->
w = widget->allocation.width;
102 view->
h = widget->allocation.height;
108 if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
112 glGetIntegerv(GL_VIEWPORT, vPort);
114 glMatrixMode(GL_PROJECTION);
116 if (widget->allocation.width > 1)
130 glMatrixMode(GL_MODELVIEW);
131 gdk_gl_drawable_gl_end(gldrawable);
147 GdkGLContext *glcontext = gtk_widget_get_gl_context(widget);
148 GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable(widget);
151 if (!gdk_gl_drawable_gl_begin(gldrawable, glcontext))
153 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
157 if (gdk_gl_drawable_is_double_buffered(gldrawable))
158 gdk_gl_drawable_swap_buffers(gldrawable);
161 gdk_gl_drawable_gl_end(gldrawable);
181 if (
view->
g == 0)
return FALSE;
189 if (event->button == 1)
192 if (event->button == 3)
194 if (event->button == 2)
220 if (event->button == 1 || event->button == 2 || event->button == 3)
255 if (seconds > 0.005) {
257 if (event->direction == 0)
259 if (event->direction == 1)
278 float x = (float) event->x;
279 float y = (float) event->y;
301 gdk_window_invalidate_rect(widget->window, &widget->allocation,FALSE);
312 GdkGLConfig *glconfig;
314 glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
317 if (glconfig ==
NULL) {
318 g_print(
"\n*** Cannot find the double-buffered visual.\n");
319 g_print(
"\n*** Trying single-buffered visual.\n");
322 glconfig = gdk_gl_config_new_by_mode(GDK_GL_MODE_RGB |
324 if (glconfig ==
NULL) {
325 g_print(
"*** No appropriate OpenGL-capable visual found.\n");
348 glconfig,
NULL, TRUE, GDK_GL_RGBA_TYPE);
351 GDK_BUTTON_MOTION_MASK |
352 GDK_POINTER_MOTION_MASK |
353 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS |
354 GDK_BUTTON_RELEASE_MASK |
355 GDK_SCROLL | GDK_VISIBILITY_NOTIFY_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
382 gtk_widget_add_events(glade_xml_get_widget(
xml,
"frmMain"),
383 GDK_BUTTON_MOTION_MASK |
384 GDK_POINTER_MOTION_MASK |
385 GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS |
386 GDK_BUTTON_RELEASE_MASK |
387 GDK_SCROLL | GDK_VISIBILITY_NOTIFY_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK );
390 g_signal_connect(G_OBJECT(glade_xml_get_widget(
xml,
"frmMain")),
"key_release_event", G_CALLBACK(
key_release_event),
NULL);
391 g_signal_connect(G_OBJECT(glade_xml_get_widget(
xml,
"frmMain")),
"key_press_event", G_CALLBACK(
key_press_event),
NULL);
void appmouse_drag(ViewInfo *v, int x, int y)
void appmouse_key_release(ViewInfo *v)
void appmouse_move(ViewInfo *v, int x, int y)
void appmouse_key_press(ViewInfo *v, int key)
void appmouse_middle_click_down(ViewInfo *v, int x, int y)
void appmouse_left_click_down(ViewInfo *v, int x, int y)
void appmouse_right_click_down(ViewInfo *v, int x, int y)
void appmouse_up(ViewInfo *v, int x, int y)
void init_arcBall(ArcBall_t *a, float NewWidth, float NewHeight)
static NORETURN void graphviz_exit(int status)
void glcompsetUpdateBorder(glCompSet *s, int w, int h)
int glexpose_main(ViewInfo *vi)
static gboolean button_press_event(GtkWidget *widget, GdkEventButton *event, void *data)
static gboolean configure_event(GtkWidget *widget, GdkEventConfigure *event, void *data)
static void realize(GtkWidget *widget, void *data)
static gboolean button_release_event(GtkWidget *widget, GdkEventButton *event, void *data)
static gboolean motion_notify_event(GtkWidget *widget, GdkEventMotion *event, void *data)
static gboolean scroll_event(GtkWidget *widget, GdkEventScroll *event, void *data)
gboolean expose_event(GtkWidget *widget, GdkEventExpose *event, void *data)
static gboolean key_press_event(GtkWidget *widget, GdkEventKey *event, void *data)
static glMouseButtonType getGlCompMouseType(int n)
static gboolean key_release_event(GtkWidget *widget, GdkEventKey *event, void *data)
GdkGLConfig * configure_gl(void)
void create_window(GdkGLConfig *glconfig, GtkWidget *vbox)
#define GL_VIEWPORT_FACTOR
GtkWidget * drawing_area
open gl canvas
glcompmouseupfunc_t mouseup
glcompmousedownfunc_t mousedown
glcompmouseoverfunc_t mouseover
glCompCallBacks functions
void close_graph(ViewInfo *vi)
int add_graph_to_viewport_from_file(char *fileName)