[Lazarus] OpenGL conversion

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] OpenGL conversion

Juha Manninen
Hi

Are there any conversion guides or examples of how OpenGL Delphi program can
be converted to Lazarus.
I would try to automate it with Delphi converter but I don't know much about
graphics programming myself.

I am testing the converter with DeleD 3-D program which would be an extremely
cool porting project.

On January Birger Jansen wrote:
  Project conversion Delphi -> FreePascal: success!
which mentions OpenGL so it seems to be possible.


Juha

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Corpsman

I succesfully ported my Ballanced Game from Delphi OpenGL to Lazarus OpenGL ( Linux, Win compatible )

but i had to do many things by hand.

Maybe my [url=http://corpsman.de/index.php?doc=opengl/clear_engine]Clear Engine[/url] sample could give you a little hint to succesfully port your Application.

Here i use the TOpenGLControl component which is part Lazarus ( only need to be installed with the package graph )


sincerely

Corpsman

-- 

Auf meiner Homepage www.Corpsman.de ist immer was los, ständig wird sie aktualisiert und erweitert. Da ist für jeden was dabei.

-----Ursprüngliche Nachricht-----
Von: "Juha Manninen" <[hidden email]>
Gesendet: Feb 13, 2011 7:12:48 PM
An: "Lazarus mailing list" <[hidden email]>
Betreff: [Lazarus] OpenGL conversion

>Hi
>
>Are there any conversion guides or examples of how OpenGL Delphi program can
>be converted to Lazarus.
>I would try to automate it with Delphi converter but I don't know much about
>graphics programming myself.
>
>I am testing the converter with DeleD 3-D program which would be an extremely
>cool porting project.
>
>On January Birger Jansen wrote:
>  Project conversion Delphi -> FreePascal: success!
>which mentions OpenGL so it seems to be possible.
>
>
>Juha
>
>--
>_______________________________________________
>Lazarus mailing list
>[hidden email]
>http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

___________________________________________________________
Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
Toolbar eingebaut! http://produkte.web.de/go/toolbar

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Bo Berglund
In reply to this post by Juha Manninen
On Sun, 13 Feb 2011 20:12:48 +0200, Juha Manninen
<[hidden email]> wrote:

>Hi
>
>Are there any conversion guides or examples of how OpenGL Delphi program can
>be converted to Lazarus.
>I would try to automate it with Delphi converter but I don't know much about
>graphics programming myself.
>
>I am testing the converter with DeleD 3-D program which would be an extremely
>cool porting project.
>
>On January Birger Jansen wrote:
>  Project conversion Delphi -> FreePascal: success!
>which mentions OpenGL so it seems to be possible.
>
>

What about GLScene? Isn't that project restarted and with FPC/Lazarus
support?
http://wiki.lazarus.freepascal.org/GLScene


--
Bo Berglund
Developer in Sweden


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Reimar Grabowski
In reply to this post by Juha Manninen
On Sun, 13 Feb 2011 20:12:48 +0200
Juha Manninen <[hidden email]> wrote:

> Hi
>
> Are there any conversion guides or examples of how OpenGL Delphi program can
> be converted to Lazarus.
For OpenGL calls no conversion should be needed. GL works the same independent of language/OS (except context handling and some OS-specific extensions WGL_*, GLX_*, etc.).
OpenGL is just a bunch of commands which go directly to the graphics driver.

> I would try to automate it with Delphi converter but I don't know much about
> graphics programming myself.
Just go ahead. If you have any problems ask again. I know a thing or two about OpenGL and graphics programming in general.

R.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Reimar Grabowski
In reply to this post by Bo Berglund
On Sun, 13 Feb 2011 18:39:37 +0100
Bo Berglund <[hidden email]> wrote:


> What about GLScene? Isn't that project restarted and with FPC/Lazarus
> support?
> http://wiki.lazarus.freepascal.org/GLScene

GLScene <> pure OpenGL
If the Delphi code uses GLScene, you need it on Lazarus as well. If it does not, GLScene does not help.

R.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Juha Manninen
In reply to this post by Reimar Grabowski
Reimar Grabowski kirjoitti maanantai 14 helmikuu 2011 05:44:18:

> For OpenGL calls no conversion should be needed. GL works the same
> independent of language/OS (except context handling and some OS-specific
> extensions WGL_*, GLX_*, etc.). OpenGL is just a bunch of commands which
> go directly to the graphics driver.
>
> > I would try to automate it with Delphi converter but I don't know much
> > about graphics programming myself.
>
> Just go ahead. If you have any problems ask again. I know a thing or two
> about OpenGL and graphics programming in general.

DeleD has types and functions defined only on Windows.
At least types:
 HGLRC
 PixelFormatDescriptor

and functions:
 wglMakeCurrent
 wglDeleteContext
 wglCreateContext
 wglUseFontBitmaps
 wglUseFontOutlines
 SwapBuffers
 ZeroMemory
 ChoosePixelFormat
 SetPixelFormat
 ActivateRenderingContext

There are more...

Juha

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Reimar Grabowski
On Mon, 14 Feb 2011 07:51:35 +0200
Juha Manninen <[hidden email]> wrote:

> DeleD has types and functions defined only on Windows.
Should be no problem if the Lazarus prog shall only run on windows. ;)

