Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


OpenGL ES on desktops


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
10 replies to this topic

#1 jeff8j   Members   -  Reputation: 779

Like
0Likes
Like

Posted 05 August 2014 - 07:14 PM

Is there a way to use opengl es 2 on desktops natively? I have tried searching google and found alot to do with the android emulator but not much about gles2 on windows I found mesagles that maybe a solution for linux. I would think theres got to be something how do browsers use webgl?


Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


Sponsor:

#2 Hodgman   Moderators   -  Reputation: 31938

Like
0Likes
Like

Posted 05 August 2014 - 07:19 PM

Chrome uses Angle, which emulates GLES2 via D3D.



#3 jeff8j   Members   -  Reputation: 779

Like
0Likes
Like

Posted 05 August 2014 - 07:45 PM

Thanks ill look into that at first glance i just see that it translates to directx is there something else they use for linux and mac osx?

 

Nevermind I see they use it for mac and linux just portions of it I guess


Edited by jeff8j, 05 August 2014 - 07:46 PM.

Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


#4 jeff8j   Members   -  Reputation: 779

Like
0Likes
Like

Posted 05 August 2014 - 07:58 PM

Is there a way to do it in reverse so something already existing using opengl can run in a browser or mobile with opengles? Is there a higher language that could be used across everything? Do developers usually make multiple shaders for multiple targets?


Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


#5 Chris_F   Members   -  Reputation: 2466

Like
2Likes
Like

Posted 05 August 2014 - 08:14 PM

http://www.g-truc.net/post-0457.html



#6 jeff8j   Members   -  Reputation: 779

Like
1Likes
Like

Posted 05 August 2014 - 08:18 PM

Thanks looks like a good post ill read up


Firefox youtube video and audio downloader MP3 MP4 OGG WEBM

https://addons.mozilla.org/en-US/firefox/addon/simple-youtube-converter/


#7 Hodgman   Moderators   -  Reputation: 31938

Like
4Likes
Like

Posted 05 August 2014 - 08:19 PM

Is there a way to do it in reverse so something already existing using opengl can run in a browser or mobile with opengles? Is there a higher language that could be used across everything?

That's what game engines do - they make up their own higher level API and then implement it repeatedly for every back-end.
e.g. Not the best example, but the Horde3D graphics engine is originally built on GL, but then ported to GLES and D3D.

Do developers usually make multiple shaders for multiple targets?

The technique that I've seen most often is that you write your shaders in HLSL/Cg (pretty much the same language), with some #defines to cover up the differences between different HLSL-based back-ends. Then you use something like hlsl2glsl to support OpenGL.



#8 Promit   Moderators   -  Reputation: 7671

Like
1Likes
Like

Posted 05 August 2014 - 09:19 PM

We run the same render path for desktop and mobile GL. I have a "proxy" header, which defines functions like gl::Clear, gl::VertexAttribPointer, etc instead. The proxy changes a few function names as needed, and a few things are switched on either compile or runtime flags. (Not many things.) I don't try to fully emulate correct GL ES behavior on desktop; I just want my ES code to run. This proxy does that and works across Windows, Linux, Mac, and iOS. 

 

As for shaders, I found that trying to share them across desktop and mobile was a catastrophe. I now use hlsl2glsl (linked above) with some custom patches for full Mac and ES support. I should remember to assemble those changes into a pull request some day.


Edited by Promit, 05 August 2014 - 09:20 PM.


#9 Karsten_   Members   -  Reputation: 1655

Like
0Likes
Like

Posted 06 August 2014 - 04:34 AM

You might want to try out Emscripten. It compiles fairly typical C/C++ OpenGL code to Javascript / WebGL (WebGL is a subset of OpenGL ES).

You might also like to have a look at PVRVFrame which is part of the Imagination Technologies PowerVR SDK (http://www.imgtec.com/tools/powervr-tools/). We had a talk from these guys at work and these tools certainly looked useful.

Edited by Karsten_, 06 August 2014 - 04:39 AM.

Mutiny - Open-source C++ Unity re-implementation.
Defile of Eden 2 - FreeBSD and OpenBSD binaries of our latest game.


#10 Katie   Members   -  Reputation: 1375

Like
0Likes
Like

Posted 06 August 2014 - 04:40 AM

ARM do a devkit which includes a library which will do ES->desktop translation for GL.

 

Browse around at http://malideveloper.arm.com/develop-for-mali/features/opengl-es-emulator-v1-4-released/



#11 SeanMiddleditch   Members   -  Reputation: 7257

Like
3Likes
Like

Posted 06 August 2014 - 12:08 PM

Getting SDL2 up with EGL/GLES2 on Windows is really easy, albeit super poorly documented and took me forever to figure out a couple simple mistakes.

Make sure you're using a recent version of SDL; the latest is 2.0.3, and I think you need at least 2.0.2.

You'll also need to grab libEGL.dll and libGLESv2.dll (or build them). The easiest option is to grab the copies installed with Google Chrome. You also need d3dcompiler_46.dll, either the copy with Chrome or the one that ships with the D3D SDK (they're the same file).

Copy those DLLs along with the SDL2 DLL into your binary build directory like normal. When you build your app, do _not_ link to OpenGL32.lib like you would for a normal Windows GL application. When creating your window/context in SDL2, do (and this is from memory, so probably some small mistakes):
 
// helper, not strictly necessary
#include <SDL_opengles2.h>

#include <SDL.h>

void setup() {
  // must be done _before_ creating the window - this tells SDL to create an ES context instead of a GL one.
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES);

  // not necessary, but I like being pedantic
  // ANGLE will support ES 3 very soon, so you might bump this up after if you want to target new mobiles and Firefox's WebGL2 experiment
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2);
  SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0);

  // create window with OpenGL flag
  SDL_Window* window = SDL_CreateWindow("test", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_OPENGL);

  // create the context
  SDL_GLContext ctx = SDL_GL_CreateContext(window);
|

void clear_example() {
  // you need to grab the pointers since you didn't link directly with libGLESv2; or you could use a helper glue library, glew or glee or something, not sure which of them support ES
  // you also want to do all these lookups once and not do them every frame
  using ClearFunctionT = void(KHRONOS_APIENTRY*)(GLbitfield);
  ClearFunctionT fClear = (ClearFunctionT)SDL_GL_GetProcAddress("glClear");

  fClear(GL_COLOR_BUFFER_BIT);
}





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS