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

Started by
3 comments, last by _WeirdCat_ 7 years, 6 months ago

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 ^_^

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.

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.

Interested in Fractals? Check out my App, Fractal Scout, free on the Google Play store.

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.

maybe this

https://sites.google.com/site/customprog/home/setup-eclipse-for-android-c-java

ill post template that you cant import soon, after that you should be able plug your phone to pc via usb and hit run button on eclipse (ofc if you set your phone)

This topic is closed to new replies.

Advertisement