PDA

View Full Version : Cross Platform OpenGL -HOW??!!



adityagaddam
12-21-2002, 10:59 AM
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!

morbac
12-21-2002, 11:57 AM
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

adityagaddam
12-21-2002, 12:13 PM
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

richardve
12-21-2002, 12:49 PM
SDL ( <-- Google! )

OneSadCookie
12-21-2002, 02:17 PM
Aside from GLUT and SDL, GLFW is also a good choice.

adityagaddam
12-21-2002, 05:43 PM
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

OneSadCookie
12-21-2002, 06:27 PM
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.

NordFenris
12-21-2002, 07:06 PM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Lars
12-22-2002, 04:28 AM
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

V-man
12-22-2002, 07:48 AM
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

OneSadCookie
12-22-2002, 12:20 PM
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.

Tom Nuydens
12-22-2002, 11:35 PM
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

OldMan
12-22-2002, 11:59 PM
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)

richardve
12-23-2002, 12:17 AM
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 http://www.opengl.org/discussion_boards/ubb/smile.gif

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

adityagaddam
12-23-2002, 04:44 AM
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

V-man
12-23-2002, 09:56 AM
Originally posted by OneSadCookie:
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.

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.

JD
12-23-2002, 09:18 PM
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

OldMan
12-23-2002, 11:15 PM
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)

MZ
12-24-2002, 05:24 AM
Originally posted by OldMan:
I really hate MFC.. so ugly
Microsoftheaded F***ed-up Classes http://www.opengl.org/discussion_boards/ubb/wink.gif

richardve
12-24-2002, 06:09 AM
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 :P

nukem
12-24-2002, 09:38 PM
I program on linux but Ive made my engine so it should be cross plant-form(havnt test it yet since I dont have win****) Im using glut currently im going to move to SDL. I programmed most of my own stuff so I wouldnt have to use any linux api. I made a bmp, tga, pcx, md2, md3, mdl, ms3d reader. Its not hard just takes some time.

Nervus
12-28-2002, 12:17 PM
You can take a look at the GLUT sourcecode and see how they create their windows...

it's something with XOpenDisplay , XCreateWindow, etc... http://www.opengl.org/discussion_boards/ubb/smile.gif


Have fun

OldMan
12-29-2002, 10:57 AM
Originally posted by richardve:
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 :P


I agree I may be alittle outdated.. Last time I studied X was with Xfree 3.4.something

But I am sure MFC is still uglier..nothing cam be uglier.