Is there a built-in OpenGL GUI windowing library in XCode 6 (OS X 10.10)? - c++

I am trying to develop a C++ application that uses OpenGL. I set up everything in XCode 6.4 (running on OS X 10.10.5) and I was able to get the OpenGL framework working. However, I can't figure out how to draw the graphics to a GUI window.
I know that GLUT is available, but it is deprecated and I'd rather avoid using it. Instead, is there a way of using some of Apple's native windowing systems (I assume there should be something available in the Cocoa API)?
I would rather avoid downloading additional libraries like SDL or Qt since I do not have root access on this machine and maintaining third-party libraries those may be challenging.

Related

Qt 5.7 black screen on windows

I have just upgraded my project to use Qt 5.7, on Mac I am able to load the html pages using Qt Webengine but on Window 7, the pages are not displayed, instead a black screen is shown.
I have also compiled simple browser example and it too only shows a black screen.
I am using the visual studio 2013 build of Qt 5.7
Does anyone know why it is not displaying the pages.
Does Qt 5.7 need any third party libraries for it render correctly on Windows.
We had a similar problem, whenever we started an application with a QWebEngineView it would only show a black screen or even crash on another machine. The problems occured due to wrong versions of api-ms-*.dlls and d3dcompiler_47.dll we had packaged with our app.
We found the correct versions on our developer machine with installed Windows SDK under "C:\Program Files (x86)\Windows Kits\10\Redist".
On a side note: We found that deployement of QWebEngine under windows is quite a hassle.. you also need to include "qtwebengine_locales" from qtbase\translations and "resources" from qtbase as well as "QtWebEngineProcess.exe" from qtbase\bin.
A thing that helped tracking down the problem, was putting "CONFIG += console" in the pro-file. That way the console output with relevant error information is shown on deployement targets.
With help of this comment from peppe
One can use temporary workaround with graphic drivers not supporting DirectX11 but supporting DirectX9
As said here
https://doc.qt.io/qt-5/windows-requirements.html#dynamically-loading-graphics-drivers
Graphics Drivers
For Qt Quick 2 to work, a graphics driver that provides OpenGL 2.1 or higher is required. The default driver from Windows is OpenGL 1.1. Qt includes a version of the ANGLE project which is included from the Windows Qt installers. ANGLE implements the OpenGL ES 2.0 API on top of DirectX 11 or DirectX 9. ANGLE requires that the DirectX SDK is installed when building Qt.
ANGLE chooses the render backend depending on availability. DirectX 11 is usually preferable. However, some graphics cards may not fully support it. For these cases, the environment variable QT_ANGLE_PLATFORM (introduced in Qt 5.4) can be used to control the render backend. Possible values are d3d11, d3d9 and warp.
So this may help
set QT_ANGLE_PLATFORM=d3d9
Or use mesa with
https://www.mesa3d.org/llvmpipe.html
Qt::AA_UseSoftwareOpenGL is special in the sense that it will try to load an OpenGL implementation with a non-standard name. The default name is opengl32sw.dll. This allows shipping a software-only OpenGL implementation, for example a build of Mesa with llvmpipe, under this name. If necessary, the filename can be overridden by setting the QT_OPENGL_DLL environment variable.
Edit 1:
One can use fallback method for one-time login to Dropbox Windows client ( made with QT framework ) for example
Dynamically Loading Graphics Drivers
In addition to the build time configuration, Qt supports choosing and loading the OpenGL implementation at runtime. To use this mode, pass -opengl dynamic to the configure script.
Note: As of Qt 5.5 this is the configuration used by the official, pre-built binary packages of Qt. It is strongly recommended to use it also in custom builds, especially for Qt binaries that are deployed alongside applications.
...
This configuration is the most flexible because no dependencies or assumptions are hardcoded about the OpenGL implementation during build time. It allows robust application deployment. When a given environment fails to provide a proper OpenGL 2.0 implementation, it will fall back automatically to ANGLE. This fallback will be completely transparent to the application, and will allow Qt Quick or other OpenGL code to function by translating to Direct3D. Such a fallback could, for example, take place on a Windows 7 PC with no additional graphics drivers installed. On other machines, where there is sufficient OpenGL support, the normal desktop OpenGL drivers will be used. Additionally, pure software-based OpenGL implementations may be available as additional fallbacks in the future, allowing running Qt Quick applications without a GPU.
When configured with -opengl dynamic, neither Qt nor the applications built using qmake will link to the opengl32 (standard desktop OpenGL) or QtANGLE libraries. Instead, the appropriate library is chosen at runtime. By default, Qt will determine whether the system's opengl32.dll provides OpenGL 2 functions. If these are present, opengl32.dll is used, otherwise the ANGLE libraries (libEGL.dll and libGLESv2.dll) will be used. In case the ANGLE libraries are missing or initialization fails for some reason, an additional fallback is attempted by trying to load opengl32sw.dll. See below for details.
Such a fallback could, for example, take place on a Windows 7 PC with
no additional graphics drivers installed.
To emulate this conditions one can use RDP session with mandatory 8 bpp to Windows machine

Force Unreal Engine to use opengl on windows executable

