HOME            UP --^           NEXT-->>  Demo-2
side4linux, a simple integrated development environment!

GTKCGL3 Demo-1  Creating a GTK+ Builder project suitable for use with OpenGLtm type widgets.

Purpose:  To provide a basic introduction to adding 'OpenGLtm type 3D Widgets' to a new GTK+ Builder Project.
We will not be creating a new Product for this so we will place the new Project into the existing Product 'MC-1`'
Note this Demo is intended to be built using Glade-3 and not Glade-2 which is now deprecated.


Requirements:

Exercise-1: Create the basic program 'Sample'.
  1. Open 'side4linux' and click on 'Project>New Project' in the Main Menue.
  2. Select 'GTKBUILDER 'C' GUI Program with OpenGL' as in figure-1 below and click on 'NEXT' in the Dialog Box.
  3. Select the 'PRODUCTS' Product Area in the Product Selection Dialog and click on 'OK' as in figure-2,
  4. Select 'MC-1' from the Product Area selection Combo Box ( figure-3 ) and click on the 'Next' button,
  5. In the New Project dialog enter the name of 'Sample' as in figure-4 and click on 'Build'.
  6. Once the Project is Built, close the project.
  7. 'Project>Close Project'
  8. Note that it will be stored in the 'GTKCGL' section of the 'MC-1' Product.
  9. Change directory to your new program ( that is '~/SIDE/PRODUCTS/MC1/GTKCGL3/Sample/src'  ).
  10.   and run the program in a terminal,  ( in my case that is 'db@wks1:~/Data/Projects/SIDE/PRODUCTS/MC1/GTKCGL3/Sample1/src$ ./sample1'  ).
  11.   Note: Do not forget the 'dot forward slash' which says look in the 'current' directory for the program.
  12. This brings up the program 'sample' as in figure-5 ( not much to see here as we have not yet created the OpenGL widget ).
  13. Look at the text behind the program ( a good place to start when something does not work as expected ) and see the startup output generated.

Draw3D_CheckForOpenGL, OpenGL is supported
Trying local 'glade' file
Local 'glade' file found!

(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_programQuitToolbutton_clicked'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_fileSaveAsToolbutton_clicked'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_fileSaveToolbutton_clicked'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_fileOpenToolbutton_clicked'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_fileOpenToolbutton_clicked'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_aboutMenuitem_activate'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_programQuitMenuitem_activate'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_saveFileAsMenuitem_activate'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_openFileMenuitem_activate'
(sample:13212): Gtk-WARNING **: Could not find signal handler 'on_newFileMenuitem_activate'

So as you can see the only 3D command is output from the function Draw3D_CheckForOpenGL
This function is in the libdraw3dS4L library added when the project was built by the IDE.
The function outputs that in this case that we have a working 3d environment!

Also note,

Now go down to Exercise-2.
 

Fig-1

Fig-2

Fig-3

Fig-4

Fig-5


Exercise-2: Re-open the new project and check on some files.
  1. ReOpen the newly created 'Sample' project 'Project>Open Project'  in the IDE.
  2. Note that it will be stored in the 'GTKCGL3' section of the 'MC-1' Product.
  3. Open 'main.c' in the Code Notebook of the IDE ( click on 'TXT' button in the Toolbar ).


Summary: Creating a new 3D Visual Project using side4linux and Glade-3
Note: Should you not succeed at this point in the Demo then look in SIDE/DEMOS/SIDEdemos/GTKCGL3/Sample
for a working copy of the
'sample' project.



Further reading: Check out the following book for some GTK+ programming references..


http://www.gtkbook.com/home.php



Foundations of GTK+ Development
by Andrew Krause

Publisher: Apress
Pub Date: April 2007
Print ISBN: 978-1-59059-793-4
Web ISBN: 1-59059-793-1
Pages: 630




Also you will need books on OpenGLtm



http://www.amazon.com

                                                                                         

OpenGL(R) Programming Guide: The Official Guide to Learning OpenGL(R), Version 2.1 (6th Edition) (Paperback)

You can read the old version on the web,

  http://www.glprogramming.com/red


Checkout the OpenGL website!




We will provide other demos as 'side4linux' develops to cover GTK+ visual programming and integration into a real world machine controller.

GUI interface made with Gtk and Glade GUI demo built with Glade