iPhone OpenGL ES - c++

Since I'm not familiar with iPhone development I'd like to know whether it is possible to use OpenGL ES1.0 on the iPhone 3gs rather than 2.0.
I'd like to share a code base across different mobile platforms and not having to deal with the programmable pipeline from OGLES 2.0 could speed up an initial build.
Update -- I'm not used to working with OpenGL Es, but is there a always complete backward compatibility or do phones sometimes only support the latest version, eg 2.0
Thanks

Yes, you can. Simply call the OpenGL ES 1.0 APIs. The hardware is a full 2.0 device, but the software/driver can implement an OpenGL 1.x pipeline for you.

Related

which opengl version runs on every device?

Using llvm you can write a Programm which runs on PC, Mobile and since WebAssembly even in your Webbrowser. But for an Example Android uses Opengl-ES. Is there any opengl version which can be used on each of these platforms?
There is no single version of OpenGL that runs everywhere, but OpenGL ES 2.0 is pretty close to the lowest common denominator.
WebGL 1.0 is very similar to OpenGL ES 2.0. WebGL 2.0 is a subset of OpenGL ES 3.0, with various restrictions which are required for security.
On desktop systems, there is usually a way to create an OpenGL ES 2.0-compatible context and use the exact same API as on Android. Regular desktop OpenGL has a few incompatibilities with OpenGL ES, see for example this page:
https://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences
Mobile devices almost universally support OpenGL ES 2.0, and most flagship phones support OpenGL ES 3.2. The current distribution of support for OpenGL ES on Android phones is at the bottom of this page: https://developer.android.com/about/dashboards/

How to convert OpenGL 3 code to OpenGL 2 code?

I plan use OpenGL 3.0 to make a future application, mostly because of the good tutorials with it, and clean code! Though I do know that many computers still don't support OpenGL 3.0, are their any efficient ways to convert OpenGL 3.0 to 2.0?
I plan use OpenGL 3.0 to make a future application
In fact,using OpenGL 3.0 your application may hardly be called "future".OpenGL 3.0 is very old.Versions 3.0 - 3.2 are transitional versions- from the old OpenGL 2.x, to the new modern fully programmable OpenGL,which starts from the version 3.3 onward.So, yeah, you can use V3.0 mostly with no worry as most of the dedicated GPUs,even relatively old still usually support V3.2.But if you want to invest into "future application", as you put it,OpenGL 3.3 (at least) is the way to go,and unless you plan to target really old (before the year 2010) harware ,you should be fine with it.
are their any efficient ways to convert OpenGL 3.0 to 2.0?
Now,that depends how you use OpenGL.In 3,0 you can still write your app using the fixed OpenGL 2.x API.From the other hand,you can use shaders and all sort of extensions and using programmable pipeline.If you select second option then porting to OpenGL 2.x can be somewhat problematic.But if you stick to the fixed pipeline (still can use shaders) you are going to be fine.My personal advice - DON"T use DEPRECATED (fixed) PIPELINE ANYMORE.

learning OpenGL ES 2.0 under regular OpenGL - compilation

