Cross Platform OpenGL -HOW??!!

Ok I am making my own game engine. But I am kinda stuck cause the problem of cross platform arises. How would I implement this in opengl? I mean dont you have to use VC++ to make windows in Windows 98/2000/XP etc. ?

-Aditya
Help!

Use GLUT (http://www.xmission.com/~nate/glut.html) for windows creation, keyboard, mouse or other inputs;
OpenIL (http://openil.sourceforge.net) for textures;
OpenAL (http://www.openal.org) or fmod (http://www.fmod.org) for sound

I know about glut but I have heard it is limited… so is there any other way? I mean in normal C++… oh another question… can we make windows in normal C++ as in not using VC++ but normal C++?

-Aditya
Thanks

SDL ( <-- Google! )

Aside from GLUT and SDL, GLFW is also a good choice.

thanks for all your replies but there must have been a way in which programmers in the past must have created windows without and libraries or anything… weren’t they crossplatform… so how any of you guys know know how those programmers did it?

-Aditya
Thanks

Those sorts of libraries are the only way, if you want to be cross-platform. If you don’t care, you can talk directly to Windows/X11/Mac OS X if that’s what you want to do.

thanks for all your replies but there must have been a way in which programmers in the past must have created windows without and libraries or anything… weren’t they crossplatform…

In short, no.

There are cross-platform window libraries like QT (www.trolltech.com) those can be compiled under Windows (with Visual C) and under Linux.
And you don’t need to use Visual C to develop under windows. You could use other compilers like borland, watcom or even gcc (with mingw or cygwin).
Just make shure u don’t use any special compiler features.

Lars

Originally posted by OneSadCookie:
Aside from GLUT and SDL, GLFW is also a good choice.

I havent touched those, but was intersted in wxWindows a little.

I ahve a question myself: how do you create menus, toolbars, dialog boxes with those libraries? Can they use VC++ resource file?

V-man

You don’t; they don’t generally provide that kind of functionality. If you want a standard UI, you need something like Qt or Tk, both of which also allow OpenGL integration.

Qt has its own GUI resource format (.ui), Tk creates its GUI elements from Tcl scripts.

What we did is to write a “Window” class for each OS that we run on. This class takes care of display mode switching, opening a window and initializing the GL for it. Once we have that window opened, we use our own GUI toolkit (OpenGL-based, developed in-house) to display the menus and other stuff that our app requires. We don’t rely on any external libraries whatsoever.

– Tom

The OpenGL is cross platform… the windows and widget are not OpenGL stuff… so are not cross platform. You must find a way to have windows and widgets cross platform (like SDL and GLUT) or t CHANGE this portion of code when porting.

Also you wont have VC++ in other platforms… but you wil have a better compiler (gcc 3.2)

Gtk2 or Gtkmm2 (great C++ wrapper) combined with Gtkglext (+Gtkglextmm when using Gtkmm2) and a nice looking Gtk2 theme engine (Gtk2 is very flexible with its theming capabilities) has also become pretty much a winner…

(the newest version of Gtk (2.2) is also much better supported on Windows now)

And it’s LGPL so that’s even better

(and more good news is that the ugly combobox/optionmenu will be rewritten for Gtk 2.4)

thanks all… I guess I have to port them and cant make the same program work on two different OSs… oh well

Thanks a lot again,
Aditya

Originally posted by OneSadCookie:
[b]You don’t; they don’t generally provide that kind of functionality. If you want a standard UI, you need something like Qt or Tk, both of which also allow OpenGL integration.

Qt has its own GUI resource format (.ui), Tk creates its GUI elements from Tcl scripts.[/b]

If it’s possible to create the resources inside an IDE, then that would be great. Otherwise, not much point in avoiding GLUT. I would prefer not to spend time writing scripts.

Also, I make use of MFC so it would be nice to have support for it on Linux. Dont laugh.

You can port MFC source code to linux if you want to. The source code comes with vc++6 standard and up. There’s Fox toolkit similar to MFC.
http://www.fox-toolkit.org/fox.html

I really hate MFC… so ugly … It would be more productive and INTELIGENT if windows had support for X server (not that X isnt ugly…it is. But it would cost less this way)

Originally posted by OldMan:
I really hate MFC… so ugly

Microsoftheaded F***ed-up Classes

Originally posted by OldMan:
I really hate MFC… so ugly … It would be more productive and INTELIGENT if windows had support for X server (not that X isnt ugly…it is. But it would cost less this way)

You do know that you’re comparing apples with banananas, do you?

And X isn’t that ugly anymore… especially the new xcursor from X 4.3.0 :stuck_out_tongue: