NURBS surfaces in OpenGL 3.2 core profile - opengl-3

Is it possible to draw NURBS (Non-uniform rational B-spline) surfaces in OpenGL 3.2 core profile?
I assume that the NURBS rendering using GLU library does not support the core profile.
Is there any open source libraries that implement the same functionality as GLU?

Using GLU with core profiles from OpenGL 3.1 onwards, won't really work. GLU is layered on top of a many deprecated OpenGL functions, and your application most likely won't either link or work correctly.
As for NURBS implementation in GLU, the source code is available in the open source from SGI at http://oss.sgi.com/projects/ogl-sample/. You could probably fix the library to use more modern OpenGL methods.
Also more details are given in this post.

Related

Will CoreGraphics support Metal on Apple Devices?

I have read that Core Graphics is based on OpenGL ES and uses the Quartz Drawing Engine on Apple devices (iOS, OSX)
However with the upcoming deprecation of OpenGL ES for Metal, will Core Graphics be updated to support Metal and/or software rendering for coming iOS/OSX devices?
First, Core Graphics doesn't "use" Quartz. "Core Graphics" and "Quartz" are just two names for the same thing. They are equivalent.
Second, Apple doesn't promise what technology Core Graphics uses under the hood. They've occasionally touted the acceleration they were able to accomplish by using some particular technology, but that's marketing — marketing to developers, but marketing nonetheless — not a design contract. They reserve the right and ability to change how Core Graphics is implemented, and have done so often. Any developer who writes code which depends on the specific implementation is risking having their code break with future updates to the OS. Developers should only rely on the design contract in the documentation and headers.
It is very likely that Core Graphics is already using Metal under the hood. It makes no difference to you as a developer or user whether it is or isn't.
Finally, Core Graphics has not been deprecated. That means that there's no reason to expect it to go away, break, or lose functionality any time soon.

Opengl ES 3.1+ support on iOS through Vulkan wrapper

Now that a Vulkan to Metal wrapper is officially supported by Khronos (MoltenVK), and that OpenGL to Vulkan wrappers began to appear (glo), would it be technically possible to use OpenGL ES 3.1 or even 3.2 (so even with support to OpenGL compute shaders) on modern iOS versions/HW by chaining these two technologies? Has anybody tried this combination?
I'm not much interested in the performance drop (that would obviously be there due to the two additional layers of abstraction), but only on the enabling factor and cross-platform aspect of the solution.
In theory, yes :).
MoltenVK doesn't support every bit of Vulkan (see the Vulkan Portable Subset section), and some of those features might be required by OpenGL ES 3.1. Triangle fans are an obvious one, full texture swizzle is another. MoltenVK has focused on things that could translate directly; if the ES-on-Vulkan translator was willing to accept extra overhead, it could fake some or all of these features.
The core ANGLE team is working on both OpenGL ES 3.1 support and a Vulkan backend, according to their README and recent commits. They have a history of emulating features (like triangle fans) needed by ES that weren't available in D3D.

Clean C++ OpenGL for iOS

