Differences between WebGL and OpenGL - opengl

Can anyone give me a simple answer about the exact difference between OpenGL and WebGL? I need more specific on the following:
programming semantics, API's inheritence, API's extensions etc.
I've looked at the following site but it is not very clear to me:
http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences

WebGL is "OpenGL ES 2", not plain OpenGL (the ES stands for 'for Embedded Systems'). So there's the first difference. OpenGL ES is essentially a subset of OpenGL. In addition, WebGL is almost the same as OpenGL ES 2, but has some subtle differences, explained in the link you provide. There's not much to add to that link, it's a pretty clear explanation of what is different between OpenGL ES 2 and Webgl.

OpenGL is a desktopcomputer-centric API (like Direct3D). WebGL is derived from OpenGL ES 2.0 (intended for mobile devices) which has less capabilities and is simpler to use.
WebGL is also designed to run in a browser, and has therefore a few limitations more then OpenGL ES 2.0.
Unlike OpenGL, WebGL does not require native driver support. A wrapper called ANGLE, which Safari, Chrome and Firefox use can translate WebGL calls and GLSL to either OpenGL/GLSL or Direct3D/HLSL
Please see the Khronos wiki for a detailed answer: http://www.khronos.org/webgl/wiki/WebGL_and_OpenGL_Differences

WebGL is meant to run in a browser (web applications).
WebGL is a software library that extends the capability of the JavaScript programming language to allow it to generate interactive 3D graphics within any compatible web browser.
...
It uses the HTML5 canvas element and is accessed using Document Object Model interfaces. Automatic memory management is provided as part of the JavaScript language.
OpenGL is typically used in desktop applications. It is a cross-language, cross-platform specification, of which WebGL is more-or-less a subset.

