GDK and GLib main loop



Hi all! I'm making an OpenGL application based on GDK and GtkGLArea. My code
so far works, but it has two issues:

1. It does not handle events in a blocking fashion.
2. Somehow the window does not receive an Expose event.

I was told that for blocking until an event arrives, I'd have to use GLib
main loop. I have looked at the GLib main loop reference page, but I have no
idea how to make the this work. So I need some hints here.

And for the GDK_EXPOSE event thing, I even set the all events mask, and
there was still no expose event. I went around this by drawing outside the
event switch, after each event is processed. This is not so important, but
I'm curious why it happens. With Xlib programs, an Expose event is received
when the window pops up, and every time it is 'made dirty' by other windows
or dragging on-screen from off-screen or whatever.

Here is my code, attached. Compile with g++ *gdkgl.cpp* `pkg-config gdk-2.0
gtkglext-1.0 --libs --cflags` -ogdkgl

Cheers!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]