Re: How I can do Double Buffer whether OpenGl Ext?



And then you will have a expose callback similar to this:

int my_expose (GtkWidget *widget, GdkEventExpose *event, void *data)
{
GdkGLDrawable *gldrawable = gtk_widget_get_gl_drawable (widget);
GdkGLContext *glcontext = gtk_widget_get_gl_context (widget);
app_window *my_window = APP_CAST_WINDOW data;

/*
* draw only last expose
*/

if (event->count > 0) return TRUE;

if (gdk_gl_drawable_gl_begin (gldrawable, glcontext) == TRUE)
 {
 draw_my_window (my_window);

 if (gdk_gl_drawable_is_double_buffered (gldrawable) == TRUE)
   gdk_gl_drawable_swap_buffers (gldrawable);
 else
   glFlush ();

 glGetError ();

 gdk_gl_drawable_gl_end (gldrawable);
 }

return TRUE;
}

Regards,
Carlos
>From the logo example:

/*
     * Configure OpenGL-capable visual.
     */
/* Try double-buffered visual */
    glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB    |
                                          GDK_GL_MODE_DEPTH  |
                                          GDK_GL_MODE_DOUBLE);
    if (glconfig == NULL)
    {
        g_print ("*** Cannot find the double-buffered visual.\n");
        g_print ("*** Trying single-buffered visual.\n");
/* Try single-buffered visual */
        glconfig = gdk_gl_config_new_by_mode (GDK_GL_MODE_RGB   |
                                              GDK_GL_MODE_DEPTH);
        if (glconfig == NULL)
        {
            g_print ("*** No appropriate OpenGL-capable visual found.\n");
            exit (1);
        }
    }
......

    /* Set OpenGL-capability to the widget. */
    gtk_widget_set_gl_capability (drawing_area,
                                  glconfig,
                                  NULL,
                                  TRUE,
                                  GDK_GL_RGBA_TYPE);

This function first tries to create a glconfig using double buffered, if fails, uses single buffer). This works on OS X 10.6 Snow Leopard.



 EMAILING FOR THE GREATER GOOD
Join me

Date: Tue, 9 Feb 2010 04:41:12 -0300
Subject: How I can do Double Buffer whether OpenGl Ext?
From: grojas icc gmail com
To: gtk-app-devel-list gnome org

Hi,

I'm trying to do a double buffer with pixbuf and draw area, whether to use
OpenGL Ext, but i don't know if it is posible or not.

Any idea?

Thanks.

Gustavo R.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list





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