> At least types:
>  HGLRC
>  PixelFormatDescriptor
AFAIR HGLRC is not needed on other platforms and the PFD must be ported depending on the OS specific 'glue-library' for example GLX on Linux.
 
> and functions:
>  wglMakeCurrent
>  wglDeleteContext
>  wglCreateContext
There are equivalent functions for other platforms glxMakeCurrent etc. (This is context handlig stuff)

>  wglUseFontBitmaps
>  wglUseFontOutlines
Not available on other platforms. Can not be ported. You need to emulate these functions (with freetype you should be able to code a multi platform solution). Better replace them with a different text-output function. (Not that easy)

>  SwapBuffers
Should call wglSwapBuffers and belongs to the context handling stuff.

>  ZeroMemory
Don't know what it does.

>  ChoosePixelFormat
>  SetPixelFormat
Needs to be done on context creation and is platform dependend. TOpenGLControl does this for you in Lazarus but AFAIR it is not very flexible regarding the PixelFormat. That is no problem if the Delphi program does not do anything fancy (for example initializing an akkumulation buffer or such nonsense).

>  ActivateRenderingContext
Don't know what it does.

> There are more...
So if automatic conversion shall be achieved the converter must know about the platform dependent differences and have functions in place to replace the windows stuff. That is not easy to achieve especially without OpenGL knowledge.
Perhaps you want to take a look at $LazarusDir/components/opengl/examples. You will see that the context handling is taken care of by TOpenGLControl so you don't need most of the windows functions you named.
I fear at the moment the only way to port the program is by hand.

R.
--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Paul Nicholls
In reply to this post by Juha Manninen
----- Original Message -----
From: "Juha Manninen" <[hidden email]>
To: "Lazarus mailing list" <[hidden email]>
Sent: Monday, February 14, 2011 5:12 AM
Subject: [Lazarus] OpenGL conversion


> Hi
>
> Are there any conversion guides or examples of how OpenGL Delphi program
> can
> be converted to Lazarus.
> I would try to automate it with Delphi converter but I don't know much
> about
> graphics programming myself.
>
> I am testing the converter with DeleD 3-D program which would be an
> extremely
> cool porting project.
>
> On January Birger Jansen wrote:
>  Project conversion Delphi -> FreePascal: success!
> which mentions OpenGL so it seems to be possible.
>
>
> Juha
>

Hi Juha,
  IIRC, Freepascal/Lazarus uses the units GL.pas, and GLU.pas as opposed to
Delphi's OpenGL.pas.

I think this is correct, and I hope this helps :)

cheers,
Paul


--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Juha Manninen
Paul Nicholls kirjoitti tiistai 15 helmikuu 2011 04:40:12:
> Hi Juha,
>   IIRC, Freepascal/Lazarus uses the units GL.pas, and GLU.pas as opposed to
> Delphi's OpenGL.pas.
>
> I think this is correct, and I hope this helps :)

Hi

Yes, that is the easy part.
Delphi converter in Lazarus already replaces the unit names automatically.
The problem comes with Windows specific types and calls.

Juha

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Juha Manninen
In reply to this post by Reimar Grabowski
Reimar Grabowski kirjoitti maanantai 14 helmikuu 2011 17:23:24:
> > DeleD has types and functions defined only on Windows.
>
> Should be no problem if the Lazarus prog shall only run on windows. ;)

No, it must run on many platforms. Otherwise it makes no sense to port it.
At least I wouldn't be interested in such port. :-)

[...]
> >  wglUseFontBitmaps
> >  wglUseFontOutlines
>
> Not available on other platforms. Can not be ported. You need to emulate
> these functions (with freetype you should be able to code a multi platform
> solution). Better replace them with a different text-output function. (Not
> that easy)

FreeType. I could ask from DeleD forum if they have an idea how to convert
such code.

[...]
> >  ChoosePixelFormat
> >  SetPixelFormat
>
> Needs to be done on context creation and is platform dependend.
> TOpenGLControl does this for you in Lazarus but AFAIR it is not very
> flexible regarding the PixelFormat. That is no problem if the Delphi
> program does not do anything fancy (for example initializing an
> akkumulation buffer or such nonsense).
>
[...]
>
> So if automatic conversion shall be achieved the converter must know about
> the platform dependent differences and have functions in place to replace
> the windows stuff. That is not easy to achieve especially without OpenGL
> knowledge. Perhaps you want to take a look at
> $LazarusDir/components/opengl/examples. You will see that the context
> handling is taken care of by TOpenGLControl so you don't need most of the
> windows functions you named. I fear at the moment the only way to port the
> program is by hand.

I guess TOpenGLControl could work with Delphi, too.
The preferred way to port would be to support both Delphi and Lazarus with the
same code base. If it gets too difficult then they must be separated.

Juha

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] OpenGL conversion

Mattias Gaertner
On Tue, 15 Feb 2011 10:14:33 +0200
Juha Manninen <[hidden email]> wrote:

>[...]
> I guess TOpenGLControl could work with Delphi, too.

Feel free to create a VCL backend.
A QT backend is missing too.


Mattias

--
_______________________________________________
Lazarus mailing list
[hidden email]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus