Click here to Skip to main content
13,592,561 members
Click here to Skip to main content

Stats

67.3K views
6.7K downloads
87 bookmarked
Posted 30 Oct 2010
Licenced CPOL

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
GLView
GLViewGTKApp
.project
AUTHORS
autom4te.cache
output.0
requests
traces.0
ChangeLog
config.guess
config.h.in
config.sub
configure
configure.in
COPYING
depcomp
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
.project
autom4te.cache
output.0
requests
traces.0
config.h.in
configure
configure.ac
depcomp
install-sh
Makefile.am
Makefile.in
missing
src
Makefile.am
Makefile.in
GLViewQtApp
.project
GLViewQtApp.ico
GLViewQtApp.pro.user
glviewqtapp.qrc
Makefile
Resources
.project
autom4te.cache
output.0
requests
traces.0
config.guess
config.h.in
config.sub
configure
configure.ac
depcomp
install-sh
m4
Makefile.am
Makefile.in
missing
src
Makefile.am
Makefile.in
win32
MultiGL
GLView
GLViewGTKApp
AUTHORS
ChangeLog
configure.in
devcpp
glviewgtkapp.dev
glviewgtkapp.gladep
Makefile.am
msvc
glviewgtkapp.suo
glviewgtkapp.vcproj
NEWS
po
ChangeLog
POTFILES.in
README
src
Makefile.am
stamp-h.in
GLViewMFCDlgApp
GLViewMFCDlgApp.aps
GLViewMFCDlgApp.vcproj
res
GLViewMFCDlgApp.ico
GLViewMFCMDIApp
GLViewMFCMDIApp.vcproj
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.qrc
GLViewQtApp.vcproj
Makefile
moc_glviewqtapp.o
Resources
GLView.cpp.bak
GLView.suo
GLView.vcproj
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"

#ifdef G_OS_WIN32
gchar *package_prefix = PACKAGE_PREFIX;
gchar *package_data_dir = PACKAGE_DATA_DIR;
gchar *package_locale_dir = PACKAGE_LOCALE_DIR;
#endif

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 | Cookies | Terms of Use | Mobile
Web04 | 2.8.180618.1 | Last Updated 1 Nov 2010
Article Copyright 2010 by Sharjith
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid