Use FreeGLUT for OpenGL xCode projects on MacOS Mavericks - xcode

I'm trying to make an OpenGL application on MacOS X Mavericks. For this I'm using Glew, FreeGLUT (adding the due search paths on project settings and adding the linker flags also), and also the MacOS OpenGL framework.
The problem is, as soon as I get to glutCreateWindow, the program crashes with the following error:
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 34 (X_UngrabKey)
Serial number of failed request: 29
Current serial number in output stream: 29
As I've seen on another post this may be because of the window server, but I have installed XQuartz 2.7.7 as so many have suggested and I still can't do it.
Has anyone ever tried to use FreeGLUT in similar conditions?

I solved by modifying my code like this: glutInitContextVersion(2, 1);
The reason is X11 doesn't support OpenGL higher than 2.1 on OS X.

Related

Using mergExt mergBLE on Mac OS X

I've been using the excellent mergBLE succesfully on iOS; but I want to use it on desktop (OS X) as well. The package includes a .bundle as well as .lcext; but the instructions concentrate on iOS. I've got the bundle theoretically loading (per the externalpackages of stack "Home") in LC 6.6.2 (but not in LC 7.1, probably a separate problem). But using the mergBLEInitialize command, in the IDE on OS X, throws a "can't find handler" error.
Red herring. The problem is that I was running this on MacOS X 10.8.5; mergBLE requires a newer version of CoreBluetooth than is included in that version of OS X. So it doesn't load properly - LC notes that it loaded it - hence the presence in "the externals" but doesn't report the fact that it didn't complete loading. I found this by looking at the Console while LC launched - which reported the failure to load the CoreBluetooth library referenced from mergBLE.

Xcode 7 Unable to determine compiler to use

I get the following errors in Xcode 7 when opening my OS X app:
Unable to determine compiler to use - the abstract compiler specification is missing from this Xcode installation.
and
Unexpected tool settings, missing default value for VFS output path
I've tried rebooting as this post suggests, but to no avail.
I'm running OS X 10.10.4
EDIT Here is a screenshot:
Very lucky.
And I got this error this morning.
Everything worked fine until yesterday and I didnĀ“t change any settings. Just GUI changes. I switched between Yosemite an ELCap and the error occurs on both systems.
I had same problem when Xcode location was in /Application/Subfolder/Xcode.app
After moving to /Application problem is gone.

Random occurrences of Choose a destination with a supported architecture in order to run on this system

I have problems with running OSX applications with XCode. Sometimes (about 30% of the time) the application doesn't start and "XCode cannot run using the selected / Choose a destination with a supported architecture in order to run on this system." message is displayed instead.
This is NOT a duplicate of other questions, because this is not a problem with a project file (in such case the app would never run, and in my case the behaviour is random - sometimes it starts, sometimes not). This only happens with OSX applications.
XCode 5.0.2 (5A3005), OSX 10.9.3, but I had this problem since the first version of XCode 5 on both OSX 10.8 and 10.9.
Have you ever encountered similar issue?
Go ahead and attempt to check these settings: changing architecture settings. I have a feeling that sometimes your running on the 32 bit sim and sometimes the 64 bit sim so your running into the issue below.
Here's another link referencing how to change the standard Architecture for OSX: Changing OSX Architecture and ensure you're no longer set to be using gcc and only using LLVM: Other adjustments to bundle plist

Running mach_inject with Qt in OSX Mountain Lion

On OSX Mountain Lion I'm able to compile mach_inject and the included test project. That works as expected with injection functioning perfectly.
I'm now trying to use the same mach_inject framework from a Qt project, compiled from QtCreator. I've tried both clang and gcc compilers.
Everything compiles and the application runs, but when calling mach_inject, I get the error:
mach_inject failing.. (os/kern) invalid address
Tracing mach_inject, the failure occurs at the last step, when it calls thread_create_running.
Does anyone know what the problem is here? I'm assuming it's something to do with the compiler options provided by Qt against those used by XCode, but could be totally wrong!
Thanks.
The problem turned out to be a 32 / 64 bit incompatibility - as (naturally) you can't inject a 64bit bundle into a 32 bit app!
If anyone else has similar problems, debugging into the mach_inject_bundle_stub can be of use, as the same error from the kernel can be presented due to other issues.

GLFW opens OpenGL 3.2 context but Freeglut can't - why?

I am working on a Mac, I've got FreeGlut compiled and installed, but I can't seem to get the OpenGL 3.2 context with it. However, I can get it without any problem while using GLFW.
So in GLFW, this code works perfectly fine:
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 2);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwOpenWindow(500, 500, 8, 8, 8, 8, 24, 8, GLFW_WINDOW)
But with FreeGlut, this code fails(on glutCreateWindow):
glutInitContextVersion (3, 2);
glutInitContextProfile(GLUT_CORE_PROFILE);
glutInitWindowSize (width, height);
glutInitWindowPosition (300, 200);
int window = glutCreateWindow (argv[0]);
The error it fails with is:
X Error of failed request: BadRequest (invalid request code or no such operation)
Major opcode of failed request: 34 (X_UngrabKey)
Serial number of failed request: 29
Current serial number in output stream: 29
I am running on MacOS X 10.8 Mountain Lion, with Intel HD4000 graphics, having installed XQuartz as my X11 server,and having compiled and installed FreeGlut 2.8 from sources.
Does anyone know what might be the issue?
In 10.8 and 10.7 GL 3.2 is available if you explicitly call for it when setting up the GL context. Apple calls this the "Core Profile" to distinguish from the "Legacy Profile" which is GL 2.1.
I ran into this issue with Wine on OSX, it does not support OpenGL 3.2. My understanding is that the X11 server (either Apple X11 or XQuartz) currently does not implement the 3.2 support, nor is there a switch to flip somewhere to enable it. It could be for compatibility concerns since 3.2 profile will break some existing GL applications
This post suggests using GLFW (or maybe Apple's GLUT.framework if there is still such a thing)
This page explains the GL stack on OSX and confirms the 2.1 issue with GLX.
Freeglut is an extended implementation of the SGI GLUT Toolkit, and ( with a few exceptions around obsolete hardware ) implements the same functions.
Unfortunately, this includes a number of features that would break in a strictly CORE/FORWARD COMPATIBLE implementation.
Typically, if you request a context WITHOUT specifying a version or profile, you will get the best that the combination of driver and GL toolkit can offer, which is normally a compatibility profile, rather than core profile.
Note that the only thing you lose through using a compatibility profile is the supposed checking for deprecated functions. All new core function should work without issue.
This problem with freeglut is not restricted to Apple, it also manifests under Linux using some Gallium drivers. It is not clear that there is any short-term intent to rectify this, so if you need to use CORE/FORWARD COMPATIBLE, you should probably switch to GLFW or SDL.
You need to include the flag. usually under the Version. It should look something like this:
glutInitContextFlag(GLUT_FOWARD_COMPATIBLE);

Resources