Click here to Skip to main content
13,408,987 members (44,794 online)
Click here to Skip to main content

Stats

64.7K views
6.6K downloads
87 bookmarked
Posted 30 Oct 2010

Writing a Platform and GUI Toolkit Independent OpenGL Class

, 1 Nov 2010
Article showing how to write OS and GUI toolkit portable OpenGL view class
basecode
linux
MultiGL
buildall.sh
GLView
GLViewGTKApp
.cproject
.project
aclocal.m4
AUTHORS
autogen.sh
autom4te.cache
output.0
output.1
requests
traces.0
traces.1
ChangeLog
config.guess
config.h.in
config.sub
configure
configure.in
COPYING
depcomp
glviewgtkapp.glade
glviewgtkapp.gladep
INSTALL
install-sh
Makefile.am
Makefile.in
missing
mkinstalldirs
NEWS
po
ChangeLog
Makefile.in.in
POTFILES.in
README
src
Makefile.am
Makefile.in
stamp-h.in
GLViewMotifApp
.cproject
.project
aclocal.m4
autom4te.cache
output.0
output.1
requests
traces.0
traces.1
config.h.in
configure
configure.ac
depcomp
install-sh
Makefile.am
Makefile.in
missing
src
Makefile.am
Makefile.in
GLViewQtApp
.cproject
.project
GLViewQtApp.ico
GLViewQtApp.pro
GLViewQtApp.pro.user
glviewqtapp.qrc
glviewqtapp.ui
Makefile
Resources
.cproject
.project
aclocal.m4
autom4te.cache
output.0
output.1
output.2
requests
traces.0
traces.1
traces.2
config.guess
config.h.in
config.sub
configure
configure.ac
depcomp
install-sh
ltmain.sh
m4
libtool.m4
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
Makefile.am
Makefile.in
missing
src
Makefile.am
Makefile.in
run.sh
win32
MultiGL
GLView
GLViewGTKApp
AUTHORS
autogen.sh
ChangeLog
configure.in
devcpp
glviewgtkapp.dev
glviewgtkapp.glade
glviewgtkapp.gladep
Makefile.am
msvc
glviewgtkapp.suo
NEWS
po
ChangeLog
POTFILES.in
README
src
Makefile.am
stamp-h.in
GLViewMFCDlgApp
GLViewMFCDlgApp.aps
res
GLViewMFCDlgApp.ico
GLViewMFCMDIApp
res
buttons.bmp
filelarge.bmp
filesmall.bmp
GLViewMFCMDIApp.ico
GLViewMFCMDIAppDoc.ico
main.bmp
Toolbar.bmp
Toolbar256.bmp
writelarge.bmp
writesmall.bmp
GLViewQtApp
GLViewQtApp
GLViewQtApp.ico
GLViewQtApp.pro
glviewqtapp.qrc
glviewqtapp.ui
Makefile
moc_glviewqtapp.o
Resources
GLView.cpp.bak
GLView.suo
MultiGL.suo
/*
 * Initial main.c file generated by Glade. Edit as required.
 * Glade will not overwrite this file.
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <gtk/gtk.h>

#include "interface.h"
#include "support.h"

gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR;


int
main (int argc, char *argv[])
{
  GtkWidget *MainWindow;

  gchar *pixmap_dir;
#ifdef G_OS_WIN32
  package_prefix = g_win32_get_package_installation_directory (NULL, NULL);
  package_data_dir = g_build_filename (package_prefix, "share", NULL);
  package_locale_dir =
    g_build_filename (package_prefix, "share", "locale", NULL);
#endif

#ifdef ENABLE_NLS
  bindtextdomain (GETTEXT_PACKAGE, package_locale_dir);
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain (GETTEXT_PACKAGE);
#endif

  gtk_set_locale ();
  gtk_init (&argc, &argv);

  pixmap_dir = g_build_filename (package_data_dir, PACKAGE, "pixmaps", NULL);
  add_pixmap_directory (pixmap_dir);
  g_free (pixmap_dir);


  /*
   * The following code was added by Glade to create one of each component
   * (except popup menus), just so that you see something after building
   * the project. Delete any components that you don't want shown initially.
   */
  MainWindow = create_MainWindow ();
  gtk_widget_show (MainWindow);
  g_signal_connect ((gpointer) MainWindow, "destroy",
		    G_CALLBACK (gtk_main_quit), NULL);

  gtk_main ();

#ifdef G_OS_WIN32
  g_free (package_prefix);
  g_free (package_data_dir);
  g_free (package_locale_dir);
#endif

  return 0;
}

#ifdef _MSC_VER
#include <windows.h>

int WINAPI
WinMain (HINSTANCE hInstance,
	 HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
  return main (__argc, __argv);
}
#endif

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Sharjith
Product Manager Mahindra & Mahindra
India India
Sharjith is a Mechanical Engineer with strong passion for Automobiles, Aircrafts and Software development.

You may also be interested in...

Pro
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.180221.1 | Last Updated 1 Nov 2010
Article Copyright 2010 by Sharjith
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid