opengl viewport in Mac with FMX delphi - macos

I have designed an application in Delphi FMX that uses a new component based on class TPresentedControl. This component presents the output of opengl functions. (something like drawing in a viewport with opengl).
In Windows application runs successfully, but in MacOS it runs without this opengl viewport.
You can see a relative discussion here: https://forums.embarcadero.com/thread.jspa?threadID=248299
Do I have to use NSOpenGLView instead of my component?
If not what other options do i have?

For whoever is interested,
in GitHub (https://github.com/tothpaul/Firemonkey/tree/master/GLPanel) a developer named Friedrich Westermann
opened a new pull request for Pauls Toth' code in which he wrote a new part with code for Mac and also some changes to the existed.
I have tested it and works perfectly on Mac.

Related

Configure platform page with platform specific options

We've begun evaluating Xamarin for a up and coming project involving both iOS and Android, with the overriding intention to produce a single UI layer (and some share code, obviously) (I'm also new to C#)
TL;DR
I've begun exploring Xamarin on iOS. I started with the Phoneword example and it worked well enough.
The first issue I found was running the code on the iPhone X, which I was able to solve by using MainPage.On<Xamarin.Forms.PlatformConfiguration.iOS>().SetUseSafeArea(true); in the platform App class
While testing this, I noticed some issues with the ListView not scrolling properly (the core issue was actually with the platform padding).
I then used (MainPage as Xamarin.Forms.NavigationPage).On<iOS>().EnableTranslucentNavigationBar(); to enable translucent navigation bars (as we're targeting iOS 11+) and now everything appears under the navigation bar.
This is easily fixed in xCode and after some research I've found that I need to be using UIKit.UIViewController.EdgesForExtendedLayout Property, the immediate problem I'm facing is, the only "snippets" of code I can find are from the View is displayed under status bar in iOS 7 and EdgesForExtendedLayout doesn't help forum post.
Issue at hand...
The example solution snippets posted seem to be making use of a platform (iOS) specific solution. The problem is, I want to keep using the "cross-platform" code in the "platform" project and simply provide some custom configuration for the iOS platform which can apply these states.
I understand it could be possible to use a renderer, but this seems to counter-interactive, as I'd need one for both iOS and Android, where the platform page is doing just fine as it.
I understand that I could setup a DependencyService, but this seems annoying to have to include a specific "configuration" service just to solve this issue for iOS
I was hoping it might be possible to setup a iOS Page which would "override" some of the functionality of the platform page and would allow me to make use of things like viewDidLoad so I can apply the iOS specific configurations on a page by pages bases, so we could keep the platform page as it, but when running under iOS, it would provide me access to iOS life cycle of the actual view...
I've been trying to search the documentation and tutorials and haven't yet come across anything which would seem to do this or something similar (not to say there isn't one, but I'm just not finding it).

GTK3 + OpenGL for windows: multiple GtkGLArea (ie. OpenGL contexts)

I am developing a GTK3 based application with OpenGL windows created using the GtkGLArea widget, to build the application on windows I use the msys2 64 bits system.
No problem to build the application, it works just with a single OpenGL window.
However my program is designed to handle multiple projects, and hence GtkGLarea, one for each project. This works perfectly for Linux.
However on window, it works with one GtkGLArea, but as soon as more than one are used only a single one (the first to be created) remains active, and no information is displayed in the other windows. If I click on any of the other windows then the content of the first window is updated with what should appear in the window I am interacting with ...
I noticed that I could open as many instances of my program each with one GtkGLAera working just fine, and therefore that the number of OpenGL context is not a problem, only the interaction / dialog / management within the same occurrence of my program is.
Is there any way to correct this behavior and how ?
Looks like it's a known GDK Win32 bug that has been fixed.
Bugzilla bug #789213
You should use wglMakeCurrent() analog to set current context, and after usage you should call wglMakeCurrent(NULL, NULL) to release context so the other widget will be able to use OpenGL.

Displaying pdf files using the PDFKit interface

I am working on a Mac OS 10.12, and have an application to display pdf files using the PDFKit interface.
But I encountered the following issues
Set pdf document to PDFView, in original OS,e.g. OS10.11 , there will invoke PDFView->drawPage() function, but in OS10.12,the function is not invoked;
PDFView can't draw pdf annotation in OS10.12;
Solution to the above will be appreciated
I reckon this is either a straight out bug or an as yet undocumented API change. I logged this as a bug (27666426) and can see now that it is being flagged as an open duplicate (27668895).
Note that of 10.12 Beta 6 -drawWithBox:toContext: gets called in place of the now deprecated -drawWithBox:. Note that it is also necessary to use the passed in context for all drawing.
UPDATE:
However things do not seem that simple with the 10.12 now that it is released. I find that my PDF view printing, which is driven off of -drawWithBox: on 10.11 and -drawWithBox:toContext: on 10.12+ is broken.
Stepping through the assembler I can see that 10.12, when printing, now calls -drawWithBox:inContext: not -drawWithBox:toContext: or -drawWithBox: (as was the case on 10.11). It would seem that the inContext: selector has been around a while.
It would seem that the only solution that works on 10.9 - 10.12 for both screen and print renders is to use the undocumented -drawWithBox:inContext:.

CGrafPtr to WindowRef

NPAPI in MacOs gives me CGrafPtr in NPWindow structure, I need a WindowRef.
Is there a way to get WindowRef from CGrafPtr ?
Thanks!
NPAPI only gives you a CGrafPtr if you are using the very, very deprecated QuickDraw drawing model (with Carbon event model). Writing a new plugin using the QuickDraw model would be a terrible idea: Firefox 64-bit doesn't support it, Safari 64-bit doesn't support it, and Chrome doesn't really support it (and soon won't at all). Your plugin wouldn't work for most users.
Instead, you should be using either Core Animation (drawing) + Cocoa (event), or CoreGraphics + Cocoa. In the Cocoa event model there is, deliberately, no way to get a reference to the browser window. Modern browsers almost all run plugins in a separate process, and you can't reference windows across processes.
In short, if you are trying to make a new NPAPI plugin that requires access to the browser window, your design is wrong.

Silverlight 5: 3D with XNA on Macintosh

I have acutaly access to an closed beta of an online application developed with silverlight 5. Within there's a feature, showing some 3D scenes. There have been used XNA for the 3D. From a windows-pc all work fine. But when I test it from an Mac with OSX the Silverlight-App works fine, too. But not the 3D feature. In upper left corner there's a information showing: "Render Mode: Unavailable" and "Reason: "Not3DCapable".
So I pushed this example to my IIS. This time from Windows all is fine but when trying to access from OSX (Firefox) it starts to load Silverlight but after showing 100% nothing happens. The scene is not shown.
Does anyone has any clue, what to do to support mac?
Unfortunately I found some other websites like this Blog (see the 3. FAQ) and this Blog (see comments) whose say the same: 3D doesn't work on mac.
Sadly Microsoft seems to keep this fact officially secret. Found this Page where I had expected to read something like "3D not supported". Isn't this sad? I thought Silverlight should be platform independent? I hope they will change their mind and add a support for OpenGL or something like that.

Resources