I am trying to set up some very simple graphic windows which I also have to use on MacOS version Big Sur unfortunately. I am using the F# programming language and the OpenTK package.
This is the code I have at the moment.
open OpenTK.Windowing.Desktop
open OpenTK.Mathematics
open OpenTK.Windowing.Common
open OpenTK.Graphics
[<EntryPoint>]
let main argv =
let prof = ContextProfile.Compatability
let windowSettings = NativeWindowSettings()
windowSettings.Size <- Vector2i(800, 600)
windowSettings.Title <- "OpenTK Window"
windowSettings.Profile <- prof
windowSettings.APIVersion <- Version "3.3"
use window = new GameWindow(GameWindowSettings.Default, windowSettings)
//window.MakeCurrent()
//window.Run ()
0
Whenever I run this I get:
Unhandled exception. OpenTK.Windowing.GraphicsLibraryFramework.GLFWException: NSGL: The targeted version of macOS only supports forward-compatible core profile contexts for OpenGL 3.2 and above
at OpenTK.Windowing.Desktop.GLFWProvider.<>c.<.cctor>b__5_0(ErrorCode errorCode, String description)
I have tried every single configuration possible but I am stumped, is there anyone that can give me a pointer on how to set the compatibility for this?
Change this
let prof = ContextProfile.Compatability
to
let prof = ContextProfile.Core
Related
I use PyGObject/PyGI and GStreamer to show a video in my GUI. The video is shown in a Gtk.DrawingArea and therefore I need to get it's window-handle in the realize-signal-handler. On Linux I can simply use drawing_area.get_property('window').get_xid() and on Windows I have to access the C-API (like described here):
drawingarea_window = drawingarea.get_property('window')
ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p
ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object]
drawingarea_gpointer = ctypes.pythonapi.PyCapsule_GetPointer(drawingarea_window.__gpointer__, None)
gdkdll = ctypes.CDLL ('libgdk-3-0.dll')
self._drawingarea_handle = gdkdll.gdk_win32_window_get_handle(drawingarea_gpointer)
Now I want the same on MacOS. Since it is not using X11, but Quartz, I tried to use the C-API again. But this time to call gdk_quartz_window_get_nswindow instead of gdk_win32_window_get_handle (see gdkwindow-quartz.c):
// ... same lines as in Windows-example
gdkdll = ctypes.CDLL ('libgdk-3.0.dylib')
self._drawingarea_handle = gdkdll.gdk_quartz_window_get_nswindow(drawingarea_gpointer)
But this leads just to a Segmentation fault: 11.Any ideas on how to get the handle on MacOS?
I'm using Xcode 7 Beta 3 and reading through Swift 2.2 document. I'm trying to compile this example found in the Basics section of the document:
let possibleNumber = "123"
let convertedNumber = Int(possibleNumber)
It is supposed to convert a string into an optional int. However Xcode gives the error:
Cannot call value of non-function type 'int'
I was working on Xcode 7.2.1, then I knew that Swift 2.2 is packaged with Xcode 7.3 Beta 3, so I downloaded that to try, but the same error happens.
So, is the document wrong? and how to achieve the string into int conversion?
There is nothing wrong with your code, I tested and ran your exact code in Xcode 7.2:
let possibleNumber = "123"
let convertedNumber = Int(possibleNumber)
print("\(convertedNumber)")
It complied, ran within an app of mine, and printed the Int value 123.
Perhaps the error is being thrown from another area of code in your Xcode app, other then the code you think is throwing the error....
Perhaps you are not referencing the version of Swift you think you are...
Note, you should use if let with any conversion attempt:
if let convertedNumber = Int(possibleNumber) {
}
The if let should be used for a conversion no matter how remote the possibility of failure.
In IOS 8 AVSpeechUtterance is Not Working. Every time I use AVSpeechSynthesizer along with AVSpeechUtterance, I get "Speech initialization error: 2147483665". The same code works fine for IOS 7.1 I have a very large text to convert to speech, and using Google TTS won't allow me to use more than 100 characters at a time. How can I implement text-to-speech in IOS 8? Any help will be appreciated.
See this topic, and linked question also: AVSpeechSynthesizer iOS 8 Issues
For me, TTS on iOS work only on real device, not simulator. But iOS8 still have some problems with voices, some workaround mentioned in questions above.
Also, please mention this (user should set some settings): Using AVSpeechSynthesizer/AVSpeechUtterance for Text-To-Speech will not work if SpeakSelection is not enabled in device's Accessiblity settings
First import Speech
import Speech
Secondly define global variable for AVSpeechSynthesizer
let speakTalk = AVSpeechSynthesizer()
Create function Audio to take input as string
func Audio(Input : String)
{
let speakText = AVSpeechUtterance(string: "\(Input)")
speakText.rate = 0.5
speakText.pitchMultiplier = 1.7
speakTalk.speak(speakText)
}
call func Audio()
Audio(Input : "Hello")
I'm working on EPOS pos printer (EPOS TM-T88III). İ stalled it's driver, EPOS ADK and POS for .NET I can get print from my pos printer with PrintDocument function but i want to use EPOS ADK. I try its "Hello OPOS for .NET" sample but it's not work.
Because,
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName)
m_Printer = posExplorer.CreateInstance(deviceInfo)
i can get deviceInfo but, posExplorer.CreateInstance(deviceInfo) returns nothing. Icant solve this problem.
How can i solve this problem to succeed returns something from posExplorer.CreateInstance(deviceInfo) or is there anyway or sample code to use EPOS ADK to print something.
you have to tpyecast it to PosPrinter. that is the correct method.
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo)
For samples: You will get many sample applications when you install the OPOS for .net ADK for EPSON. You can find those in your installation directory.
Also check your OS version and IDE used, the object initialization for PosPrinter wont happen for some OS and IDEs.
You can use
SelectFolder() to get a folder
or
GetOpenFolderitem(filter as string) to get files
but can you select either a folder or file? ( or for that matter selecting multiple files )
The MonkeyBread plugin allows this in the OpenDialogMBS class.
http://www.monkeybreadsoftware.net/pluginhelp/navigation-opendialogmbs.shtml
OpenDialogMBS.AllowFolderSelection as Boolean
property, Navigation, MBS Util Plugin (OpenDialog), class OpenDialogMBS, Plugin version: 7.5, Mac OS X: Works, Windows: Does nothing, Linux x86: Does nothing, Feedback.
Function: Whether folders can be selected.
Example:
dim o as OpenDialogMBS
dim i,c as integer
dim f as FolderItem
o=new OpenDialogMBS
o.ShowHiddenFiles=true
o.PromptText="Select one or more files/folders:"
o.MultipleSelection=false
o.ActionButtonLabel="Open files/folders"
o.CancelButtonLabel="no, thanks."
o.WindowTitle="This is a window title."
o.ClientName="Client Name?"
o.AllowFolderSelection=true
o.ShowDialog
c=o.FileCount
if c>0 then
for i=0 to c-1
f=o.Files(i)
FileList.List.AddRow f.AbsolutePath
next
end if
Notes:
Default is false.
Setting this to true on Windows or Linux has no effect there.
(Read and Write property)
It's not possible via any of the built-in APIs. There might be a plugin to do it, but I don't think there's OS support for it.
A bit late, but it's been included in recent versions. I'll put it here in case someone stumbles like me in this question:
RealBasic Multiple Selection: OpenDialog.MultiSelect
Assuming you're using .Net I think you'll need to create your own control (or buy one).