[GtkGLExt] first call of gdk_gl_drawable_gl_begin fails



Hi all,
i have a little program with a gtkgl capable drawing area just like in
various example programs.

But i have a problem:

The first call of 
GdkGLContext *glcontext = gtk_widget_get_gl_context (object);
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (object);
gdk_gl_drawable_gl_begin (gldrawable, glcontext)
in the configure_event callback always fails with this message:

GdkGLExt-CRITICAL **: file gdkgldrawable.c: line 141
(gdk_gl_drawable_gl_begin): assertion `GDK_IS_GL_DRAWABLE (gldrawable)'
failed

Further calls of this function work normal.
I can avoid this by adding
if ( ! GDK_IS_GL_DRAWABLE( object ) ) return FALSE;

So far i didn't manage to anything opengl specific in the drawing area.
Even the simpliest thing like in simple.c in the gtkgl examples don't
work.
Is it normal that the first call fails?
Is this the reason that i can't render opengl things in the area?

Thanks for any hints
Alex


Here is the callback function

gboolean on_drawingarea1_configure_event (GtkWidget *object,
GdkEventConfigure *event, gpointer user_data)
{
	GdkGLContext *glcontext;
	GdkGLDrawable *gldrawable;
	baf_log ("configure");
	if (!GTK_WIDGET_REALIZED (object)) 
		return FALSE;
	if (!GDK_IS_GL_DRAWABLE(object))
		return FALSE;
	glcontext = gtk_widget_get_gl_context (object);
	gldrawable = gtk_widget_get_gl_drawable (object);
	if (!gdk_gl_drawable_gl_begin (gldrawable, glcontext))
	{
		g_print ("no draw in configure\n");
		return FALSE;
	}
	baf_ogl->change_viewport (object->allocation.width,
object->allocation.height);	
	gdk_gl_drawable_gl_end (gldrawable);
	return TRUE;
	

}




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