I am learning OpenGL with an aim to build OpenGL ES application for Android / iPhone.
Since I learn it from the beginning, I would prefer to learn the new specification, without touching the old stuff (glBegin etc.). Unfortunately, when I pass some tutorial and implement stuff, it turns out that the examples are incompatible with ES 2.0. For example, after those excellent tutorials I know how to implement lights, what works on my PC, but would not work on a mobile (gl_LightSource is not supported in the latter).
What I would like to do, is to develop the code on my PC, and restrict the API to the commands that are supported under OpenGL ES (like, throw error on glLight). Is that possible?
Assuming you are using Windows for development, then you can restrict the API to just OpenGL ES 2.0 by using Google ANGLE. ANGLE is basically wrapping DirectX, but you use it through a fully standard compliant OpenGL ES 2.0 interface.
If you have an AMD Radeon GPU, you have another option: the AMD OpenGL ES SDK also provides a fully compliant 2.0 interface.
In both cases, if you accidentally use non OpenGL ES 2.0 features, the code will just not compile or fail at runtime in case of unsupported combinations of parameters. Same goes for shaders, the glCompileShader call will fail.
IF you want to learn OpenGL ES 2 and make sure you are only using calls and techniques compatible with OpenGL ES 2, consider learning WebGL.
WebGL is almost identical to OpenGL ES 2. You get the advantage of a javasript console (with firebug or chrome's built-in developer tools) and in some environments (chrome on windows I think?) you get VERY helpful error messages whenever you do something wrong. Add to that you automatically have access to up to 4 implementations of WebGL to test with (firefox, chrome, safari, opera) and you have a pretty good set of tools for testing your OpengGL.
This is essentially how I have been able to learn OpenGL ES 2.
As stated in the Mali GPU OpenGL ES Application Development Guide:
OpenGL ES 1.1 and OpenGL ES 2.0 are subsets of the full OpenGL
standard. When using the OpenGL ES API, there are limitations that you
must be aware of when developing your applications.
For example, the following OpenGL functionality is not present in
either OpenGL ES 1.1 or OpenGL ES 2.0:
There is no support for glBegin or glEnd. Use vertex arrays and vertex buffer objects instead.
The only supported rasterization primitives are points, lines and triangles. Quads are not supported.
There is no polynomial function evaluation stage.
You cannot send blocks of fragments directly to individual fragment operations.
There is no support for display lists.
In addition, the following OpenGL functionality is not present in
OpenGL ES 2.0:
There is no support for the fixed-function graphics pipeline. You must use your own vertex and fragment shader programs.
There is no support for viewing transforms such as glFrustumf. You must compute your own transformation matrix, pass it to the vertex
shader as a uniform variable, and perform the matrix multiplication in
the shader.
There is no support for specialized functions such as glVertexPointer and glNormalPointer. Use glVertexAttribPointer
instead.
You can always refer to the OpenGL ES specification and see if a function / feature is supported.
There is a good set of lessons available for OpenGL ES 2.0 over at http://www.learnopengles.com/. For developing on PC you can try using an emulator; many different GPU vendors provide their own emulators that translate the calls to desktop GL. However, the best way to be sure that your code works as expected is to run it on the actual device.
EDIT: A new emulator for Android has support for OpenGL ES 2.0: http://android-developers.blogspot.ca/2012/04/faster-emulator-with-better-hardware.html

What OpenGL version to choose for cross-platform desktop application

I'm working on some cross-platform desktop application with heavy 2-D graphics. I use OpenGL 2.0 specification because I need vertex shaders. I like 3.2+ core API because of it's simplicity and power. I think that 3.2+ core could be a choice for the future. But I'm afraid that nowadays this functionality may not be available on some platforms (I mean old graphic cards and lack (?) of modern Linux drivers). Maybe, I should use OpenGL ES 2.0 -like API for easy future porting.
What's the state of affairs with 3.2+ core, cards and linux driveres?
Older Intel chips only support OpenGL 1.5. The later chips (since about two years ago) have 2.1 but that performs worse than 1.5. Sandy Bridge claims to support "OpenGL 3" without specifying whether it is capable of doing 3.3 (as Damon suggests) but Linux drivers only do 2.1 for now. All remotely recent Radeons and Nvidia hardware with closed-source drivers support 3.3 (geometry shaders) and the 400-500 series support 4.1 (tesselation shaders).
Therefore, the versions you want to aim for are 1.5 (if you care about pre-Sandy-Bridge Intel crap), 2.1 (for pretty much all hardware), 3.3 (for decent hardware & closed-source drivers) or 4.1 (bleeding edge).
I have vertex and fragment shaders written with #version 120 and geometry shaders written in #version 330, to make fallback on old hardware easier.
You can stay on OpenGL ES 2.0. Even if ES mean Embed, it's a good approach because it remove all the fixed functions (glBegin, etc...): you are using a subset of OpenGL 2.x. So if you write your software by thinking only OpenGL ES 2.0, it will be fast and work on the majority.
In real, OpenGL ES 2.0 and desktop GL might have some difference, but i don't think it will be something you will use. If the extension GL_ARB_ES2_compatibility is supported, you have a "desktop" card that support the complete embed subset. (4 func and some const.)
Now, the real question is how many years of hardware do you want to support ? They are still lot of very old hardware that have very poor gl support. Best would be to support the less-old (OpenGL 2.0 is already old) :)
I would personally go for OpenGL 3.3, optionally with a fallback for 3.2 plus extensions (which is basically the same). It is the most convenient way of using OpenGL 3.x, and widely supported.
Targetting 3.1 or 3.0 is not really worth it any more, except if you really want to run on sandy bridge (which, for some obscure reason only supports 3.0 although the hardware is very well capable of doing 3.3). Also 3.1 and 3.0 have very considerable changes in shader code, which in my opinion are a maintenance nightmare if you want to support many versions (no such problem with 3.2 and 3.3).
Every hardware that supports 3.2 can also support 3.3, the only hindrance may be that IHVs don't provide a recent driver or a user may be too lazy to update. Therefore you cannot assume "3.3 works everywhere". The older drivers will usually have the same functionality via ARB extensions anyway, though.
Mac OS X doesn't support GL-3 context at the moment. This summer may change the situation, but I would recommend to stick with GL-2 plus extensions nevertheless.
Depends on your target market's average machine. Although to be honest, OpenGL 3.2+ is pretty ubiquitous these days.

I need openGl 2.0 but my graphic card support 1.5

I want to start with my webGL project and minimal require is my graphic card support openGL 2.0.
Problem exist because i have intel laptop with integrated intel 965 graphic media accelerator and driver is up to date and it support openGL 1.5.
Is there any solution how to update my graphic carf to support 2.0? Is this possible?
Okay. just stay patient actually because ANGLE is coming. It seems to me that your hardware is able to run directX 9 and ANGLE is a project from google to allow webgl support from directX. But as the others say, you can't upgrade opengl drivers just like that. Or you could try MESA in the firefox build.
For more information, see Learningwebgl.com.
Sadly no. With a little more effort you can still develop against opengl 2.0 but you'll need to use another machine (or just buy a better graphics card) to test anything 2.0 specific (pixel shading for instance).
Ok, that's not entirely true. You could download the mesa library and compile it for win32 and get some of the opengl 2.0 functionality emulated in a software renderer but it would be very slow.
It's possible that updating drivers might help some, but probably won't make that jump. Otherwise, you could use something like Mesa3D, which does the rendering in software. It can be slow, but does support up through OpenGL 2.1 (including shaders), if memory serves.
If there's no other way, you could try http://www.mesa3d.org/ . I haven't followed this project for quite some time, but apparently they currently provide OpenGL 2.1 software rendering.
I just updated drivers my HP 6710b with Mobile Intel 965 Express Chipset -- and now WebGL is working in Firefox 4 RC1!
I put instructions on this site.
It is not pretty but it works!
angleproject is your best bet. Check out which exact 965 card you have from here (search for 'intel gma' in wikipedia), which also lists the OpenGL support version for these cards. It might take a couple of months though before you can use angleproject to accelerate your WebGL application.
I have a slightly newer 4500MHD, and I have the same problem. WebGL works on Firefox 3.7a4, but fails in the later versions a5 and a6. I had to use the latest drivers from Intel which claim to support OpenGL 2.0. The Microsoft drivers don't ship with OpenGL support.
I have reported a issue in the Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=570474. It looks like support for Intel cards might be fixed by the time the releases are in beta.