# OpenGL and GTK2



## agnel_kurian (Mar 21, 2011)

I am about to get started on a small project using OpenGL and GTK2. I hope to be able to do this on FreeBSD. I managed to have a GLUT sample program (spinning triangle) running on my FreeBSD virtual machine within minutes. However, my project involves a more involved UI and I will not be able to rely on GLUT.

I am looking for a simple sample which demonstrates rendering OpenGL output on a GTK window. Looking forward to your help.


----------



## graudeejs (Mar 21, 2011)

You may want to look at these ports:

graphics/kudu             A 3D skeletal animation tool, powered by GTK+ and OpenGL
x11-toolkits/gtkglarea    An OpenGL widget for the GTK+ GUI toolkit
x11-toolkits/gtkglarea2   An OpenGL widget for the GTK+2 GUI toolkit
x11-toolkits/gtkglext     An OpenGL extension to GTK


----------



## wblock@ (Mar 21, 2011)

xscreensaver-demo from x11/xscreensaver does that.  graphics/hugin also has an OpenGL fast preview window... which no longer works for me.  Don't know if either is a good example.


----------



## kpedersen (Mar 22, 2011)

How involved does your GUI need to be?

I have coded a fairly large pure opengl widget set for my university dissertation and it only relies on glut. Widgets include:-

Window
Panel
Button
CheckBox
ListBox
MenuBar
PictureBox

Limitations include:- 

C++ only
no documentation

If you want I could post a copy.


----------



## rambetter (Mar 22, 2011)

I contribute towards an open source Gtk app that uses OpenGL for its rendering.  It uses GtkGlExt.  GtkGlExt comes with simple examples that show you how it's done.  Works well.


----------



## agnel_kurian (Mar 22, 2011)

kpedersen said:
			
		

> How involved does your GUI need to be?
> 
> I have coded a fairly large pure opengl widget set for my university dissertation and it only relies on glut. Widgets include:-
> 
> ...



I'm looking for toolbars, menubar and a command line window (similar to autocad). I'd appreciate it if you could share some code. Thanks.


----------



## agnel_kurian (Mar 22, 2011)

rambetter said:
			
		

> I contribute towards an open source Gtk app that uses OpenGL for its rendering.  It uses GtkGlExt.  GtkGlExt comes with simple examples that show you how it's done.  Works well.



Thanks. I'll have a look at this. I was expecting something simple along the lines of the GLUT sample.


----------



## agnel_kurian (Mar 22, 2011)

Thanks for all your replies. I was under the impression that one could somehow specify a GTK2 widget for OpenGL to use as a rendering window. I was thinking this was possible without using third party libraries.


----------



## graudeejs (Mar 22, 2011)

agnel_kurian said:
			
		

> Thanks for all your replies. I was under the impression that one could somehow specify a GTK2 widget for OpenGL to use as a rendering window. I was thinking this was possible without using third party libraries.



quote:


> Good programmers code, great - reuse


----------



## expl (Mar 22, 2011)

agnel_kurian said:
			
		

> Thanks for all your replies. I was under the impression that one could somehow specify a GTK2 widget for OpenGL to use as a rendering window. I was thinking this was possible without using third party libraries.



That is possible, how ever it involves deep understanding of GTK+ subsystem.


----------

