Platform independant OpenGL application.

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
Wodzu
Posts: 7
Joined: Fri Oct 30, 2009 11:18 am

Platform independant OpenGL application.

Post 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...
User avatar
Kjell
Posts: 1790
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
Wodzu
Posts: 7
Joined: Fri Oct 30, 2009 11:18 am

Post 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.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post 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.
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
Wodzu
Posts: 7
Joined: Fri Oct 30, 2009 11:18 am

Post by Wodzu »

Yes, I missed out the off-topic section. Sorry...
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post 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.
Attachments
OPENGL.gif
OPENGL.gif (160.45 KiB) Viewed 12259 times
"great expectations"
Wodzu
Posts: 7
Joined: Fri Oct 30, 2009 11:18 am

Post 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.
User avatar
VilleK
Site Admin
Posts: 2199
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
Wodzu
Posts: 7
Joined: Fri Oct 30, 2009 11:18 am

Post 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?
User avatar
Kjell
Posts: 1790
Joined: Sat Feb 23, 2008 11:15 pm

Post 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
User avatar
VilleK
Site Admin
Posts: 2199
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post 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.
Post Reply