[Lazarus] OpenGL conversion

Reimar Grabowski reimgrab at web.de
Mon Feb 14 16:23:24 CET 2011


On Mon, 14 Feb 2011 07:51:35 +0200
Juha Manninen <juha.manninen62 at gmail.com> 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?




More information about the Lazarus mailing list