Jump to content
  • Advertisement
Sign in to follow this  
FantasyVII

Getting start with OpenGL ES 2.0 and using NDK in C++

This topic is 646 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

 

I'm writing a cross platform engine in C++. So far my engine uses OpenGL 4.5 and DirectX 11 and runs on Windows and Linux. I would love to be able to port it to Android.

 

I basically want to be able to create an OpenGL ES 2.0 context in C++ using the Android NDK while still being able to write java functions. I found NVIDIA CodeWorks for Android which lets you create all sorts of Android projects in VS 2015 including an Android Application with Native code. I just don't know how to start writing OpenGL ES code and everything I find on google is code written in java not C++.

 

Can anyone recommend a tutorial or a book about OpenGL ES 2.0 in C++?

 

Thanks  ^_^

Share this post


Link to post
Share on other sites
Advertisement

There is nothing special about OpenGL ES...its just a subset of desktop GL along with the quirks of OpenGL. You mentioned that you already have a OpenGL 4.5 codebase, indicating you already have experience with OpenGL. That being the case, all you need for reference is the man pages for OpenGL and EGL. The NDK samples would have all the boiler plate code you'll need to get started, assuming you already have the higher level framework in place.

Share this post


Link to post
Share on other sites

I don't have any tutorials but I've written an App using OpenGL ES 2.0 with previous experience using OpenGL 4+. I found that most current OpenGL tutorials are still very relevant (aim for tutorials based on OpenGL 2-3). There were a few times where I would suddenly find something I was expecting to use doesn't exist in OpenGL ES 2.0 so I had to change how I did things but in general this was few and far between. If you are making a cross platform engine then you will no doubt hit a few more issues that I did not get.

 

Not the most useful post but I wanted to say that you should just get on and do it using your current c++/OpenGL experience and just deal with the odd issue here and there as it comes up. The Codeworks thing you mentioned probably already does all the context creation etc. I used Visual Studio's NativeApplication project that did all the context creation for me which I modified to how I needed it. You'll be surprised how similar it all is, I think seeing Java code using OpenGL ES just makes it look more alien than it really is.

Edited by Nanoha

Share this post


Link to post
Share on other sites

I think the OP is wondering more about how to use OpenGLES2 in native code as part of a Java application (as opposed to a NativeActivity), rather than wondering how GLES2 actually works.

 

Myself, I've always used GlSurfaceView to manage the EGL side of things (context creation, etc), and make calls into native code from there. I'm not aware of a good solid tutorial, let alone an entire book that showcases that sort of approach.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!