Hi there!!
I was trying out GtkGLArea and OpenGL in general and was able to render the triangle with the corners assigned with red, blue and green colors (have a working code) in windows 10 environment.
The next step was to capture the rendered image to a *.png image file (and maybe later on to Pdf). Now I am stuck. I tried something like this which I am using in the ‘render’ callback of GTK_GL_AREA(gl_drawing_area):
GdkGLContext *glcontext = gtk_gl_area_get_context(GTK_GL_AREA(gl_drawing_area));
GdkWindow *glwindow = gdk_gl_context_get_window(glcontext);
cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 800, 600);
cairo_t *cr = cairo_create(surface);
gdk_cairo_set_source_window (cr , glwindow , 0, 0);
cairo_paint(cr);
cairo_surface_write_to_png(surface, "image.png");
cairo_destroy(cr);
cairo_surface_destroy(surface);
All I am getting is
not the triangle. Even the background color is not the same. Can anyone help me out with it
Thanks
Siji Sukumaran