Page 1 of 1

Platform independant OpenGL application.

Posted: Sat Mar 27, 2010 10:05 am
by Wodzu
Hello guys!

My question should go directly to the Ville but maybe others will help me too :)

However, this is not question related to the Z-Game Editor... I am reading a lot here on forum about the Editor since Ville announced it for the first time on the PGD website (3-4 years ago? ) but never created any resonable application with it. I am more like silent kibitzer :)

I like to programming games a lot but for the past years I was doing a lot in 2D and DirectX, now I've switched to the OpenGL due to the cross-platform reason.

I would like to ask you Ville how did you created a general sceleton OpenGL application. How should look like the main loop and how do you handle mouse and keyboard events. Is it done automatically by the Free Pascal?

Could you give a little example of this? I know that this is a bit off topic...

Anyway, thanks for your time and keep a good work! :)

Regards...

Posted: Sat Mar 27, 2010 10:43 am
by Kjell
:roll:

ZGameEditor is open-source, so you can see how everything is done for yourself. To answer your "main loop" question .. Win32 native + SDL based Mac / Linux.

K

Posted: Sat Mar 27, 2010 11:03 am
by Wodzu
Thanks for the answer.

There is no need to use SDL if you use FPC.

I know I can browse for the source but I was hoping for a bare simple example.

Posted: Sat Mar 27, 2010 11:38 am
by kattle87
maybe this was more appropriate for the "off topic" section of the forum...
However here there are no expert pascal developer except for Ville, you might ask him for the websites he learned from, might be a better idea.
Anyway, let's just wait for him to answer here now, no need to spam him with PMs too.

Posted: Sat Mar 27, 2010 12:30 pm
by Wodzu
Yes, I missed out the off-topic section. Sorry...

Posted: Sat Mar 27, 2010 3:47 pm
by y offs et
If you install Lazarus and run the example ...openglcontrol/openglcontrol_demo.lpi

you get this, with all the open source files, of course. I make no claim to expertise, and also Lazarus is comparable to Delphi 7, and Villek is now using Delphi 2010.

Posted: Sat Mar 27, 2010 3:55 pm
by Wodzu
Thank you.

I know about GLScene. The thing is that I wanted bare skeletonal program. I know I can analyse the source and probably I would have to do that anyway...

Don't get me wrong, I am not lazy;). I just wanted to learn without disstraction caused be other things in the surce.

Posted: Sat Mar 27, 2010 4:33 pm
by VilleK
If you want to go cross platform then Freepascal + SDL + OpenGL is a good choice.

I can hardly remember how I got started with OpenGL anymore, but I know that the NeHe-tutorials are good. I still visit those tutorials for examples on how to use a specific OpenGL feature.

For instance "Lesson 1: Setting Up An OpenGL Window". Each tutorial has got a Delphi-version to download at the end of the page.

Posted: Wed May 05, 2010 7:02 am
by Wodzu
VilleK wrote:If you want to go cross platform then Freepascal + SDL + OpenGL is a good choice.

I can hardly remember how I got started with OpenGL anymore, but I know that the NeHe-tutorials are good. I still visit those tutorials for examples on how to use a specific OpenGL feature.

For instance "Lesson 1: Setting Up An OpenGL Window". Each tutorial has got a Delphi-version to download at the end of the page.
Yes but SDL makes my program dependant from some external DLL.
NeHe tutorials are Windows-specific so it is not good either.

However you were saying that you crosscompile ZGame Editor so you have platform independant working keboards events without need of external dll But probably you have relied on the Lazarus in this case?

Posted: Wed May 05, 2010 1:42 pm
by Kjell
:?

This has been mentioned before .. ZGameEditor doesn't require any external files on Windows, but it does need SDL.dll on Mac / Linux.

http://zgameeditor.org/index.php/Howto/GenCrossPlatform

Take a look at the SDL source how it handles Mac / Linux window creation and events natively.

K

Posted: Wed May 05, 2010 2:01 pm
by VilleK
Look at the end of every NeHe-tutorial, there are ports to many platforms including Linux and Mac in different configurations:

http://nehe.gamedev.net/data/lessons/le ... ?lesson=02

The SDL is a very popular library and is used in many applications such as emulators and games. So there are good chances that it is already installed on a computer.

I use the SDL for window setup, keyboard, joystick, mouse, audio etc. It removes the need for anything platform specific and saves lots and lots of development time.