I want to create a window using GTK 3 under linux (fedora 12) and draw on it a simple rectangle using cairo-gl backend, for this I want to create a cairo-gl surface. How can I do this, can anybody help me with a sample code.
Thanks in advance.
RC7
I want to create a window using GTK 3 under linux (fedora 12) and draw on it a simple rectangle using cairo-gl backend, for this I want to create a cairo-gl surface. How can I do this, can anybody help me with a sample code.
Thanks in advance.
RC7
Well, first of all you need to make sure your cairo version has gl support. I m not sure the version in Fedora 12 has it. You may have to compile your own cairo.
Then you need to look at cairo-gl.h: http://cgit.freedesktop.org/cairo/tree/src/cairo-gl.h
This file has a nice comment explaining that first you need to create a cairo_device using your gl context and then pass it to cairo_gl_surface_create().
This file from the cairo test suite contains an example of a gl surface: http://cgit.freedesktop.org/cairo/tree/test/gl-surface-source.c
Notice that it is a .c file that includes another .c file: http://cgit.freedesktop.org/cairo/tree/test/set-source.c
The test suite is full of cairo programming examples. Use it! :)
I m not sure how you do GL using GTK3, but in the worst case, you can use GDK to get X11 s Display and Window IDs, then you use standard glx calls: http://developer.gnome.org/gdk3/stable/gdk3-X-Window-System-Interaction.html
And to use cairo with GTK3, you need to look at this: http://developer.gnome.org/gdk3/stable/gdk3-Cairo-Interaction.html And this: http://zetcode.com/tutorials/cairographicstutorial/
I gave you a bunch of Lego bricks. Now you need to assemble them. (Or maybe someone with more time will do it and write a better answer here?)
I am a new programmer. It is not my job but i want to learn python. I am a Windows 10 user and I am using the folllowing programs: Python 3.8 Gtk+ Glade Gnuplot Pycharm. I have installed the first 4 ...
I m programming in c++ with gtkmm3. I want to change some fonts in my program. I read all the things about CssStyleProvider, StyleContext in gtkmm documentation and also in gtk+ documentaion but i ...
the following code should work import gi import gi.repository this works in a python shell. And it also works if I save the file as a script then launch it in a terminal. but in aptana3 i get this: ...
I am a seasoned web developer (XHTML/CSS/JavaScript/X-Browser), and have just installed Fedora 15. Fedora is on the bleeding edge, and ships with Gnome 3 / Gnome Shell as the default desktop. I know ...
I found this way: GdkPixmap *backPixMap = gdk_pixmap_create_from_xpm ( window , NULL , NULL , fileName ); gdk_window_set_back_pixmap( GTK_WIDGET( window )->window , backPixMap , FALSE ); but it ...
I want to create a window using GTK 3 under linux (fedora 12) and draw on it a simple rectangle using cairo-gl backend, for this I want to create a cairo-gl surface. How can I do this, can anybody ...
I m looking to set a GtkTextView cursor-color. I know I can do it through the gtk_rc_parse command or something similar, but the documentation says that those commands are depreciated, and I don t ...
I am new to GUI programming, and I haven t found yet what library is best for my purpose (i want to make desktop environment applications, eg. docks, panels, desklets etc.) I have started learning ...