I'm attempting to make a video game in Unreal Engine 4.9. I'm building it for Windows, but I'd like to have it use opengl instead of directx in the executable. However, I've found no options that let you do this. Unreal Engine uses OpenGL when it creates executables for Linux and Mac, but there seems to be no way to use OpenGL with Windows.
Am I missing something? Is there some way to force Unreal Engine to use OpenGL in Windows executables?
EDIT: The reason I want to use OpenGL is because I want this game to run without having to install anything on the end user's computer (DirectX has to be installed to work)
Microsoft doesn't really support OpenGL, they typically go out of their way to make it very difficult to use OpenGL on Windows and strongly encourage people to use DirectX instead.
The simplest way to get a working OpenGL context in windows is sometimes to use ANGLE which is a compatibility layer which translates OpenGL calls to DirectX calls. This is what Chrome and Firefox use to support WebGL on windows. I doubt that Unreal Engine is integrated with this, so you might have a hard time.
Edit:
EDIT: The reason I want to use OpenGL is because I want this game to run without having to install anything on the end user's computer (DirectX has to be installed to work)
One thing you could do is cross-compile the Mesa3D drivers, as described here: https://wiki.qt.io/Cross_compiling_Mesa_for_Windows
But then you won't get hardware acceleration.

OS X fullscreen in wxWidgets 3.0

I contribute to a cross-platform application which is built using wxWidgets stable version - 3.0.2.
I would like to enable the app to use the native fullscreen system on OS X Lion and above. This feature is implemented in current development versions of wxWidgets, but not in 3.0.2.
I understand that it should be possible to call the native Cocoa API from within the wxWidgets app to enable fullscreen mode, but I can't work out how to do so and can't find any information online.
How can I directly access the NSWindow class from my wxWidgets C++ code?
For reference, this question asks how to do the same with wxPython, and gets an answer - but python is different enough from C++ that I can't work out how I would do it in standard wxWidgets.
You can use wxWindow::MacGetTopLevelWindowRef() to get the NSWindow. See this commit for what you can do with it afterwards.

Qt C++ Library for Windows and OpenGL

I am trying to experiment with the Qt library on Windows. On their downloads page, I notice that the binaries built using VS2012 are available in two forms, with and without OpenGL. What exactly is the difference between the two? In the OpenGL version, do they have some special API implemented using OpenGL or does all of Qt rendering depend on OpenGL? Also, is there a version of Qt that uses DirectX?
#Raman: The opengl variant is using the desktop opengl version just like with Qt4.
The non-opengl variant is using angle, and you need to have that installed alongside the DirectX SDK to get it working. Angle is an adapter between the directx and the opengles API. Only the latter is support directly by Qt, but unfortunately directx drivers tend to work better on Windows than the opengl(es) ones. There are no plans to support a directx backend inside Qt, so we leave with Google's Angle work in that regard.
As for providing some extra bit, there was a discussion about it recently on the mailing list, that this decision should not be build time, but more like run time. However, no one has stood up just yet to make that work. Hopefully, that will change soon. It is causing confusion for the end users just like, so do not feel alone. ;-)
Hope this explanation helps.
DirectX is supported via the ANGLE based library.
Note that this has changed and as of Qt 5.5 the prebuilt binaries you can download from the Qt website are configured with the -opengl dynamic option. This is what #lpapp above was talking about. Qt defaults to choosing either native OpenGL drivers or ANGLE at run time now.
Qt internally uses OpenGL to render unless you specify otherwise now. You can also render custom OpenGL content using Qt's QOpenGLxxx functions and classes.
For a simple introduction to Qt and OpenGL that covers this and more click here.

GUI Programming C++ for Mac OS X Lion

I'm probably going to get abuse for this question but here goes. Oh but before you tear into me and tell to crawl back under a rock etc. I have looked high and low and nothing has helped me so far either the software libs are out of date and for some reason wont work on lion.
Ok other than Qt is there any other lightweight opensource GUI library for C++ on mac? I have tried this wxWidgets doesn't work for some reason. Apple don't seem to offer that carbon crap anymore or can I use openGL to create GUI's? I just want a simple nicely documented GUI lib without having to switch to windows to develop. or will I have to spend some money on one or resort to Qt.
Hope someone can help and thanks!
Why not use Cocoa (the native way to develop OSX GUIs) in the first place? You must use the Objective-C calls to create windows for example, but you can mix this code with C++ code in the same file - this is then called Objective-C++ and it is supported by clang and the gcc.
To build completely native-looking OSX Applications, you need Cocoa. Every other toolkit that can create those native GUIs calls Cocoa (at least to my knowledge).
Just as a pointer: have you tried SDL?
FLTK is simple and very stable GUI library. Runs on Windows, OS X and Linux.
Non-native look though.
Here is a screenshot of an app I built with it a few years ago, and that still runs great on Lion.
I'd take a look at both GLUT and GLUI as simple extensions to OpenGL that provide basic widgets. They can be used together to some degree, but I personally have run into a couple issues in that department. Either one in isolation is pretty simple to use if you're familiar with OpenGL though.
EDIT: Also, X11 can run in OS X, although I'm not familiar enough with the system to know how to get started with that.