Can I use clean c++ version of openGL in my iOS App? I want write some basic wrapper, then connect my code in c++ with this wrapper and App. Or I must use only openGLES? With GLKit. Describe me all variants.
iOS supports OpenGL ES only. Currently supported devices are exclusively 2.0 and 3.0, which are both programmable pipelines; older devices were 1.1 which was the fixed pipeline.
ES is integrated as the Core Animation level. Prior to GLKit you were required to create a layer — the simplest thing that the compositor can display — and build that into a view hierarchy. CADisplayLink is the 3.0+ way of tying in to the device's [virtual] horizontal sync.
GLKit is separate and aims to:
provide easy view-level wrappings, creating and tying together a GL context, a layer, a view and a display link;
provide shaders equivalent to the old fixed-functionality pipeline so that ES 2.0+ can be used just as easily as 1.1 was for the same set of purposes.
It's up to you whether you use it.
One of the languages supported by LLVM is Objective-C++. That's C++ and Objective-C code intermingled, each able to call the other. You could easily create a single Objective-C++ file that exposes an ordinary C++ class for all of the rest of your ordinary C++ code but which internally makes appropriate calls to bridge into the Objective-C world. So you'd probably have a few hundred lines of Objective-C dealing with the OS stuff and exposing stuff you care about for C++ actors.
iOS doesn't support OpenGL at all. You must use OpenGL ES for iOS devices.
You can use OpenGL ES 1.1 and 2.0 on every single iOS devices (actually you can use only OpenGL ES 1.1 on iPhone 3G, however recent iOS doesn't support iPhone 3G at all).
Also you can use OpenGL ES 3.0 on Apple A7 and A8 GPU devices, such as iPhone 6.
See the Apple document for more details.
All you need to use OpenGL ES on iOS, is CAEAGLLayer and EAGLContext. GLKit is just a useful wrapper classes for those classes.
After setting up those classes, you can use OpenGL ES API as the other environment.
By the way, this project https://code.google.com/p/gl-wes-v2/ provides some OpenGL 2.0 APIs on OpenGL ES 2.0 environment. It seems it isn't compatible with iOS, but you might be able to use some code from the project.

GLKit.framewok vs OpenGLES.framework vs QuartzCore.framework

I am adding a GLView to my app and along the way I have learned that I need to add the GLKit framework.
So when I was adding this framework, I realised there is a very similarly named framework called OpenGLES.framework.
I tried to look up the difference between these two frameworks on google, and I landed on this page.
This article seems to suggest I need an extra framework called QuartzCore.framework, which confused me even more.
I have the following questions:
1) How do these frameworks relate to each other?
2) It seems like GLView framework alone will enable GLView to work. When am I required to use the other two frameworks?
OpenGL ES is a cross-platform C API for GPU-accelerated drawing, particularly useful for 3D graphics and image processing. On iOS, you link against OpenGLES.framework, providing access to the cross-platform API and to the most basic iOS-specific APIs (EAGLContext and CAEAGLLayer) for using OpenGL ES in your app.
GLKit is an Apple-specific framework that adds extra features for making development of OpenGL ES-based apps easier, as nicely summed up in the tutorial you linked to:
GLKView/GLKViewController. These classes abstract out much of the boilerplate code it used to take to set up a basic OpenGL ES project.
GLKEffects. These classes implement common shading behaviors used in OpenGL ES 1.0, to make transitioning to OpenGL ES 2.0 easier. They’re also a handy way to get some basic lighting and texturing working.
GLMath. Prior to iOS 5, pretty much every game needed their own math library with common vector and matrix manipulation routines. Now with GLMath, most of the common math routines are there for you!
GLKTextureLoader. This class makes it much easier to load images as textures to be used in OpenGL. Rather than having to write a complicated method dealing with tons of different image formats, loading a texture is now a single method call!
If you link GLKit.framework, you get OpenGLES.framework for free — likewise if you import the GLKit headers, the OpenGL ES headers come along for the ride.
QuartzCore is for working directly with Core Animation layers. Before GLKit was introduced, you had to set up your own layers for getting OpenGL content onscreen — now GLKView does this on your behalf, so there's no need for QuartzCore unless you want to do extra fun stuff with Core Animation.

How can I load a 3d model to an IOS app, and scale/transform/rotate it to place on an image?

I should load a 3d model (let's say a fridge) and scale or rotate it to locate on a kitchen photo (just for an example).
I have seen several SDKs but all was for 3d games. What I need is to put and play with my object in a native IOS app.
Where should I start? GLKit is the answer for that?
iOS 3d rendering is made by OpenGL ES, that is a pretty difficult topic. Apple provides GLKit to help developer to integrate OpenGL ES but none of is a model parser or scene manager, is hard anyway. I can suggest you to use a 3d engine, I took a look at two engines:
1-Nineveh GL
2-Irrlicht
The first integrate absolutely fine in iOS projects and exposes objective c API. It uses only OpenGl 2.0 shaders. The problem is that is a beta version.
The latter is written in C++ and supports both 1.0 and 2.0, but is pretty hard to integrate.

Resources