Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use OpenGL GLES instead of full OpelGL on desktop?

I want to learn OpenGL to program a game in C language but I am a little confused about which library choose, the intention is to generate a C library with the game logic and using Android NDK to interface with the resources in phones.

I found an example that use GLESv2 library and this works well, I think I know that the GLES library was created because mobile devices can't use full OpenGL library.

but the real question is: Is GLES a subset of full OpelGL library in order that I can build and run my game app using GLES library on linux desktop?

Can you give me a clue if I'm going the right way with these library?

like image 544
Simon Puente Avatar asked Oct 26 '25 05:10

Simon Puente


1 Answers

Is GLES a subset of full OpelGL library in order that I can build and run my game app using GLES library on linux desktop?

No, it is not. OpenGLES is a separate spec.

That said, it's very close to being a subset of OpenGL. It would be a perfectly sensible approach to have shared OpenGL code that you compile into both your Linux and Android executables. You'd have to be careful to only use functionality supported by OpenGLES and you might find you need the odd #if to account for slight differences in the APIs, but 95%+ of the code could work across both APIs.

The alternative is to use the OpenGLES API on desktop. gzh's answer implies that Linux ships with GLES which would make life easy. But if it doesn't you could look at tools like PowerVR's emulator (pvrvframe) or Mali's emulator. My only experience is using pvrvframe on Windows, which worked very well for us - performance was noticeably worse than non-emulated codepaths, but it still managed to run a demanding mobile game at playable framerates.

like image 89
Columbo Avatar answered Oct 28 '25 18:10

Columbo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!