The consortium (https://www.khronos.org/webgl/) definition is quoted below.
WebGL is a cross-platform, royalty-free web standard for a low-level 3D graphics API based on OpenGL ES 2.0, exposed through the HTML5 Canvas element as Document Object Model interfaces. Developers familiar with OpenGL ES 2.0 will recognize WebGL as a Shader-based API using GLSL, with constructs that are semantically similar to those of the underlying OpenGL ES 2.0 API. It stays very close to the OpenGL ES 2.0 specification, with some concessions made for what developers expect out of memory-managed languages such as JavaScript.
OpenGL and WebGL have similar semantics but are coded in different languages. You will see at the basic level that most of differences are in the programming language constructs of C/C++ vs JavaScript
WebGL and OpenGL shows the similarities between the two, OpenGL in C/C++ and WebGL in JavaScript.

Related

What is the closest complete native library to three.js?

I am looking for the best native library that is similar to three.js in its structure and simplicity but is also extensible enough to support glsl shaders.
Requirements:
Open Source or very well documented for possible extension/enhancement
Allows commercial derivatives/use
Can either be wrapped in a physics library or easily paired with one.
Fast enough to support modern game graphics.
OpenGL or Mantle based. (I don't want to be stuck with windows.)
Windows support
Supports a system similar to three.js local/world coordinate system.
Raycasting support for doing collision detection.
Huge Bonus:
Supports Linux and OSX as well as windows.
I am looking for the closest match to Three.js as possible that is written in C++ similar to three.cpp but has completed functionality and is less beta/alpha status.
Have you tried Magnum ?
http://mosra.cz/blog/download-magnum.php
Supported platforms
Graphics APIs:
OpenGL 2.1 through 4.4, core profile functionality and modern extensions
OpenGL ES 2.0, 3.0 and extensions to match desktop OpenGL functionality
WebGL 1.0 and extensions to match desktop OpenGL functionality
Platforms:
Linux and embedded Linux (natively using GLX/EGL and Xlib or through GLUT or SDL2 toolkit)
Windows (through GLUT or SDL2 toolkit)
OS X (through SDL2 toolkit, thanks to Miguel Martin)
Google Chrome (through Native Client, both newlib and glibc toolchains are supported)
HTML5/JavaScript (through Emscripten)
Threejs actually does support glsl shaders. You can use THREE.ShaderMaterial class to create your own shader then pass your vertexShader and fragmentShader to it.
Another option is to program directly in WebGL. ThreeJS is built on top of WebGL. The only reason why I decided to use ThreeJS was to avoid writing glsl shaders since WebGL doesn't have materials and forces you to write your own glsl shaders, so if that's what you want you could go directly to WebGL. WebGL is more low level than Threejs.
If you don't like javascript, then you could use JogAmp's Ardor3D which is in Java. It's a 3D scenegraph renderer just like Threejs but in Java.
All of the above options have super fast game quality rendering performance.

browser engine with OpenGL backend

Is there a browser engine that may use OpenGL as backend or adpater library to provide such? So that a web page can be rendered using a usual programmable pipeline of OpenGL.
I thought most browsers would use well known 2D frameworks that maybe would be provided with adapters by 3rd party, but just cant figure out if for example Webkit could work from a single mainstream 2D library.
Recent versions of WebKit will use the GPU accelerated graphics APIs provided by the OS if available. Direct2D on Windows and OpenVG on other systems if available. That being said it would be perfectly possible to implement a OpenGL backend to WebKit.
I suggest you look at current developments regarding Wayland on Linux, which will require some major changes in the way applications to their graphics business. There should be already substancial work on the WebKit-GTK+ bindings to make it use EGL created graphics surfaces. It is trivial to bind such EGL surfaces as OpenGL texture.
OpenGLES is not a 2D library, but I presume you meant frameworks that use OpenGLES for primarily 2D texturing. Chromium is one of the good examples of how OpenGL ES2 can be used for this, it accelerates canvas, CSS, and composition among other things using OpenGLES2.
http://www.chromium.org/developers/design-documents/gpu-accelerated-compositing-in-chrome
Until recently, the cairo-directfb backend for Webkit used to be quite popular, but now with every SOC having GLES2 support, things have changed. See for example below:
http://luorhino2006.wordpress.com/2010/04/02/build-webkit-over-pango-cairo-and-directfb-from-scratch/

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

Pure OpenGL CoverFlow implementation--not iPhone or OpenGL ES or other toolkit

Are there any open-source implementations of CoverFlow that are pure OpenGL, and not dependent on one of the following:
Any iOS or Apple API
OpenGL ES--I want this to run on a desktop, not a mobile device
Not tied to other toolkits, such as Qt, Gtk, etc.
I've not been able to find anything fitting this description, which is very surprising to me.
Well, this is not really a pure OpenGL, it is based on GLScene - GLScene is an OpenGL based 3D library for Delphi - it is called CoverFrame.
You didn't specify the language, so I suggest you this which is for Delphi (Pascal).
It is free for use in any project. Read the license or mail to the author.
You can also control:
Mirror alpha
Transparency
Horizontal / Vertical
Demo and SourceCode here

OpenGL ES versus OpenGL [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
What are the differences between OpenGL ES and OpenGL ?
Two of the more significant differences between OpenGL ES and OpenGL are the removal of the glBegin ... glEnd calling semantics for primitive rendering (in favor of vertex arrays) and the introduction of fixed-point data types for vertex coordinates and attributes to better support the computational abilities of embedded processors, which often lack an FPU
Have a look here: OpenGL_ES
OpenGL ES is the opengl api for embedded systems. It is simpler than the normal opengl in terms of the number of the api functions, but may be harder to use, since you will have to use vertex buffers and write more shaders.
When you use a normal opengl, you can use glBegin and glEnd to enclose the geometry primitives you need to draw, but when using Opengl ES, you will have to use vertex buffers.
I guess this is for performance concerns.
Currently, there are two Opengl ES versions, the 1.1 version can only support the fixed rendering pipeline, while the 2.0 version supports glsl shader. However it has no fixed rendering pipeline. In other word, you will have to write your own shader for everything.
Opengl ES is mainly used on cell phones and web (webgl). According to the spec, your desktop opengl driver can support all opengl es apis.
Just like to add that OpenGL 3.3 and OpenGL ES 2.0 are mostly interoperable, by using a subset of the features of OpenGL 3.3. My custom C++ engine uses the same API calls, with a few defines, for Android/IOS/Windows/OSX/Linux.
Among the key differences are:
lack of geometry shader support
no min/max blending (there may be an extension for this)
no Quad List primitive
more restricted texture formats (especially regarding floating point)
glGetTexImage is not available
there is no Transform Feedback, same for several other advanced features
There are also many other differences, but that covers several of the important ones.
OpenGL ES means Open Graphics Library for Embedded Systems (OpenGL ES or GLES) is a subset of the OpenGL computer graphics rendering application programming interface (API) for rendering 2D and 3D computer graphics such as those used by video games, typically hardware-accelerated using a graphics processing unit (GPU). It is designed for embedded systems like smartphones, computer tablets, video game consoles and PDAs.
The OpenGL|ES Official Website: http://www.opengl.org/
you also can get more information from wiki : http://en.wikipedia.org/wiki/OpenGL_ES
Review the OpenGL ES overview here: http://www.khronos.org/opengles/
In short, ES is a subset of Open GL for "embedded systems". Specific differences will depend on the versions and feature sets you're comparing.
The OpenGL ES registry contains detailed API differences between OpenGL ES and the corresponding version of OpenGL:
OpenGL ES 2.0 / OpenGL 2.0
OpenGL ES 1.1 / OpenGL 1.5
However, there isn't a document containing the differences for OpenGL ES 3.0.
I think you'll get a better answer if you ask "what are the differences between OpenGL and OpenGL ES ".
There are profound differences between OpenGL ES 1.1 and ES 2.0, OpenGL 1.5 and 2.0, and OpenGL 3.0 and 4.0.
As others have described ES was written for embedded systems. It also represents the first "house cleaning" of the GL specification since its inception. OpenGL had a) many ways to do the same thing (e.g. you could draw a quad/rect two different ways and blit a pixel image two different ways, etc). ES is simpler than OpenGL with fewer features as a general statement because it's designed for less sophisticated hardware.
I urge you not to look at OpenGL ES 1.1 as it is the past and does not represent the way OpenGL or OpenGL ES is moving architecturally in the future.
The main difference between the two is that OpenGL ES is made for embedded systems like smartphones, while OpenGL is the one on desktops. On the coding level, OpenGL ES does not support fixed-function functions like glBegin/glEnd etc... OpenGL can support fixed-function pipeline (using a compatibility profile).
The modern answer, for ES 3.0 compared to OpenGL 4.6, is way different than the accepted answer. Now, all of the fixed-pipeline stuff is gone.
ES, for EMBEDDED SYSTEMS, is far less robust.
The terminology and versions are quite confusing (especially for newbies). For a more holistic view on OpenGL and OpenGL-ES (GLES), see OpenGL - Then and Now.
OpenGL ES is simply the OpenGL API for embedded systems (OpenGL ES refers to OpenGL Embedded Systems). so its a subset of OpenGL and widely used in cell phones and some VR systems, it's designed for less sophisticated hardware. OpenGL ES has less terms and functions than OpenGL, think of it as you are taking just what you need for that system, because if we dont need a function in whole our work or the hardware can't deal with it, then no mean to add that function but this also makes the use of this API more hard because of the need to write more Shaders and complicated codes to make something simple because OpenGL ES does not provide Shaders in the graphics pipeline as OpenGL. the last version of OpenGL ES is 3.2 it can now provide support for Tessellation for additional geometry details and new geometry shaders. so I advise you to start learning or using OpenGL ES 3.0+ (in case its your target API) because now and the next generation will not use the old versions especially with more powerful hardware and graphics cards we have today; and if your target is OpenGL start with v3.3+ or 4.0+. and when you have more time no problem to make a quick view on the old versions for more understanding how the things were and get developed and why.
you can check this link for more details : https://en.wikipedia.org/wiki/OpenGL_ES
OpenGL is 2D and 3D graphics API bringing thousands of applications to a wide variety of computer platform.
OpenGL ES is well-defined subsets of desktop OpenGL.
OpenGLĀ® ES is a royalty-free, cross-platform API for full-function 2D and 3D graphics on embedded systems - including consoles, phones, appliances and vehicles. It consists of well-defined subsets of desktop OpenGL, ...
See this link.
P.S.
WebGL shares specification with OpenGL ES, i.e. if you have learned desktop OpenGL, it is simple to learn the others(OpenGL ES, WebGL).
simply telling, opengl is desktop version and opengl es is for embedded systems like cellphones where there are memory and performance constraints more than that of computers. opengl es would be harder to use.