How do I convert OpenGLES shaders to Metal compatible ones? - objective-c

I have a project which uses about 2 dozen .vsh and .fsh files to draw 2D tiles using OpenGLES. Since that is deprecated, I want to convert my project to Metal. My head is now swimming with vocabulary and techniques involved in both systems - graphics is not my forte.
Can I use OpenGLES to compile the .vsh/.fsh files, and then save them in a metal-compatible format? The goal would be to then use the saved information in a metal-centric world and remove all the OpenGLES code from the project. I've spent a few days on this already, and yet I don't understand the processes enough to fully attempt the transition to Metal. Any/all help is appreciated.
I saw this: "On devices that support it, the GLSL code you provide to SKShader is automatically converted to Metal shading language and run on a Metal renderer", which leads me to believe there is a way to get this done. I just don't know where to begin. OpenGL ES deprecated in iOS 12 and SKShader
I have seen this:
Convert OpenGL shader to Metal (Swift) to be used in CIFilter, and if it answers my question, I don't understand how.
I don't think this answers it either: OpenGL ES and OpenGL compatible shaders
Answers/techniques can use either Objective-C or Swift - the existing code is Objective-C, the rest of the project has been converted to Swift 5.

There are many ways to do what you want:
1) You can use MoltenGL to seamlessly convert your GLSL shaders to MSL.
2) You can use open-source shader cross-compilers like: krafix, pmfx-shader, etc.
I would like to point out that based on my experience it would be better in terms of performance that you try to rewrite the shaders yourself.

Related

Pixel Shader performance in Directx9 not equivalent to Opengl ES2.0

I am using a drop effect by the help of pixel shader in directx-9 to be specific SlimDX.Direct3D9 written in hlsl used for transition between two images. I have written the same pixel shader in glsl language to be used in an android project using java 6.0.
The issue here is with the performance difference in both the machines. Android machines is showing smooth transition but there is a visible pixelation in Windows machines during transition. Pixel shader 2.0 version is being used in directx project
I think a couple of pictures would help immensely.
It could be a difference in sampling coordinates. Make sure you are getting 1:1 texture/pixel mapping.
Another possibility could be that the filtering is set to point instead of linear.

PVR texture format: MGLPT_PVRTC4 vs OGL_PVRTC4

PVR texture format from Imaginations.
Defined in PVRTexLibGlobals.h
What is difference with texture formats?
MGLPT_PVRTC4 vs OGL_PVRTC4
I have used OGL_PVRTC4 before. Does MGLPT_PVRTC4 is exactly same?
My code broke when some tool gave MGLPT_PVRTC4 texture. I am wondering how should we process MGLPT_PVRTC4 textures.
The best place to ask would be at the PowerVR Insider forum (http://forum.imgtec.com/categories/powervr-graphics). FWIW, MGL is an old API that pre-dates OpenGL ES 1.0 (and the latter recently turned 10).
It is extremely likely that the ordering of the contents of the file will have changed between the two.

Game development using OpenGL ES 2.0 and C

I wanted to develop a game. I want to develop with the knowledge that I am having in OpenGL ES 2.0 and C language.
First thing that comes into my mind is how to develop textures etc. So please can any one tell me what are all the tools, game engine etc what all i need.
Any good tutorials for the same.
thanks in advance.
You said you want to use OPENGL ES 2.0, I understand you want develop for an Android or IPhone device.
You need read some about matrix, rotation, translations. OpenGl ES doesn't have glrotate and gltranslate methods(and more), but you can develop your own methods method using then OpenGl documentation:
http://www.opengl.org/sdk/docs/man/xhtml/glRotate.xml
http://www.opengl.org/sdk/docs/man/xhtml/glTranslate.xml
If you want to use OPENGL for draw, you will need write a vertex and fragment shader
What kind of shader for 2D games (ie. Super Mario)
A lot of stuff you need, this is only a little piece. I hope this be helpful to you.

Best approach for music visualization/interaction app

I'm am an experienced flash developer who's been learning objective-c for the last 5 months.
I am beginning the development of an app previously prototyped in Flash and I'm trying to guess what could be the best approach to port it to iOS.
My app is kind of a music game. It consists of some dynamic graphics (circles growing and rotating), with typography also changing and rotating. Everything moves in sync with music. And at the same time the user can interact with the app (moving and rotating things) and some sounds will change depending on his actions.
Graphics can't be bitmaps because they get redrawn every frame.
This was easy to develop with Flash due to its management of vector graphics. But I'm not sure what would be the best way to do it in objective-c.
My options, I guess are things like: Core Graphics, OpenGL, maybe Cocos2D (not sure if that would be to kill a flea with a sledgehammer). Or even things like OpenFrameworks or Cinder, but I rather use objective-c other than c++.
Any hint on where to look at will be appreciated.
EDIT:
I can't really put a real screenshot due to confidentiality issues. But it is something similar to this
But it will be interactive and sections would change size and disappear depending on the music and user interaction.
Which graphics library should you use? The answer is going to depend a lot on what you know or could learn. OpenGL will use hardware acceleration, so it's probably fastest. But OpenGL doesn't have built-in functions for drawing arc segments or any curves or text at all, so you'd probably have to do it yourself. Also, OpenGL is notoriously difficult to learn.
Core Graphics has many cool methods for drawing vector graphics (rectangles, arcs, general paths, etc.), but might be slower than you want, depending on what you're trying to do. Without having code to actually run it's hard to say.
It looks like Cocos2D is built on OpenGL and is made to be simple. I see lots of mention of sprites on their website, but nothing about vector graphics. (I've never used it, so it could be there and I'm just not seeing it.)
If I were in your position, I'd look into cocos2d and see if it does vector graphics at all. If not, I might give Core Graphics a try and see what performance was like. I know OpenGL can do what you want, but it can be difficult to learn, so I'd probably do that last.

Complex gestures on the iPhone

Is there a high level library that handles complex gestures l ike detecting triangles / loops / circles? Is it even possible to build such a library with what Apple already has?
Thanks,
Teja
You can use a "Dollar Recognizer"... its pretty accurate and very easy to use from a single training template. There is even an effort started for an iPhone implementation, although its not been released yet. An implementation is being used by AlphaCount.