PDA

View Full Version : crossplatform opengl programming



05-05-2004, 10:19 AM
im new to this, i want to create a window with 3d content that would be able to be used on any platform windowsXX linux mac whatever.
-my- pc is windows millenium (Me).., so, do i read the windows installation and use it? is that installation used to create windows only application? you can notice im a bit confused here.
would you mind posting a step by step 'tutorial' from installing to coding, compiling and executing a crossplatform program that uses opengl (maybe a link to a tutorial that explains that).
Im mostly interested on not having to rewrite the code to use it on another OS.

chowe6685
05-05-2004, 10:28 AM
to make something crossplatform you need to use only crossplatform tools in your source. This means things like OpenGL, OpenAL, SDL whatever and you will have crossplatform source code. The executable itself cannot be crossplatform, it will need to be recompiled for a given OS. That is my understanding of it, anyone who knows better feel free to correct me.

05-05-2004, 11:02 AM
yes, it has to be recompiled. Where can i find a list of crossplatform tools (general) if any?

nexusone
05-05-2004, 03:13 PM
Programming in C/C++ is good place to start since it is a standard. Just becareful if you use compiler like Microsoft Visual C++, not to use some of its non-standarded C/C++ functions in your program.

Another compiler option for windows is to use something like the DEV-C++ since it comforms to the C/C++ standard.

As the other poster suggested, the following have Windows, Mac and Linux support:

GLUT library // open window, mouse, keyboard support
SDL library www.libsdl.org (http://www.libsdl.org) // open window, mouse, keyboard, joystick, sound

QT library www.trolltech.com (http://www.trolltech.com) // GUI, window, etc.

www.openAL.org (http://www.openAL.org) // Sound library
www.openML.org (http://www.openML.org) // Video/Audio stream library


Originally posted by <newbie>:
yes, it has to be recompiled. Where can i find a list of crossplatform tools (general) if any?

05-06-2004, 07:00 AM
Unless you want to consider writing your application in Java? Take a look at the following:

http://www.puppygames.net/downloads/alienflux-full.jnlp

(This is a Webstart link for convenience - you could distribute as a number of Jar archives instead.)

The same binary distribution works on Windows, Mac and Linux. The native OpenGL binding for all three platforms is included, and the binding works out what to use at run-time. The user code is written in pure Java, and compiled to bytecode.

Obli
05-07-2004, 12:51 AM
Originally posted by chowe6685:
to make something crossplatform you need to use only crossplatform tools in your source. This means things like OpenGL, OpenAL, SDL whatever and you will have crossplatform source code.GL itself is very nice. It can compile without changing a single line of code, not even looking at it and get nice results.
SDL is also very portable: I took just a glance at it but looks fine.
AL has a ton of problems with portability. Really. Looks like there will be a AL1.1 spec very soon, I just hope this will fix that.

Originally posted by chowe6685:
The executable itself cannot be crossplatform, it will need to be recompiled for a given OS.True. This does not apply to some languages or if the executable runs in a sandbox but it's usually true.


Originally posted by <newbie>:
i want to create a window with 3d content that would be able to be used on any platform windowsXX linux mac whatever.This is where SDL shines. I raccomand SDL overrall because it got pretty everything you need if you are a beginner (GLUT for example, only handles graphic, menus and some input).

Originally posted by <newbie>:
-my- pc is windows millenium (Me)Bad because this OS is obsolete. There are some slight API differences between win9x and NT. Also, some CPU features may be missing (this should not be a problem for you anyway)

Originally posted by <newbie>:
is that installation used to create windows only application?I don't even understand what file you're referring to.

Originally posted by <newbie>:
Im mostly interested on not having to rewrite the code to use it on another OS.Bad luck. This is not possible in C/C++. At best, you have to wraparound some calls which have slight differences between the OSs to conditionally compile. Typical examples: getcwd and chdir behave somewhat different. Returned strings ARE different, but since the win32 API handles paths in the unix fashion (using '/' as separators) quite nicely, it's usually better to use the unix convention independently from the OS (so I have a small conditional piece of code which changes all the '\\' to '/').