In older days I would create a TForm, place a TMyPanel on it (with overriden WM_PAINT message) and pass its Handle to a bunch of WGL functions that find a compatible pixelformat and create rendering context. Just like NeHe tutorials did it.
Now there comes FireMonkey application. How to get OpenGL 1.4 rendering context there that is working on Win and iOS?
EDIT: Been trying to make it to work by passing TForm.Handle (which is NativeUInt). Good news – no errors from OpenGL end, but bad news – no output on TForm either.. I’m obviously missing some critical piece here, does anyone has a working OpenGL in FireMonkey application?
After some investigations I have managed to create OpenGL context in FireMonkey on Windows platform. I don’t have access to iOS yet, but I’m sure something can be done there as well.
To the solution: add
FMX.Platform.Wintousesclause (might need to wrap it intoIFDEF‘s for iOS). Now we can useFmxHandleToHWND(Form1.Handle)to get validHWND. Thats it. On MacOS the same is done by addingFMX.Platform.Winand throughH_WND := FmxHandleToObjC(AHandle);call.