Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-02

OpenGL conversion

11 messages · 6 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Unknown author
to Juha Manninen: Hi Are there any conversion guides or examples of how OpenGL Delphi program can be…

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"
Gesendet: Feb 13, 2011 7:12:48 PM
An: "Lazarus mailing list"
Betreff: [Lazarus] OpenGL conversion

Show quoted text 22 lines
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 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

Reply by email

Bo Berglund
to Juha Manninen: Hi Are there any conversion guides or examples of how OpenGL Delphi program can be…
Juha Manninen wrote 15 lines
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

Reply by email

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

Reply by email

Reimar Grabowski
to Juha Manninen
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?

Reply by email

Reimar Grabowski
to Bo Berglund: On Sun, 13 Feb 2011 20:12:48 +0200, Juha Manninen What about GLScene? Isn't that project…
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?

Reply by email

Juha Manninen
to Reimar Grabowski: On Sun, 13 Feb 2011 20:12:48 +0200 For OpenGL calls no conversion should be needed. GL…

Reimar Grabowski kirjoitti maanantai 14 helmikuu 2011 05:44:18:

Show quoted text 10 lines
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

Reply by email

Reimar Grabowski
to Juha Manninen
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?

Reply by email

Paul Nicholls
to Juha Manninen: Hi Are there any conversion guides or examples of how OpenGL Delphi program can be…

----- Original Message -----

Earlier message 35 lines
From: "Juha Manninen" To: "Lazarus mailing list" 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

Reply by email

Juha Manninen
to Paul Nicholls

Paul Nicholls kirjoitti tiistai 15 helmikuu 2011 04:40:12:

Show quoted text 5 lines
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

Reply by email

Juha Manninen
to Reimar Grabowski: On Mon, 14 Feb 2011 07:51:35 +0200 Should be no problem if the Lazarus prog shall only…

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. :-)

[...]

Show quoted text 7 lines
> 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.

[...]

Show quoted text 9 lines
> 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).

[...]

Show quoted text 9 lines
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

Reply by email